001package org.hl7.fhir.r4.formats;
002
003import java.io.IOException;
004
005import org.hl7.fhir.exceptions.FHIRFormatError;
006
007
008
009/*
010  Copyright (c) 2011+, HL7, Inc.
011  All rights reserved.
012  
013  Redistribution and use in source and binary forms, with or without modification, 
014  are permitted provided that the following conditions are met:
015  
016   * Redistributions of source code must retain the above copyright notice, this 
017     list of conditions and the following disclaimer.
018   * Redistributions in binary form must reproduce the above copyright notice, 
019     this list of conditions and the following disclaimer in the documentation 
020     and/or other materials provided with the distribution.
021   * Neither the name of HL7 nor the names of its contributors may be used to 
022     endorse or promote products derived from this software without specific 
023     prior written permission.
024  
025  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
026  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
027  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
028  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
029  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
030  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
031  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
032  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
033  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
034  POSSIBILITY OF SUCH DAMAGE.
035  
036*/
037
038// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
039import org.hl7.fhir.r4.model.*;
040import org.hl7.fhir.utilities.Utilities;
041import org.hl7.fhir.utilities.json.JsonTrackingParser.PresentedBigDecimal;
042import org.hl7.fhir.utilities.xhtml.XhtmlNode;
043
044import com.google.gson.JsonArray;
045import com.google.gson.JsonObject;
046
047public class JsonParser extends JsonParserBase {
048
049  public JsonParser() {
050    super();
051  }
052
053  public JsonParser(boolean allowUnknownContent) {
054    super();
055    setAllowUnknownContent(allowUnknownContent);
056  }
057
058  public JsonParser(boolean allowUnknownContent, boolean allowComments) {
059    super();
060    setAllowUnknownContent(allowUnknownContent);
061    setAllowComments(allowComments);
062  }
063
064  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
065    super.parseElementProperties(json, element);
066    if (json.has("extension")) {
067      JsonArray array = json.getAsJsonArray("extension");
068      for (int i = 0; i < array.size(); i++) {
069        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
070      }
071    };
072  }
073
074  protected void parseBackboneElementProperties(JsonObject json, BackboneElement element) throws IOException, FHIRFormatError {
075    parseElementProperties(json, element);
076    if (json.has("modifierExtension")) {
077      JsonArray array = json.getAsJsonArray("modifierExtension");
078      for (int i = 0; i < array.size(); i++) {
079        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
080      }
081    }
082  }
083
084  protected void parseBackboneElementProperties(JsonObject json, BackboneType element) throws IOException, FHIRFormatError {
085    parseElementProperties(json, element);
086    if (json.has("modifierExtension")) {
087      JsonArray array = json.getAsJsonArray("modifierExtension");
088      for (int i = 0; i < array.size(); i++) {
089        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
090      }
091    }
092  }
093
094  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
095    parseElementProperties(json, element);
096  }
097
098  @SuppressWarnings("unchecked")
099  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
100    Enumeration<E> res = new Enumeration<E>(e);
101    if (s != null)
102      res.setValue((E) e.fromCode(s));
103    return res;
104  }
105
106  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
107    DateType res = new DateType(v);
108    return res;
109  }
110
111  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
112    DateTimeType res = new DateTimeType(v);
113    return res;
114  }
115
116  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
117    CodeType res = new CodeType(v);
118    return res;
119  }
120
121  protected StringType parseString(String v) throws IOException, FHIRFormatError {
122    StringType res = new StringType(v);
123    return res;
124  }
125
126  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
127    IntegerType res = new IntegerType(v);
128    return res;
129  }
130
131  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
132    OidType res = new OidType(v);
133    return res;
134  }
135
136  protected CanonicalType parseCanonical(String v) throws IOException, FHIRFormatError {
137    CanonicalType res = new CanonicalType(v);
138    return res;
139  }
140
141  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
142    UriType res = new UriType(v);
143    return res;
144  }
145
146  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
147    UuidType res = new UuidType(v);
148    return res;
149  }
150
151  protected UrlType parseUrl(String v) throws IOException, FHIRFormatError {
152    UrlType res = new UrlType(v);
153    return res;
154  }
155
156  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
157    InstantType res = new InstantType(v);
158    return res;
159  }
160
161  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
162    BooleanType res = new BooleanType(v);
163    return res;
164  }
165
166  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
167    Base64BinaryType res = new Base64BinaryType(v);
168    return res;
169  }
170
171  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
172    UnsignedIntType res = new UnsignedIntType(v);
173    return res;
174  }
175
176  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
177    MarkdownType res = new MarkdownType(v);
178    return res;
179  }
180
181  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
182    TimeType res = new TimeType(v);
183    return res;
184  }
185
186  protected IdType parseId(String v) throws IOException, FHIRFormatError {
187    IdType res = new IdType(v);
188    return res;
189  }
190
191  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
192    PositiveIntType res = new PositiveIntType(v);
193    return res;
194  }
195
196  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
197    DecimalType res = new DecimalType(v);
198    if (v instanceof PresentedBigDecimal)
199      res.setRepresentation(((PresentedBigDecimal) v).getPresentation());
200    return res;
201  }
202
203  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
204    Extension res = new Extension();
205    parseExtensionProperties(json, res);
206    return res;
207  }
208
209  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
210    parseTypeProperties(json, res);
211    if (json.has("url"))
212      res.setUrlElement(parseUri(json.get("url").getAsString()));
213    if (json.has("_url"))
214      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
215    Type value = parseType("value", json);
216    if (value != null)
217      res.setValue(value);
218  }
219
220  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
221    Narrative res = new Narrative();
222    parseNarrativeProperties(json, res);
223    return res;
224  }
225
226  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
227    parseTypeProperties(json, res);
228    if (json.has("status"))
229      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
230    if (json.has("_status"))
231      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
232    if (json.has("div"))
233      res.setDiv(parseXhtml(json.get("div").getAsString()));
234  }
235
236  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
237    Meta res = new Meta();
238    parseMetaProperties(json, res);
239    return res;
240  }
241
242  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
243    parseElementProperties(json, res);
244    if (json.has("versionId"))
245      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
246    if (json.has("_versionId"))
247      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
248    if (json.has("lastUpdated"))
249      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
250    if (json.has("_lastUpdated"))
251      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
252    if (json.has("source"))
253      res.setSourceElement(parseUri(json.get("source").getAsString()));
254    if (json.has("_source"))
255      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
256    if (json.has("profile")) {
257      JsonArray array = json.getAsJsonArray("profile");
258      for (int i = 0; i < array.size(); i++) {
259        if (array.get(i).isJsonNull()) {
260          res.getProfile().add(new CanonicalType());
261        } else {
262          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
263        }
264      }
265    };
266    if (json.has("_profile")) {
267      JsonArray array = json.getAsJsonArray("_profile");
268      for (int i = 0; i < array.size(); i++) {
269        if (i == res.getProfile().size())
270          res.getProfile().add(parseCanonical(null));
271        if (array.get(i) instanceof JsonObject) 
272          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
273      }
274    };
275    if (json.has("security")) {
276      JsonArray array = json.getAsJsonArray("security");
277      for (int i = 0; i < array.size(); i++) {
278        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
279      }
280    };
281    if (json.has("tag")) {
282      JsonArray array = json.getAsJsonArray("tag");
283      for (int i = 0; i < array.size(); i++) {
284        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
285      }
286    };
287  }
288
289  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
290    Address res = new Address();
291    parseAddressProperties(json, res);
292    return res;
293  }
294
295  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
296    parseTypeProperties(json, res);
297    if (json.has("use"))
298      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
299    if (json.has("_use"))
300      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
301    if (json.has("type"))
302      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
303    if (json.has("_type"))
304      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
305    if (json.has("text"))
306      res.setTextElement(parseString(json.get("text").getAsString()));
307    if (json.has("_text"))
308      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
309    if (json.has("line")) {
310      JsonArray array = json.getAsJsonArray("line");
311      for (int i = 0; i < array.size(); i++) {
312        if (array.get(i).isJsonNull()) {
313          res.getLine().add(new StringType());
314        } else {
315          res.getLine().add(parseString(array.get(i).getAsString()));
316        }
317      }
318    };
319    if (json.has("_line")) {
320      JsonArray array = json.getAsJsonArray("_line");
321      for (int i = 0; i < array.size(); i++) {
322        if (i == res.getLine().size())
323          res.getLine().add(parseString(null));
324        if (array.get(i) instanceof JsonObject) 
325          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
326      }
327    };
328    if (json.has("city"))
329      res.setCityElement(parseString(json.get("city").getAsString()));
330    if (json.has("_city"))
331      parseElementProperties(getJObject(json, "_city"), res.getCityElement());
332    if (json.has("district"))
333      res.setDistrictElement(parseString(json.get("district").getAsString()));
334    if (json.has("_district"))
335      parseElementProperties(getJObject(json, "_district"), res.getDistrictElement());
336    if (json.has("state"))
337      res.setStateElement(parseString(json.get("state").getAsString()));
338    if (json.has("_state"))
339      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
340    if (json.has("postalCode"))
341      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
342    if (json.has("_postalCode"))
343      parseElementProperties(getJObject(json, "_postalCode"), res.getPostalCodeElement());
344    if (json.has("country"))
345      res.setCountryElement(parseString(json.get("country").getAsString()));
346    if (json.has("_country"))
347      parseElementProperties(getJObject(json, "_country"), res.getCountryElement());
348    if (json.has("period"))
349      res.setPeriod(parsePeriod(getJObject(json, "period")));
350  }
351
352  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
353    Contributor res = new Contributor();
354    parseContributorProperties(json, res);
355    return res;
356  }
357
358  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
359    parseTypeProperties(json, res);
360    if (json.has("type"))
361      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
362    if (json.has("_type"))
363      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
364    if (json.has("name"))
365      res.setNameElement(parseString(json.get("name").getAsString()));
366    if (json.has("_name"))
367      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
368    if (json.has("contact")) {
369      JsonArray array = json.getAsJsonArray("contact");
370      for (int i = 0; i < array.size(); i++) {
371        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
372      }
373    };
374  }
375
376  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
377    Attachment res = new Attachment();
378    parseAttachmentProperties(json, res);
379    return res;
380  }
381
382  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
383    parseTypeProperties(json, res);
384    if (json.has("contentType"))
385      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
386    if (json.has("_contentType"))
387      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
388    if (json.has("language"))
389      res.setLanguageElement(parseCode(json.get("language").getAsString()));
390    if (json.has("_language"))
391      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
392    if (json.has("data"))
393      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
394    if (json.has("_data"))
395      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
396    if (json.has("url"))
397      res.setUrlElement(parseUrl(json.get("url").getAsString()));
398    if (json.has("_url"))
399      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
400    if (json.has("size"))
401      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
402    if (json.has("_size"))
403      parseElementProperties(getJObject(json, "_size"), res.getSizeElement());
404    if (json.has("hash"))
405      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
406    if (json.has("_hash"))
407      parseElementProperties(getJObject(json, "_hash"), res.getHashElement());
408    if (json.has("title"))
409      res.setTitleElement(parseString(json.get("title").getAsString()));
410    if (json.has("_title"))
411      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
412    if (json.has("creation"))
413      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
414    if (json.has("_creation"))
415      parseElementProperties(getJObject(json, "_creation"), res.getCreationElement());
416  }
417
418  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
419    Count res = new Count();
420    parseCountProperties(json, res);
421    return res;
422  }
423
424  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
425    parseQuantityProperties(json, res);
426  }
427
428  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
429    DataRequirement res = new DataRequirement();
430    parseDataRequirementProperties(json, res);
431    return res;
432  }
433
434  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
435    parseTypeProperties(json, res);
436    if (json.has("type"))
437      res.setTypeElement(parseCode(json.get("type").getAsString()));
438    if (json.has("_type"))
439      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
440    if (json.has("profile")) {
441      JsonArray array = json.getAsJsonArray("profile");
442      for (int i = 0; i < array.size(); i++) {
443        if (array.get(i).isJsonNull()) {
444          res.getProfile().add(new CanonicalType());
445        } else {
446          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
447        }
448      }
449    };
450    if (json.has("_profile")) {
451      JsonArray array = json.getAsJsonArray("_profile");
452      for (int i = 0; i < array.size(); i++) {
453        if (i == res.getProfile().size())
454          res.getProfile().add(parseCanonical(null));
455        if (array.get(i) instanceof JsonObject) 
456          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
457      }
458    };
459    Type subject = parseType("subject", json);
460    if (subject != null)
461      res.setSubject(subject);
462    if (json.has("mustSupport")) {
463      JsonArray array = json.getAsJsonArray("mustSupport");
464      for (int i = 0; i < array.size(); i++) {
465        if (array.get(i).isJsonNull()) {
466          res.getMustSupport().add(new StringType());
467        } else {
468          res.getMustSupport().add(parseString(array.get(i).getAsString()));
469        }
470      }
471    };
472    if (json.has("_mustSupport")) {
473      JsonArray array = json.getAsJsonArray("_mustSupport");
474      for (int i = 0; i < array.size(); i++) {
475        if (i == res.getMustSupport().size())
476          res.getMustSupport().add(parseString(null));
477        if (array.get(i) instanceof JsonObject) 
478          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
479      }
480    };
481    if (json.has("codeFilter")) {
482      JsonArray array = json.getAsJsonArray("codeFilter");
483      for (int i = 0; i < array.size(); i++) {
484        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
485      }
486    };
487    if (json.has("dateFilter")) {
488      JsonArray array = json.getAsJsonArray("dateFilter");
489      for (int i = 0; i < array.size(); i++) {
490        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
491      }
492    };
493    if (json.has("limit"))
494      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
495    if (json.has("_limit"))
496      parseElementProperties(getJObject(json, "_limit"), res.getLimitElement());
497    if (json.has("sort")) {
498      JsonArray array = json.getAsJsonArray("sort");
499      for (int i = 0; i < array.size(); i++) {
500        res.getSort().add(parseDataRequirementDataRequirementSortComponent(array.get(i).getAsJsonObject(), res));
501      }
502    };
503  }
504
505  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
506    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
507    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
508    return res;
509  }
510
511  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
512    parseTypeProperties(json, res);
513    if (json.has("path"))
514      res.setPathElement(parseString(json.get("path").getAsString()));
515    if (json.has("_path"))
516      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
517    if (json.has("searchParam"))
518      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
519    if (json.has("_searchParam"))
520      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
521    if (json.has("valueSet"))
522      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
523    if (json.has("_valueSet"))
524      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
525    if (json.has("code")) {
526      JsonArray array = json.getAsJsonArray("code");
527      for (int i = 0; i < array.size(); i++) {
528        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
529      }
530    };
531  }
532
533  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
534    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
535    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
536    return res;
537  }
538
539  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
540    parseTypeProperties(json, res);
541    if (json.has("path"))
542      res.setPathElement(parseString(json.get("path").getAsString()));
543    if (json.has("_path"))
544      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
545    if (json.has("searchParam"))
546      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
547    if (json.has("_searchParam"))
548      parseElementProperties(getJObject(json, "_searchParam"), res.getSearchParamElement());
549    Type value = parseType("value", json);
550    if (value != null)
551      res.setValue(value);
552  }
553
554  protected DataRequirement.DataRequirementSortComponent parseDataRequirementDataRequirementSortComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
555    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
556    parseDataRequirementDataRequirementSortComponentProperties(json, owner, res);
557    return res;
558  }
559
560  protected void parseDataRequirementDataRequirementSortComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
561    parseTypeProperties(json, res);
562    if (json.has("path"))
563      res.setPathElement(parseString(json.get("path").getAsString()));
564    if (json.has("_path"))
565      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
566    if (json.has("direction"))
567      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
568    if (json.has("_direction"))
569      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
570  }
571
572  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
573    Dosage res = new Dosage();
574    parseDosageProperties(json, res);
575    return res;
576  }
577
578  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
579    parseBackboneElementProperties(json, res);
580    if (json.has("sequence"))
581      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
582    if (json.has("_sequence"))
583      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
584    if (json.has("text"))
585      res.setTextElement(parseString(json.get("text").getAsString()));
586    if (json.has("_text"))
587      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
588    if (json.has("additionalInstruction")) {
589      JsonArray array = json.getAsJsonArray("additionalInstruction");
590      for (int i = 0; i < array.size(); i++) {
591        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
592      }
593    };
594    if (json.has("patientInstruction"))
595      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
596    if (json.has("_patientInstruction"))
597      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
598    if (json.has("timing"))
599      res.setTiming(parseTiming(getJObject(json, "timing")));
600    Type asNeeded = parseType("asNeeded", json);
601    if (asNeeded != null)
602      res.setAsNeeded(asNeeded);
603    if (json.has("site"))
604      res.setSite(parseCodeableConcept(getJObject(json, "site")));
605    if (json.has("route"))
606      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
607    if (json.has("method"))
608      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
609    if (json.has("doseAndRate")) {
610      JsonArray array = json.getAsJsonArray("doseAndRate");
611      for (int i = 0; i < array.size(); i++) {
612        res.getDoseAndRate().add(parseDosageDosageDoseAndRateComponent(array.get(i).getAsJsonObject(), res));
613      }
614    };
615    if (json.has("maxDosePerPeriod"))
616      res.setMaxDosePerPeriod(parseRatio(getJObject(json, "maxDosePerPeriod")));
617    if (json.has("maxDosePerAdministration"))
618      res.setMaxDosePerAdministration(parseQuantity(getJObject(json, "maxDosePerAdministration")));
619    if (json.has("maxDosePerLifetime"))
620      res.setMaxDosePerLifetime(parseQuantity(getJObject(json, "maxDosePerLifetime")));
621  }
622
623  protected Dosage.DosageDoseAndRateComponent parseDosageDosageDoseAndRateComponent(JsonObject json, Dosage owner) throws IOException, FHIRFormatError {
624    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
625    parseDosageDosageDoseAndRateComponentProperties(json, owner, res);
626    return res;
627  }
628
629  protected void parseDosageDosageDoseAndRateComponentProperties(JsonObject json, Dosage owner, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
630    parseTypeProperties(json, res);
631    if (json.has("type"))
632      res.setType(parseCodeableConcept(getJObject(json, "type")));
633    Type dose = parseType("dose", json);
634    if (dose != null)
635      res.setDose(dose);
636    Type rate = parseType("rate", json);
637    if (rate != null)
638      res.setRate(rate);
639  }
640
641  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
642    Money res = new Money();
643    parseMoneyProperties(json, res);
644    return res;
645  }
646
647  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
648    parseTypeProperties(json, res);
649    if (json.has("value"))
650      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
651    if (json.has("_value"))
652      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
653    if (json.has("currency"))
654      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
655    if (json.has("_currency"))
656      parseElementProperties(getJObject(json, "_currency"), res.getCurrencyElement());
657  }
658
659  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
660    HumanName res = new HumanName();
661    parseHumanNameProperties(json, res);
662    return res;
663  }
664
665  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
666    parseTypeProperties(json, res);
667    if (json.has("use"))
668      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
669    if (json.has("_use"))
670      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
671    if (json.has("text"))
672      res.setTextElement(parseString(json.get("text").getAsString()));
673    if (json.has("_text"))
674      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
675    if (json.has("family"))
676      res.setFamilyElement(parseString(json.get("family").getAsString()));
677    if (json.has("_family"))
678      parseElementProperties(getJObject(json, "_family"), res.getFamilyElement());
679    if (json.has("given")) {
680      JsonArray array = json.getAsJsonArray("given");
681      for (int i = 0; i < array.size(); i++) {
682        if (array.get(i).isJsonNull()) {
683          res.getGiven().add(new StringType());
684        } else {
685          res.getGiven().add(parseString(array.get(i).getAsString()));
686        }
687      }
688    };
689    if (json.has("_given")) {
690      JsonArray array = json.getAsJsonArray("_given");
691      for (int i = 0; i < array.size(); i++) {
692        if (i == res.getGiven().size())
693          res.getGiven().add(parseString(null));
694        if (array.get(i) instanceof JsonObject) 
695          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
696      }
697    };
698    if (json.has("prefix")) {
699      JsonArray array = json.getAsJsonArray("prefix");
700      for (int i = 0; i < array.size(); i++) {
701        if (array.get(i).isJsonNull()) {
702          res.getPrefix().add(new StringType());
703        } else {
704          res.getPrefix().add(parseString(array.get(i).getAsString()));
705        }
706      }
707    };
708    if (json.has("_prefix")) {
709      JsonArray array = json.getAsJsonArray("_prefix");
710      for (int i = 0; i < array.size(); i++) {
711        if (i == res.getPrefix().size())
712          res.getPrefix().add(parseString(null));
713        if (array.get(i) instanceof JsonObject) 
714          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
715      }
716    };
717    if (json.has("suffix")) {
718      JsonArray array = json.getAsJsonArray("suffix");
719      for (int i = 0; i < array.size(); i++) {
720        if (array.get(i).isJsonNull()) {
721          res.getSuffix().add(new StringType());
722        } else {
723          res.getSuffix().add(parseString(array.get(i).getAsString()));
724        }
725      }
726    };
727    if (json.has("_suffix")) {
728      JsonArray array = json.getAsJsonArray("_suffix");
729      for (int i = 0; i < array.size(); i++) {
730        if (i == res.getSuffix().size())
731          res.getSuffix().add(parseString(null));
732        if (array.get(i) instanceof JsonObject) 
733          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
734      }
735    };
736    if (json.has("period"))
737      res.setPeriod(parsePeriod(getJObject(json, "period")));
738  }
739
740  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
741    ContactPoint res = new ContactPoint();
742    parseContactPointProperties(json, res);
743    return res;
744  }
745
746  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
747    parseTypeProperties(json, res);
748    if (json.has("system"))
749      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
750    if (json.has("_system"))
751      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
752    if (json.has("value"))
753      res.setValueElement(parseString(json.get("value").getAsString()));
754    if (json.has("_value"))
755      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
756    if (json.has("use"))
757      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
758    if (json.has("_use"))
759      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
760    if (json.has("rank"))
761      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
762    if (json.has("_rank"))
763      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
764    if (json.has("period"))
765      res.setPeriod(parsePeriod(getJObject(json, "period")));
766  }
767
768  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
769    MarketingStatus res = new MarketingStatus();
770    parseMarketingStatusProperties(json, res);
771    return res;
772  }
773
774  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
775    parseBackboneElementProperties(json, res);
776    if (json.has("country"))
777      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
778    if (json.has("jurisdiction"))
779      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
780    if (json.has("status"))
781      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
782    if (json.has("dateRange"))
783      res.setDateRange(parsePeriod(getJObject(json, "dateRange")));
784    if (json.has("restoreDate"))
785      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
786    if (json.has("_restoreDate"))
787      parseElementProperties(getJObject(json, "_restoreDate"), res.getRestoreDateElement());
788  }
789
790  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
791    Identifier res = new Identifier();
792    parseIdentifierProperties(json, res);
793    return res;
794  }
795
796  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
797    parseTypeProperties(json, res);
798    if (json.has("use"))
799      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
800    if (json.has("_use"))
801      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
802    if (json.has("type"))
803      res.setType(parseCodeableConcept(getJObject(json, "type")));
804    if (json.has("system"))
805      res.setSystemElement(parseUri(json.get("system").getAsString()));
806    if (json.has("_system"))
807      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
808    if (json.has("value"))
809      res.setValueElement(parseString(json.get("value").getAsString()));
810    if (json.has("_value"))
811      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
812    if (json.has("period"))
813      res.setPeriod(parsePeriod(getJObject(json, "period")));
814    if (json.has("assigner"))
815      res.setAssigner(parseReference(getJObject(json, "assigner")));
816  }
817
818  protected SubstanceAmount parseSubstanceAmount(JsonObject json) throws IOException, FHIRFormatError {
819    SubstanceAmount res = new SubstanceAmount();
820    parseSubstanceAmountProperties(json, res);
821    return res;
822  }
823
824  protected void parseSubstanceAmountProperties(JsonObject json, SubstanceAmount res) throws IOException, FHIRFormatError {
825    parseBackboneElementProperties(json, res);
826    Type amount = parseType("amount", json);
827    if (amount != null)
828      res.setAmount(amount);
829    if (json.has("amountType"))
830      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
831    if (json.has("amountText"))
832      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
833    if (json.has("_amountText"))
834      parseElementProperties(getJObject(json, "_amountText"), res.getAmountTextElement());
835    if (json.has("referenceRange"))
836      res.setReferenceRange(parseSubstanceAmountSubstanceAmountReferenceRangeComponent(getJObject(json, "referenceRange"), res));
837  }
838
839  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountSubstanceAmountReferenceRangeComponent(JsonObject json, SubstanceAmount owner) throws IOException, FHIRFormatError {
840    SubstanceAmount.SubstanceAmountReferenceRangeComponent res = new SubstanceAmount.SubstanceAmountReferenceRangeComponent();
841    parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(json, owner, res);
842    return res;
843  }
844
845  protected void parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(JsonObject json, SubstanceAmount owner, SubstanceAmount.SubstanceAmountReferenceRangeComponent res) throws IOException, FHIRFormatError {
846    parseTypeProperties(json, res);
847    if (json.has("lowLimit"))
848      res.setLowLimit(parseQuantity(getJObject(json, "lowLimit")));
849    if (json.has("highLimit"))
850      res.setHighLimit(parseQuantity(getJObject(json, "highLimit")));
851  }
852
853  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
854    Coding res = new Coding();
855    parseCodingProperties(json, res);
856    return res;
857  }
858
859  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
860    parseTypeProperties(json, res);
861    if (json.has("system"))
862      res.setSystemElement(parseUri(json.get("system").getAsString()));
863    if (json.has("_system"))
864      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
865    if (json.has("version"))
866      res.setVersionElement(parseString(json.get("version").getAsString()));
867    if (json.has("_version"))
868      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
869    if (json.has("code"))
870      res.setCodeElement(parseCode(json.get("code").getAsString()));
871    if (json.has("_code"))
872      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
873    if (json.has("display"))
874      res.setDisplayElement(parseString(json.get("display").getAsString()));
875    if (json.has("_display"))
876      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
877    if (json.has("userSelected"))
878      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
879    if (json.has("_userSelected"))
880      parseElementProperties(getJObject(json, "_userSelected"), res.getUserSelectedElement());
881  }
882
883  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
884    SampledData res = new SampledData();
885    parseSampledDataProperties(json, res);
886    return res;
887  }
888
889  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
890    parseTypeProperties(json, res);
891    if (json.has("origin"))
892      res.setOrigin(parseQuantity(getJObject(json, "origin")));
893    if (json.has("period"))
894      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
895    if (json.has("_period"))
896      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
897    if (json.has("factor"))
898      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
899    if (json.has("_factor"))
900      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
901    if (json.has("lowerLimit"))
902      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
903    if (json.has("_lowerLimit"))
904      parseElementProperties(getJObject(json, "_lowerLimit"), res.getLowerLimitElement());
905    if (json.has("upperLimit"))
906      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
907    if (json.has("_upperLimit"))
908      parseElementProperties(getJObject(json, "_upperLimit"), res.getUpperLimitElement());
909    if (json.has("dimensions"))
910      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
911    if (json.has("_dimensions"))
912      parseElementProperties(getJObject(json, "_dimensions"), res.getDimensionsElement());
913    if (json.has("data"))
914      res.setDataElement(parseString(json.get("data").getAsString()));
915    if (json.has("_data"))
916      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
917  }
918
919  protected Population parsePopulation(JsonObject json) throws IOException, FHIRFormatError {
920    Population res = new Population();
921    parsePopulationProperties(json, res);
922    return res;
923  }
924
925  protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
926    parseBackboneElementProperties(json, res);
927    Type age = parseType("age", json);
928    if (age != null)
929      res.setAge(age);
930    if (json.has("gender"))
931      res.setGender(parseCodeableConcept(getJObject(json, "gender")));
932    if (json.has("race"))
933      res.setRace(parseCodeableConcept(getJObject(json, "race")));
934    if (json.has("physiologicalCondition"))
935      res.setPhysiologicalCondition(parseCodeableConcept(getJObject(json, "physiologicalCondition")));
936  }
937
938  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
939    Ratio res = new Ratio();
940    parseRatioProperties(json, res);
941    return res;
942  }
943
944  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
945    parseTypeProperties(json, res);
946    if (json.has("numerator"))
947      res.setNumerator(parseQuantity(getJObject(json, "numerator")));
948    if (json.has("denominator"))
949      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
950  }
951
952  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
953    Distance res = new Distance();
954    parseDistanceProperties(json, res);
955    return res;
956  }
957
958  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
959    parseQuantityProperties(json, res);
960  }
961
962  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
963    Age res = new Age();
964    parseAgeProperties(json, res);
965    return res;
966  }
967
968  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
969    parseQuantityProperties(json, res);
970  }
971
972  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
973    Reference res = new Reference();
974    parseReferenceProperties(json, res);
975    return res;
976  }
977
978  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
979    parseTypeProperties(json, res);
980    if (json.has("reference"))
981      res.setReferenceElement(parseString(json.get("reference").getAsString()));
982    if (json.has("_reference"))
983      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
984    if (json.has("type"))
985      res.setTypeElement(parseUri(json.get("type").getAsString()));
986    if (json.has("_type"))
987      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
988    if (json.has("identifier"))
989      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
990    if (json.has("display"))
991      res.setDisplayElement(parseString(json.get("display").getAsString()));
992    if (json.has("_display"))
993      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
994  }
995
996  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
997    TriggerDefinition res = new TriggerDefinition();
998    parseTriggerDefinitionProperties(json, res);
999    return res;
1000  }
1001
1002  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
1003    parseTypeProperties(json, res);
1004    if (json.has("type"))
1005      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
1006    if (json.has("_type"))
1007      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1008    if (json.has("name"))
1009      res.setNameElement(parseString(json.get("name").getAsString()));
1010    if (json.has("_name"))
1011      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1012    Type timing = parseType("timing", json);
1013    if (timing != null)
1014      res.setTiming(timing);
1015    if (json.has("data")) {
1016      JsonArray array = json.getAsJsonArray("data");
1017      for (int i = 0; i < array.size(); i++) {
1018        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
1019      }
1020    };
1021    if (json.has("condition"))
1022      res.setCondition(parseExpression(getJObject(json, "condition")));
1023  }
1024
1025  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
1026    Quantity res = new Quantity();
1027    parseQuantityProperties(json, res);
1028    return res;
1029  }
1030
1031  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1032    parseTypeProperties(json, res);
1033    if (json.has("value"))
1034      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1035    if (json.has("_value"))
1036      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1037    if (json.has("comparator"))
1038      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
1039    if (json.has("_comparator"))
1040      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
1041    if (json.has("unit"))
1042      res.setUnitElement(parseString(json.get("unit").getAsString()));
1043    if (json.has("_unit"))
1044      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
1045    if (json.has("system"))
1046      res.setSystemElement(parseUri(json.get("system").getAsString()));
1047    if (json.has("_system"))
1048      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1049    if (json.has("code"))
1050      res.setCodeElement(parseCode(json.get("code").getAsString()));
1051    if (json.has("_code"))
1052      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1053  }
1054
1055  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1056    Period res = new Period();
1057    parsePeriodProperties(json, res);
1058    return res;
1059  }
1060
1061  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1062    parseTypeProperties(json, res);
1063    if (json.has("start"))
1064      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1065    if (json.has("_start"))
1066      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
1067    if (json.has("end"))
1068      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1069    if (json.has("_end"))
1070      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
1071  }
1072
1073  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
1074    Duration res = new Duration();
1075    parseDurationProperties(json, res);
1076    return res;
1077  }
1078
1079  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
1080    parseQuantityProperties(json, res);
1081  }
1082
1083  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1084    Range res = new Range();
1085    parseRangeProperties(json, res);
1086    return res;
1087  }
1088
1089  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1090    parseTypeProperties(json, res);
1091    if (json.has("low"))
1092      res.setLow(parseQuantity(getJObject(json, "low")));
1093    if (json.has("high"))
1094      res.setHigh(parseQuantity(getJObject(json, "high")));
1095  }
1096
1097  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1098    RelatedArtifact res = new RelatedArtifact();
1099    parseRelatedArtifactProperties(json, res);
1100    return res;
1101  }
1102
1103  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
1104    parseTypeProperties(json, res);
1105    if (json.has("type"))
1106      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1107    if (json.has("_type"))
1108      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1109    if (json.has("label"))
1110      res.setLabelElement(parseString(json.get("label").getAsString()));
1111    if (json.has("_label"))
1112      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1113    if (json.has("display"))
1114      res.setDisplayElement(parseString(json.get("display").getAsString()));
1115    if (json.has("_display"))
1116      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
1117    if (json.has("citation"))
1118      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1119    if (json.has("_citation"))
1120      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
1121    if (json.has("url"))
1122      res.setUrlElement(parseUrl(json.get("url").getAsString()));
1123    if (json.has("_url"))
1124      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
1125    if (json.has("document"))
1126      res.setDocument(parseAttachment(getJObject(json, "document")));
1127    if (json.has("resource"))
1128      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1129    if (json.has("_resource"))
1130      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
1131  }
1132
1133  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
1134    Annotation res = new Annotation();
1135    parseAnnotationProperties(json, res);
1136    return res;
1137  }
1138
1139  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
1140    parseTypeProperties(json, res);
1141    Type author = parseType("author", json);
1142    if (author != null)
1143      res.setAuthor(author);
1144    if (json.has("time"))
1145      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
1146    if (json.has("_time"))
1147      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
1148    if (json.has("text"))
1149      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
1150    if (json.has("_text"))
1151      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
1152  }
1153
1154  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1155    ProductShelfLife res = new ProductShelfLife();
1156    parseProductShelfLifeProperties(json, res);
1157    return res;
1158  }
1159
1160  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1161    parseBackboneElementProperties(json, res);
1162    if (json.has("identifier"))
1163      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
1164    if (json.has("type"))
1165      res.setType(parseCodeableConcept(getJObject(json, "type")));
1166    if (json.has("period"))
1167      res.setPeriod(parseQuantity(getJObject(json, "period")));
1168    if (json.has("specialPrecautionsForStorage")) {
1169      JsonArray array = json.getAsJsonArray("specialPrecautionsForStorage");
1170      for (int i = 0; i < array.size(); i++) {
1171        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1172      }
1173    };
1174  }
1175
1176  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
1177    ContactDetail res = new ContactDetail();
1178    parseContactDetailProperties(json, res);
1179    return res;
1180  }
1181
1182  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
1183    parseTypeProperties(json, res);
1184    if (json.has("name"))
1185      res.setNameElement(parseString(json.get("name").getAsString()));
1186    if (json.has("_name"))
1187      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1188    if (json.has("telecom")) {
1189      JsonArray array = json.getAsJsonArray("telecom");
1190      for (int i = 0; i < array.size(); i++) {
1191        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1192      }
1193    };
1194  }
1195
1196  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1197    UsageContext res = new UsageContext();
1198    parseUsageContextProperties(json, res);
1199    return res;
1200  }
1201
1202  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1203    parseTypeProperties(json, res);
1204    if (json.has("code"))
1205      res.setCode(parseCoding(getJObject(json, "code")));
1206    Type value = parseType("value", json);
1207    if (value != null)
1208      res.setValue(value);
1209  }
1210
1211  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1212    Expression res = new Expression();
1213    parseExpressionProperties(json, res);
1214    return res;
1215  }
1216
1217  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1218    parseElementProperties(json, res);
1219    if (json.has("description"))
1220      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1221    if (json.has("_description"))
1222      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1223    if (json.has("name"))
1224      res.setNameElement(parseId(json.get("name").getAsString()));
1225    if (json.has("_name"))
1226      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1227    if (json.has("language"))
1228      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1229    if (json.has("_language"))
1230      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1231    if (json.has("expression"))
1232      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1233    if (json.has("_expression"))
1234      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1235    if (json.has("reference"))
1236      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1237    if (json.has("_reference"))
1238      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
1239  }
1240
1241  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1242    Signature res = new Signature();
1243    parseSignatureProperties(json, res);
1244    return res;
1245  }
1246
1247  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1248    parseTypeProperties(json, res);
1249    if (json.has("type")) {
1250      JsonArray array = json.getAsJsonArray("type");
1251      for (int i = 0; i < array.size(); i++) {
1252        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1253      }
1254    };
1255    if (json.has("when"))
1256      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1257    if (json.has("_when"))
1258      parseElementProperties(getJObject(json, "_when"), res.getWhenElement());
1259    if (json.has("who"))
1260      res.setWho(parseReference(getJObject(json, "who")));
1261    if (json.has("onBehalfOf"))
1262      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
1263    if (json.has("targetFormat"))
1264      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1265    if (json.has("_targetFormat"))
1266      parseElementProperties(getJObject(json, "_targetFormat"), res.getTargetFormatElement());
1267    if (json.has("sigFormat"))
1268      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1269    if (json.has("_sigFormat"))
1270      parseElementProperties(getJObject(json, "_sigFormat"), res.getSigFormatElement());
1271    if (json.has("data"))
1272      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1273    if (json.has("_data"))
1274      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1275  }
1276
1277  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1278    Timing res = new Timing();
1279    parseTimingProperties(json, res);
1280    return res;
1281  }
1282
1283  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1284    parseBackboneElementProperties(json, res);
1285    if (json.has("event")) {
1286      JsonArray array = json.getAsJsonArray("event");
1287      for (int i = 0; i < array.size(); i++) {
1288        if (array.get(i).isJsonNull()) {
1289          res.getEvent().add(new DateTimeType());
1290        } else {
1291          res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1292        }
1293      }
1294    };
1295    if (json.has("_event")) {
1296      JsonArray array = json.getAsJsonArray("_event");
1297      for (int i = 0; i < array.size(); i++) {
1298        if (i == res.getEvent().size())
1299          res.getEvent().add(parseDateTime(null));
1300        if (array.get(i) instanceof JsonObject) 
1301          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1302      }
1303    };
1304    if (json.has("repeat"))
1305      res.setRepeat(parseTimingTimingRepeatComponent(getJObject(json, "repeat"), res));
1306    if (json.has("code"))
1307      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1308  }
1309
1310  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1311    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1312    parseTimingTimingRepeatComponentProperties(json, owner, res);
1313    return res;
1314  }
1315
1316  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1317    parseTypeProperties(json, res);
1318    Type bounds = parseType("bounds", json);
1319    if (bounds != null)
1320      res.setBounds(bounds);
1321    if (json.has("count"))
1322      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
1323    if (json.has("_count"))
1324      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
1325    if (json.has("countMax"))
1326      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
1327    if (json.has("_countMax"))
1328      parseElementProperties(getJObject(json, "_countMax"), res.getCountMaxElement());
1329    if (json.has("duration"))
1330      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1331    if (json.has("_duration"))
1332      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
1333    if (json.has("durationMax"))
1334      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1335    if (json.has("_durationMax"))
1336      parseElementProperties(getJObject(json, "_durationMax"), res.getDurationMaxElement());
1337    if (json.has("durationUnit"))
1338      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1339    if (json.has("_durationUnit"))
1340      parseElementProperties(getJObject(json, "_durationUnit"), res.getDurationUnitElement());
1341    if (json.has("frequency"))
1342      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
1343    if (json.has("_frequency"))
1344      parseElementProperties(getJObject(json, "_frequency"), res.getFrequencyElement());
1345    if (json.has("frequencyMax"))
1346      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
1347    if (json.has("_frequencyMax"))
1348      parseElementProperties(getJObject(json, "_frequencyMax"), res.getFrequencyMaxElement());
1349    if (json.has("period"))
1350      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1351    if (json.has("_period"))
1352      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
1353    if (json.has("periodMax"))
1354      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1355    if (json.has("_periodMax"))
1356      parseElementProperties(getJObject(json, "_periodMax"), res.getPeriodMaxElement());
1357    if (json.has("periodUnit"))
1358      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1359    if (json.has("_periodUnit"))
1360      parseElementProperties(getJObject(json, "_periodUnit"), res.getPeriodUnitElement());
1361    if (json.has("dayOfWeek")) {
1362      JsonArray array = json.getAsJsonArray("dayOfWeek");
1363      for (int i = 0; i < array.size(); i++) {
1364        if (array.get(i).isJsonNull()) {
1365          res.getDayOfWeek().add(new Enumeration<Timing.DayOfWeek>());
1366        } else {
1367          res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1368        }
1369      }
1370    };
1371    if (json.has("_dayOfWeek")) {
1372      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1373      for (int i = 0; i < array.size(); i++) {
1374        if (i == res.getDayOfWeek().size())
1375          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1376        if (array.get(i) instanceof JsonObject) 
1377          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1378      }
1379    };
1380    if (json.has("timeOfDay")) {
1381      JsonArray array = json.getAsJsonArray("timeOfDay");
1382      for (int i = 0; i < array.size(); i++) {
1383        if (array.get(i).isJsonNull()) {
1384          res.getTimeOfDay().add(new TimeType());
1385        } else {
1386          res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1387        }
1388      }
1389    };
1390    if (json.has("_timeOfDay")) {
1391      JsonArray array = json.getAsJsonArray("_timeOfDay");
1392      for (int i = 0; i < array.size(); i++) {
1393        if (i == res.getTimeOfDay().size())
1394          res.getTimeOfDay().add(parseTime(null));
1395        if (array.get(i) instanceof JsonObject) 
1396          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1397      }
1398    };
1399    if (json.has("when")) {
1400      JsonArray array = json.getAsJsonArray("when");
1401      for (int i = 0; i < array.size(); i++) {
1402        if (array.get(i).isJsonNull()) {
1403          res.getWhen().add(new Enumeration<Timing.EventTiming>());
1404        } else {
1405          res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1406        }
1407      }
1408    };
1409    if (json.has("_when")) {
1410      JsonArray array = json.getAsJsonArray("_when");
1411      for (int i = 0; i < array.size(); i++) {
1412        if (i == res.getWhen().size())
1413          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1414        if (array.get(i) instanceof JsonObject) 
1415          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1416      }
1417    };
1418    if (json.has("offset"))
1419      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1420    if (json.has("_offset"))
1421      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
1422  }
1423
1424  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1425    ProdCharacteristic res = new ProdCharacteristic();
1426    parseProdCharacteristicProperties(json, res);
1427    return res;
1428  }
1429
1430  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
1431    parseBackboneElementProperties(json, res);
1432    if (json.has("height"))
1433      res.setHeight(parseQuantity(getJObject(json, "height")));
1434    if (json.has("width"))
1435      res.setWidth(parseQuantity(getJObject(json, "width")));
1436    if (json.has("depth"))
1437      res.setDepth(parseQuantity(getJObject(json, "depth")));
1438    if (json.has("weight"))
1439      res.setWeight(parseQuantity(getJObject(json, "weight")));
1440    if (json.has("nominalVolume"))
1441      res.setNominalVolume(parseQuantity(getJObject(json, "nominalVolume")));
1442    if (json.has("externalDiameter"))
1443      res.setExternalDiameter(parseQuantity(getJObject(json, "externalDiameter")));
1444    if (json.has("shape"))
1445      res.setShapeElement(parseString(json.get("shape").getAsString()));
1446    if (json.has("_shape"))
1447      parseElementProperties(getJObject(json, "_shape"), res.getShapeElement());
1448    if (json.has("color")) {
1449      JsonArray array = json.getAsJsonArray("color");
1450      for (int i = 0; i < array.size(); i++) {
1451        if (array.get(i).isJsonNull()) {
1452          res.getColor().add(new StringType());
1453        } else {
1454          res.getColor().add(parseString(array.get(i).getAsString()));
1455        }
1456      }
1457    };
1458    if (json.has("_color")) {
1459      JsonArray array = json.getAsJsonArray("_color");
1460      for (int i = 0; i < array.size(); i++) {
1461        if (i == res.getColor().size())
1462          res.getColor().add(parseString(null));
1463        if (array.get(i) instanceof JsonObject) 
1464          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1465      }
1466    };
1467    if (json.has("imprint")) {
1468      JsonArray array = json.getAsJsonArray("imprint");
1469      for (int i = 0; i < array.size(); i++) {
1470        if (array.get(i).isJsonNull()) {
1471          res.getImprint().add(new StringType());
1472        } else {
1473          res.getImprint().add(parseString(array.get(i).getAsString()));
1474        }
1475      }
1476    };
1477    if (json.has("_imprint")) {
1478      JsonArray array = json.getAsJsonArray("_imprint");
1479      for (int i = 0; i < array.size(); i++) {
1480        if (i == res.getImprint().size())
1481          res.getImprint().add(parseString(null));
1482        if (array.get(i) instanceof JsonObject) 
1483          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1484      }
1485    };
1486    if (json.has("image")) {
1487      JsonArray array = json.getAsJsonArray("image");
1488      for (int i = 0; i < array.size(); i++) {
1489        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1490      }
1491    };
1492    if (json.has("scoring"))
1493      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
1494  }
1495
1496  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
1497    CodeableConcept res = new CodeableConcept();
1498    parseCodeableConceptProperties(json, res);
1499    return res;
1500  }
1501
1502  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
1503    parseTypeProperties(json, res);
1504    if (json.has("coding")) {
1505      JsonArray array = json.getAsJsonArray("coding");
1506      for (int i = 0; i < array.size(); i++) {
1507        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
1508      }
1509    };
1510    if (json.has("text"))
1511      res.setTextElement(parseString(json.get("text").getAsString()));
1512    if (json.has("_text"))
1513      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
1514  }
1515
1516  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1517    ParameterDefinition res = new ParameterDefinition();
1518    parseParameterDefinitionProperties(json, res);
1519    return res;
1520  }
1521
1522  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1523    parseTypeProperties(json, res);
1524    if (json.has("name"))
1525      res.setNameElement(parseCode(json.get("name").getAsString()));
1526    if (json.has("_name"))
1527      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1528    if (json.has("use"))
1529      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1530    if (json.has("_use"))
1531      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1532    if (json.has("min"))
1533      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1534    if (json.has("_min"))
1535      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1536    if (json.has("max"))
1537      res.setMaxElement(parseString(json.get("max").getAsString()));
1538    if (json.has("_max"))
1539      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1540    if (json.has("documentation"))
1541      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1542    if (json.has("_documentation"))
1543      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
1544    if (json.has("type"))
1545      res.setTypeElement(parseCode(json.get("type").getAsString()));
1546    if (json.has("_type"))
1547      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1548    if (json.has("profile"))
1549      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1550    if (json.has("_profile"))
1551      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
1552  }
1553
1554  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1555    ElementDefinition res = new ElementDefinition();
1556    parseElementDefinitionProperties(json, res);
1557    return res;
1558  }
1559
1560  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1561    parseBackboneElementProperties(json, res);
1562    if (json.has("path"))
1563      res.setPathElement(parseString(json.get("path").getAsString()));
1564    if (json.has("_path"))
1565      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1566    if (json.has("representation")) {
1567      JsonArray array = json.getAsJsonArray("representation");
1568      for (int i = 0; i < array.size(); i++) {
1569        if (array.get(i).isJsonNull()) {
1570          res.getRepresentation().add(new Enumeration<ElementDefinition.PropertyRepresentation>());
1571        } else {
1572          res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1573        }
1574      }
1575    };
1576    if (json.has("_representation")) {
1577      JsonArray array = json.getAsJsonArray("_representation");
1578      for (int i = 0; i < array.size(); i++) {
1579        if (i == res.getRepresentation().size())
1580          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1581        if (array.get(i) instanceof JsonObject) 
1582          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1583      }
1584    };
1585    if (json.has("sliceName"))
1586      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1587    if (json.has("_sliceName"))
1588      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
1589    if (json.has("sliceIsConstraining"))
1590      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
1591    if (json.has("_sliceIsConstraining"))
1592      parseElementProperties(getJObject(json, "_sliceIsConstraining"), res.getSliceIsConstrainingElement());
1593    if (json.has("label"))
1594      res.setLabelElement(parseString(json.get("label").getAsString()));
1595    if (json.has("_label"))
1596      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1597    if (json.has("code")) {
1598      JsonArray array = json.getAsJsonArray("code");
1599      for (int i = 0; i < array.size(); i++) {
1600        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1601      }
1602    };
1603    if (json.has("slicing"))
1604      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(getJObject(json, "slicing"), res));
1605    if (json.has("short"))
1606      res.setShortElement(parseString(json.get("short").getAsString()));
1607    if (json.has("_short"))
1608      parseElementProperties(getJObject(json, "_short"), res.getShortElement());
1609    if (json.has("definition"))
1610      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1611    if (json.has("_definition"))
1612      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
1613    if (json.has("comment"))
1614      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1615    if (json.has("_comment"))
1616      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1617    if (json.has("requirements"))
1618      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1619    if (json.has("_requirements"))
1620      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1621    if (json.has("alias")) {
1622      JsonArray array = json.getAsJsonArray("alias");
1623      for (int i = 0; i < array.size(); i++) {
1624        if (array.get(i).isJsonNull()) {
1625          res.getAlias().add(new StringType());
1626        } else {
1627          res.getAlias().add(parseString(array.get(i).getAsString()));
1628        }
1629      }
1630    };
1631    if (json.has("_alias")) {
1632      JsonArray array = json.getAsJsonArray("_alias");
1633      for (int i = 0; i < array.size(); i++) {
1634        if (i == res.getAlias().size())
1635          res.getAlias().add(parseString(null));
1636        if (array.get(i) instanceof JsonObject) 
1637          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1638      }
1639    };
1640    if (json.has("min"))
1641      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1642    if (json.has("_min"))
1643      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1644    if (json.has("max"))
1645      res.setMaxElement(parseString(json.get("max").getAsString()));
1646    if (json.has("_max"))
1647      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1648    if (json.has("base"))
1649      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(getJObject(json, "base"), res));
1650    if (json.has("contentReference"))
1651      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1652    if (json.has("_contentReference"))
1653      parseElementProperties(getJObject(json, "_contentReference"), res.getContentReferenceElement());
1654    if (json.has("type")) {
1655      JsonArray array = json.getAsJsonArray("type");
1656      for (int i = 0; i < array.size(); i++) {
1657        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1658      }
1659    };
1660    Type defaultValue = parseType("defaultValue", json);
1661    if (defaultValue != null)
1662      res.setDefaultValue(defaultValue);
1663    if (json.has("meaningWhenMissing"))
1664      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1665    if (json.has("_meaningWhenMissing"))
1666      parseElementProperties(getJObject(json, "_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1667    if (json.has("orderMeaning"))
1668      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1669    if (json.has("_orderMeaning"))
1670      parseElementProperties(getJObject(json, "_orderMeaning"), res.getOrderMeaningElement());
1671    Type fixed = parseType("fixed", json);
1672    if (fixed != null)
1673      res.setFixed(fixed);
1674    Type pattern = parseType("pattern", json);
1675    if (pattern != null)
1676      res.setPattern(pattern);
1677    if (json.has("example")) {
1678      JsonArray array = json.getAsJsonArray("example");
1679      for (int i = 0; i < array.size(); i++) {
1680        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1681      }
1682    };
1683    Type minValue = parseType("minValue", json);
1684    if (minValue != null)
1685      res.setMinValue(minValue);
1686    Type maxValue = parseType("maxValue", json);
1687    if (maxValue != null)
1688      res.setMaxValue(maxValue);
1689    if (json.has("maxLength"))
1690      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1691    if (json.has("_maxLength"))
1692      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
1693    if (json.has("condition")) {
1694      JsonArray array = json.getAsJsonArray("condition");
1695      for (int i = 0; i < array.size(); i++) {
1696        if (array.get(i).isJsonNull()) {
1697          res.getCondition().add(new IdType());
1698        } else {
1699          res.getCondition().add(parseId(array.get(i).getAsString()));
1700        }
1701      }
1702    };
1703    if (json.has("_condition")) {
1704      JsonArray array = json.getAsJsonArray("_condition");
1705      for (int i = 0; i < array.size(); i++) {
1706        if (i == res.getCondition().size())
1707          res.getCondition().add(parseId(null));
1708        if (array.get(i) instanceof JsonObject) 
1709          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1710      }
1711    };
1712    if (json.has("constraint")) {
1713      JsonArray array = json.getAsJsonArray("constraint");
1714      for (int i = 0; i < array.size(); i++) {
1715        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1716      }
1717    };
1718    if (json.has("mustSupport"))
1719      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1720    if (json.has("_mustSupport"))
1721      parseElementProperties(getJObject(json, "_mustSupport"), res.getMustSupportElement());
1722    if (json.has("isModifier"))
1723      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1724    if (json.has("_isModifier"))
1725      parseElementProperties(getJObject(json, "_isModifier"), res.getIsModifierElement());
1726    if (json.has("isModifierReason"))
1727      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
1728    if (json.has("_isModifierReason"))
1729      parseElementProperties(getJObject(json, "_isModifierReason"), res.getIsModifierReasonElement());
1730    if (json.has("isSummary"))
1731      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1732    if (json.has("_isSummary"))
1733      parseElementProperties(getJObject(json, "_isSummary"), res.getIsSummaryElement());
1734    if (json.has("binding"))
1735      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(getJObject(json, "binding"), res));
1736    if (json.has("mapping")) {
1737      JsonArray array = json.getAsJsonArray("mapping");
1738      for (int i = 0; i < array.size(); i++) {
1739        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1740      }
1741    };
1742  }
1743
1744  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1745    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1746    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1747    return res;
1748  }
1749
1750  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1751    parseTypeProperties(json, res);
1752    if (json.has("discriminator")) {
1753      JsonArray array = json.getAsJsonArray("discriminator");
1754      for (int i = 0; i < array.size(); i++) {
1755        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1756      }
1757    };
1758    if (json.has("description"))
1759      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1760    if (json.has("_description"))
1761      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1762    if (json.has("ordered"))
1763      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1764    if (json.has("_ordered"))
1765      parseElementProperties(getJObject(json, "_ordered"), res.getOrderedElement());
1766    if (json.has("rules"))
1767      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1768    if (json.has("_rules"))
1769      parseElementProperties(getJObject(json, "_rules"), res.getRulesElement());
1770  }
1771
1772  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1773    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1774    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1775    return res;
1776  }
1777
1778  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1779    parseTypeProperties(json, res);
1780    if (json.has("type"))
1781      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1782    if (json.has("_type"))
1783      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1784    if (json.has("path"))
1785      res.setPathElement(parseString(json.get("path").getAsString()));
1786    if (json.has("_path"))
1787      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1788  }
1789
1790  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1791    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1792    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1793    return res;
1794  }
1795
1796  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1797    parseTypeProperties(json, res);
1798    if (json.has("path"))
1799      res.setPathElement(parseString(json.get("path").getAsString()));
1800    if (json.has("_path"))
1801      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1802    if (json.has("min"))
1803      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1804    if (json.has("_min"))
1805      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1806    if (json.has("max"))
1807      res.setMaxElement(parseString(json.get("max").getAsString()));
1808    if (json.has("_max"))
1809      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1810  }
1811
1812  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1813    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1814    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1815    return res;
1816  }
1817
1818  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1819    parseTypeProperties(json, res);
1820    if (json.has("code"))
1821      res.setCodeElement(parseUri(json.get("code").getAsString()));
1822    if (json.has("_code"))
1823      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1824    if (json.has("profile")) {
1825      JsonArray array = json.getAsJsonArray("profile");
1826      for (int i = 0; i < array.size(); i++) {
1827        if (array.get(i).isJsonNull()) {
1828          res.getProfile().add(new CanonicalType());
1829        } else {
1830          res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1831        }
1832      }
1833    };
1834    if (json.has("_profile")) {
1835      JsonArray array = json.getAsJsonArray("_profile");
1836      for (int i = 0; i < array.size(); i++) {
1837        if (i == res.getProfile().size())
1838          res.getProfile().add(parseCanonical(null));
1839        if (array.get(i) instanceof JsonObject) 
1840          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1841      }
1842    };
1843    if (json.has("targetProfile")) {
1844      JsonArray array = json.getAsJsonArray("targetProfile");
1845      for (int i = 0; i < array.size(); i++) {
1846        if (array.get(i).isJsonNull()) {
1847          res.getTargetProfile().add(new CanonicalType());
1848        } else {
1849          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1850        }
1851      }
1852    };
1853    if (json.has("_targetProfile")) {
1854      JsonArray array = json.getAsJsonArray("_targetProfile");
1855      for (int i = 0; i < array.size(); i++) {
1856        if (i == res.getTargetProfile().size())
1857          res.getTargetProfile().add(parseCanonical(null));
1858        if (array.get(i) instanceof JsonObject) 
1859          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1860      }
1861    };
1862    if (json.has("aggregation")) {
1863      JsonArray array = json.getAsJsonArray("aggregation");
1864      for (int i = 0; i < array.size(); i++) {
1865        if (array.get(i).isJsonNull()) {
1866          res.getAggregation().add(new Enumeration<ElementDefinition.AggregationMode>());
1867        } else {
1868          res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1869        }
1870      }
1871    };
1872    if (json.has("_aggregation")) {
1873      JsonArray array = json.getAsJsonArray("_aggregation");
1874      for (int i = 0; i < array.size(); i++) {
1875        if (i == res.getAggregation().size())
1876          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1877        if (array.get(i) instanceof JsonObject) 
1878          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1879      }
1880    };
1881    if (json.has("versioning"))
1882      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1883    if (json.has("_versioning"))
1884      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
1885  }
1886
1887  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1888    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1889    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
1890    return res;
1891  }
1892
1893  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1894    parseTypeProperties(json, res);
1895    if (json.has("label"))
1896      res.setLabelElement(parseString(json.get("label").getAsString()));
1897    if (json.has("_label"))
1898      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1899    Type value = parseType("value", json);
1900    if (value != null)
1901      res.setValue(value);
1902  }
1903
1904  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1905    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1906    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
1907    return res;
1908  }
1909
1910  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1911    parseTypeProperties(json, res);
1912    if (json.has("key"))
1913      res.setKeyElement(parseId(json.get("key").getAsString()));
1914    if (json.has("_key"))
1915      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
1916    if (json.has("requirements"))
1917      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1918    if (json.has("_requirements"))
1919      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1920    if (json.has("severity"))
1921      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1922    if (json.has("_severity"))
1923      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
1924    if (json.has("human"))
1925      res.setHumanElement(parseString(json.get("human").getAsString()));
1926    if (json.has("_human"))
1927      parseElementProperties(getJObject(json, "_human"), res.getHumanElement());
1928    if (json.has("expression"))
1929      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1930    if (json.has("_expression"))
1931      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1932    if (json.has("xpath"))
1933      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1934    if (json.has("_xpath"))
1935      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
1936    if (json.has("source"))
1937      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1938    if (json.has("_source"))
1939      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1940  }
1941
1942  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1943    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1944    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
1945    return res;
1946  }
1947
1948  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1949    parseTypeProperties(json, res);
1950    if (json.has("strength"))
1951      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1952    if (json.has("_strength"))
1953      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
1954    if (json.has("description"))
1955      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1956    if (json.has("_description"))
1957      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1958    if (json.has("valueSet"))
1959      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1960    if (json.has("_valueSet"))
1961      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
1962  }
1963
1964  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1965    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1966    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
1967    return res;
1968  }
1969
1970  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1971    parseTypeProperties(json, res);
1972    if (json.has("identity"))
1973      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1974    if (json.has("_identity"))
1975      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
1976    if (json.has("language"))
1977      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1978    if (json.has("_language"))
1979      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1980    if (json.has("map"))
1981      res.setMapElement(parseString(json.get("map").getAsString()));
1982    if (json.has("_map"))
1983      parseElementProperties(getJObject(json, "_map"), res.getMapElement());
1984    if (json.has("comment"))
1985      res.setCommentElement(parseString(json.get("comment").getAsString()));
1986    if (json.has("_comment"))
1987      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1988  }
1989
1990  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1991    parseResourceProperties(json, res);
1992    if (json.has("text"))
1993      res.setText(parseNarrative(getJObject(json, "text")));
1994    if (json.has("contained")) {
1995      JsonArray array = json.getAsJsonArray("contained");
1996      for (int i = 0; i < array.size(); i++) {
1997        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1998      }
1999    };
2000    if (json.has("extension")) {
2001      JsonArray array = json.getAsJsonArray("extension");
2002      for (int i = 0; i < array.size(); i++) {
2003        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2004      }
2005    };
2006    if (json.has("modifierExtension")) {
2007      JsonArray array = json.getAsJsonArray("modifierExtension");
2008      for (int i = 0; i < array.size(); i++) {
2009        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
2010      }
2011    };
2012  }
2013
2014  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
2015    Parameters res = new Parameters();
2016    parseParametersProperties(json, res);
2017    return res;
2018  }
2019
2020  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
2021    parseResourceProperties(json, res);
2022    if (json.has("parameter")) {
2023      JsonArray array = json.getAsJsonArray("parameter");
2024      for (int i = 0; i < array.size(); i++) {
2025        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
2026      }
2027    };
2028  }
2029
2030  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
2031    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
2032    parseParametersParametersParameterComponentProperties(json, owner, res);
2033    return res;
2034  }
2035
2036  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
2037    parseBackboneElementProperties(json, res);
2038    if (json.has("name"))
2039      res.setNameElement(parseString(json.get("name").getAsString()));
2040    if (json.has("_name"))
2041      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2042    Type value = parseType("value", json);
2043    if (value != null)
2044      res.setValue(value);
2045    if (json.has("resource"))
2046      res.setResource(parseResource(getJObject(json, "resource")));
2047    if (json.has("part")) {
2048      JsonArray array = json.getAsJsonArray("part");
2049      for (int i = 0; i < array.size(); i++) {
2050        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
2051      }
2052    };
2053  }
2054
2055  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
2056    if (json.has("id"))
2057      res.setIdElement(parseId(json.get("id").getAsString()));
2058    if (json.has("_id"))
2059      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
2060    if (json.has("meta"))
2061      res.setMeta(parseMeta(getJObject(json, "meta")));
2062    if (json.has("implicitRules"))
2063      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
2064    if (json.has("_implicitRules"))
2065      parseElementProperties(getJObject(json, "_implicitRules"), res.getImplicitRulesElement());
2066    if (json.has("language"))
2067      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2068    if (json.has("_language"))
2069      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
2070  }
2071
2072  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
2073    Account res = new Account();
2074    parseAccountProperties(json, res);
2075    return res;
2076  }
2077
2078  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2079    parseDomainResourceProperties(json, res);
2080    if (json.has("identifier")) {
2081      JsonArray array = json.getAsJsonArray("identifier");
2082      for (int i = 0; i < array.size(); i++) {
2083        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2084      }
2085    };
2086    if (json.has("status"))
2087      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2088    if (json.has("_status"))
2089      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2090    if (json.has("type"))
2091      res.setType(parseCodeableConcept(getJObject(json, "type")));
2092    if (json.has("name"))
2093      res.setNameElement(parseString(json.get("name").getAsString()));
2094    if (json.has("_name"))
2095      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2096    if (json.has("subject")) {
2097      JsonArray array = json.getAsJsonArray("subject");
2098      for (int i = 0; i < array.size(); i++) {
2099        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2100      }
2101    };
2102    if (json.has("servicePeriod"))
2103      res.setServicePeriod(parsePeriod(getJObject(json, "servicePeriod")));
2104    if (json.has("coverage")) {
2105      JsonArray array = json.getAsJsonArray("coverage");
2106      for (int i = 0; i < array.size(); i++) {
2107        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
2108      }
2109    };
2110    if (json.has("owner"))
2111      res.setOwner(parseReference(getJObject(json, "owner")));
2112    if (json.has("description"))
2113      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2114    if (json.has("_description"))
2115      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2116    if (json.has("guarantor")) {
2117      JsonArray array = json.getAsJsonArray("guarantor");
2118      for (int i = 0; i < array.size(); i++) {
2119        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
2120      }
2121    };
2122    if (json.has("partOf"))
2123      res.setPartOf(parseReference(getJObject(json, "partOf")));
2124  }
2125
2126  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2127    Account.CoverageComponent res = new Account.CoverageComponent();
2128    parseAccountCoverageComponentProperties(json, owner, res);
2129    return res;
2130  }
2131
2132  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2133    parseBackboneElementProperties(json, res);
2134    if (json.has("coverage"))
2135      res.setCoverage(parseReference(getJObject(json, "coverage")));
2136    if (json.has("priority"))
2137      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2138    if (json.has("_priority"))
2139      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2140  }
2141
2142  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2143    Account.GuarantorComponent res = new Account.GuarantorComponent();
2144    parseAccountGuarantorComponentProperties(json, owner, res);
2145    return res;
2146  }
2147
2148  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2149    parseBackboneElementProperties(json, res);
2150    if (json.has("party"))
2151      res.setParty(parseReference(getJObject(json, "party")));
2152    if (json.has("onHold"))
2153      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2154    if (json.has("_onHold"))
2155      parseElementProperties(getJObject(json, "_onHold"), res.getOnHoldElement());
2156    if (json.has("period"))
2157      res.setPeriod(parsePeriod(getJObject(json, "period")));
2158  }
2159
2160  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2161    ActivityDefinition res = new ActivityDefinition();
2162    parseActivityDefinitionProperties(json, res);
2163    return res;
2164  }
2165
2166  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2167    parseDomainResourceProperties(json, res);
2168    if (json.has("url"))
2169      res.setUrlElement(parseUri(json.get("url").getAsString()));
2170    if (json.has("_url"))
2171      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2172    if (json.has("identifier")) {
2173      JsonArray array = json.getAsJsonArray("identifier");
2174      for (int i = 0; i < array.size(); i++) {
2175        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2176      }
2177    };
2178    if (json.has("version"))
2179      res.setVersionElement(parseString(json.get("version").getAsString()));
2180    if (json.has("_version"))
2181      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2182    if (json.has("name"))
2183      res.setNameElement(parseString(json.get("name").getAsString()));
2184    if (json.has("_name"))
2185      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2186    if (json.has("title"))
2187      res.setTitleElement(parseString(json.get("title").getAsString()));
2188    if (json.has("_title"))
2189      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2190    if (json.has("subtitle"))
2191      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2192    if (json.has("_subtitle"))
2193      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
2194    if (json.has("status"))
2195      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2196    if (json.has("_status"))
2197      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2198    if (json.has("experimental"))
2199      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2200    if (json.has("_experimental"))
2201      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2202    Type subject = parseType("subject", json);
2203    if (subject != null)
2204      res.setSubject(subject);
2205    if (json.has("date"))
2206      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2207    if (json.has("_date"))
2208      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2209    if (json.has("publisher"))
2210      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2211    if (json.has("_publisher"))
2212      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2213    if (json.has("contact")) {
2214      JsonArray array = json.getAsJsonArray("contact");
2215      for (int i = 0; i < array.size(); i++) {
2216        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2217      }
2218    };
2219    if (json.has("description"))
2220      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2221    if (json.has("_description"))
2222      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2223    if (json.has("useContext")) {
2224      JsonArray array = json.getAsJsonArray("useContext");
2225      for (int i = 0; i < array.size(); i++) {
2226        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2227      }
2228    };
2229    if (json.has("jurisdiction")) {
2230      JsonArray array = json.getAsJsonArray("jurisdiction");
2231      for (int i = 0; i < array.size(); i++) {
2232        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2233      }
2234    };
2235    if (json.has("purpose"))
2236      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2237    if (json.has("_purpose"))
2238      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2239    if (json.has("usage"))
2240      res.setUsageElement(parseString(json.get("usage").getAsString()));
2241    if (json.has("_usage"))
2242      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
2243    if (json.has("copyright"))
2244      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2245    if (json.has("_copyright"))
2246      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2247    if (json.has("approvalDate"))
2248      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2249    if (json.has("_approvalDate"))
2250      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
2251    if (json.has("lastReviewDate"))
2252      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2253    if (json.has("_lastReviewDate"))
2254      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
2255    if (json.has("effectivePeriod"))
2256      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
2257    if (json.has("topic")) {
2258      JsonArray array = json.getAsJsonArray("topic");
2259      for (int i = 0; i < array.size(); i++) {
2260        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2261      }
2262    };
2263    if (json.has("author")) {
2264      JsonArray array = json.getAsJsonArray("author");
2265      for (int i = 0; i < array.size(); i++) {
2266        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2267      }
2268    };
2269    if (json.has("editor")) {
2270      JsonArray array = json.getAsJsonArray("editor");
2271      for (int i = 0; i < array.size(); i++) {
2272        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2273      }
2274    };
2275    if (json.has("reviewer")) {
2276      JsonArray array = json.getAsJsonArray("reviewer");
2277      for (int i = 0; i < array.size(); i++) {
2278        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2279      }
2280    };
2281    if (json.has("endorser")) {
2282      JsonArray array = json.getAsJsonArray("endorser");
2283      for (int i = 0; i < array.size(); i++) {
2284        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2285      }
2286    };
2287    if (json.has("relatedArtifact")) {
2288      JsonArray array = json.getAsJsonArray("relatedArtifact");
2289      for (int i = 0; i < array.size(); i++) {
2290        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2291      }
2292    };
2293    if (json.has("library")) {
2294      JsonArray array = json.getAsJsonArray("library");
2295      for (int i = 0; i < array.size(); i++) {
2296        if (array.get(i).isJsonNull()) {
2297          res.getLibrary().add(new CanonicalType());
2298        } else {
2299          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2300        }
2301      }
2302    };
2303    if (json.has("_library")) {
2304      JsonArray array = json.getAsJsonArray("_library");
2305      for (int i = 0; i < array.size(); i++) {
2306        if (i == res.getLibrary().size())
2307          res.getLibrary().add(parseCanonical(null));
2308        if (array.get(i) instanceof JsonObject) 
2309          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2310      }
2311    };
2312    if (json.has("kind"))
2313      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
2314    if (json.has("_kind"))
2315      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
2316    if (json.has("profile"))
2317      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2318    if (json.has("_profile"))
2319      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
2320    if (json.has("code"))
2321      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2322    if (json.has("intent"))
2323      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ActivityDefinition.RequestIntent.NULL, new ActivityDefinition.RequestIntentEnumFactory()));
2324    if (json.has("_intent"))
2325      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
2326    if (json.has("priority"))
2327      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ActivityDefinition.RequestPriority.NULL, new ActivityDefinition.RequestPriorityEnumFactory()));
2328    if (json.has("_priority"))
2329      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2330    if (json.has("doNotPerform"))
2331      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2332    if (json.has("_doNotPerform"))
2333      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
2334    Type timing = parseType("timing", json);
2335    if (timing != null)
2336      res.setTiming(timing);
2337    if (json.has("location"))
2338      res.setLocation(parseReference(getJObject(json, "location")));
2339    if (json.has("participant")) {
2340      JsonArray array = json.getAsJsonArray("participant");
2341      for (int i = 0; i < array.size(); i++) {
2342        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
2343      }
2344    };
2345    Type product = parseType("product", json);
2346    if (product != null)
2347      res.setProduct(product);
2348    if (json.has("quantity"))
2349      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
2350    if (json.has("dosage")) {
2351      JsonArray array = json.getAsJsonArray("dosage");
2352      for (int i = 0; i < array.size(); i++) {
2353        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2354      }
2355    };
2356    if (json.has("bodySite")) {
2357      JsonArray array = json.getAsJsonArray("bodySite");
2358      for (int i = 0; i < array.size(); i++) {
2359        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2360      }
2361    };
2362    if (json.has("specimenRequirement")) {
2363      JsonArray array = json.getAsJsonArray("specimenRequirement");
2364      for (int i = 0; i < array.size(); i++) {
2365        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2366      }
2367    };
2368    if (json.has("observationRequirement")) {
2369      JsonArray array = json.getAsJsonArray("observationRequirement");
2370      for (int i = 0; i < array.size(); i++) {
2371        res.getObservationRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2372      }
2373    };
2374    if (json.has("observationResultRequirement")) {
2375      JsonArray array = json.getAsJsonArray("observationResultRequirement");
2376      for (int i = 0; i < array.size(); i++) {
2377        res.getObservationResultRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2378      }
2379    };
2380    if (json.has("transform"))
2381      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2382    if (json.has("_transform"))
2383      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
2384    if (json.has("dynamicValue")) {
2385      JsonArray array = json.getAsJsonArray("dynamicValue");
2386      for (int i = 0; i < array.size(); i++) {
2387        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
2388      }
2389    };
2390  }
2391
2392  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2393    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2394    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
2395    return res;
2396  }
2397
2398  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2399    parseBackboneElementProperties(json, res);
2400    if (json.has("type"))
2401      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
2402    if (json.has("_type"))
2403      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2404    if (json.has("role"))
2405      res.setRole(parseCodeableConcept(getJObject(json, "role")));
2406  }
2407
2408  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2409    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2410    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
2411    return res;
2412  }
2413
2414  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2415    parseBackboneElementProperties(json, res);
2416    if (json.has("path"))
2417      res.setPathElement(parseString(json.get("path").getAsString()));
2418    if (json.has("_path"))
2419      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
2420    if (json.has("expression"))
2421      res.setExpression(parseExpression(getJObject(json, "expression")));
2422  }
2423
2424  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2425    AdverseEvent res = new AdverseEvent();
2426    parseAdverseEventProperties(json, res);
2427    return res;
2428  }
2429
2430  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2431    parseDomainResourceProperties(json, res);
2432    if (json.has("identifier"))
2433      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2434    if (json.has("actuality"))
2435      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2436    if (json.has("_actuality"))
2437      parseElementProperties(getJObject(json, "_actuality"), res.getActualityElement());
2438    if (json.has("category")) {
2439      JsonArray array = json.getAsJsonArray("category");
2440      for (int i = 0; i < array.size(); i++) {
2441        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2442      }
2443    };
2444    if (json.has("event"))
2445      res.setEvent(parseCodeableConcept(getJObject(json, "event")));
2446    if (json.has("subject"))
2447      res.setSubject(parseReference(getJObject(json, "subject")));
2448    if (json.has("encounter"))
2449      res.setEncounter(parseReference(getJObject(json, "encounter")));
2450    if (json.has("date"))
2451      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2452    if (json.has("_date"))
2453      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2454    if (json.has("detected"))
2455      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
2456    if (json.has("_detected"))
2457      parseElementProperties(getJObject(json, "_detected"), res.getDetectedElement());
2458    if (json.has("recordedDate"))
2459      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2460    if (json.has("_recordedDate"))
2461      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
2462    if (json.has("resultingCondition")) {
2463      JsonArray array = json.getAsJsonArray("resultingCondition");
2464      for (int i = 0; i < array.size(); i++) {
2465        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2466      }
2467    };
2468    if (json.has("location"))
2469      res.setLocation(parseReference(getJObject(json, "location")));
2470    if (json.has("seriousness"))
2471      res.setSeriousness(parseCodeableConcept(getJObject(json, "seriousness")));
2472    if (json.has("severity"))
2473      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
2474    if (json.has("outcome"))
2475      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
2476    if (json.has("recorder"))
2477      res.setRecorder(parseReference(getJObject(json, "recorder")));
2478    if (json.has("contributor")) {
2479      JsonArray array = json.getAsJsonArray("contributor");
2480      for (int i = 0; i < array.size(); i++) {
2481        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
2482      }
2483    };
2484    if (json.has("suspectEntity")) {
2485      JsonArray array = json.getAsJsonArray("suspectEntity");
2486      for (int i = 0; i < array.size(); i++) {
2487        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2488      }
2489    };
2490    if (json.has("subjectMedicalHistory")) {
2491      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2492      for (int i = 0; i < array.size(); i++) {
2493        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2494      }
2495    };
2496    if (json.has("referenceDocument")) {
2497      JsonArray array = json.getAsJsonArray("referenceDocument");
2498      for (int i = 0; i < array.size(); i++) {
2499        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2500      }
2501    };
2502    if (json.has("study")) {
2503      JsonArray array = json.getAsJsonArray("study");
2504      for (int i = 0; i < array.size(); i++) {
2505        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2506      }
2507    };
2508  }
2509
2510  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2511    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2512    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2513    return res;
2514  }
2515
2516  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2517    parseBackboneElementProperties(json, res);
2518    if (json.has("instance"))
2519      res.setInstance(parseReference(getJObject(json, "instance")));
2520    if (json.has("causality")) {
2521      JsonArray array = json.getAsJsonArray("causality");
2522      for (int i = 0; i < array.size(); i++) {
2523        res.getCausality().add(parseAdverseEventAdverseEventSuspectEntityCausalityComponent(array.get(i).getAsJsonObject(), owner));
2524      }
2525    };
2526  }
2527
2528  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventAdverseEventSuspectEntityCausalityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2529    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2530    parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(json, owner, res);
2531    return res;
2532  }
2533
2534  protected void parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
2535    parseBackboneElementProperties(json, res);
2536    if (json.has("assessment"))
2537      res.setAssessment(parseCodeableConcept(getJObject(json, "assessment")));
2538    if (json.has("productRelatedness"))
2539      res.setProductRelatednessElement(parseString(json.get("productRelatedness").getAsString()));
2540    if (json.has("_productRelatedness"))
2541      parseElementProperties(getJObject(json, "_productRelatedness"), res.getProductRelatednessElement());
2542    if (json.has("author"))
2543      res.setAuthor(parseReference(getJObject(json, "author")));
2544    if (json.has("method"))
2545      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
2546  }
2547
2548  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2549    AllergyIntolerance res = new AllergyIntolerance();
2550    parseAllergyIntoleranceProperties(json, res);
2551    return res;
2552  }
2553
2554  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2555    parseDomainResourceProperties(json, res);
2556    if (json.has("identifier")) {
2557      JsonArray array = json.getAsJsonArray("identifier");
2558      for (int i = 0; i < array.size(); i++) {
2559        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2560      }
2561    };
2562    if (json.has("clinicalStatus"))
2563      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
2564    if (json.has("verificationStatus"))
2565      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
2566    if (json.has("type"))
2567      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2568    if (json.has("_type"))
2569      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2570    if (json.has("category")) {
2571      JsonArray array = json.getAsJsonArray("category");
2572      for (int i = 0; i < array.size(); i++) {
2573        if (array.get(i).isJsonNull()) {
2574          res.getCategory().add(new Enumeration<AllergyIntolerance.AllergyIntoleranceCategory>());
2575        } else {
2576          res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2577        }
2578      }
2579    };
2580    if (json.has("_category")) {
2581      JsonArray array = json.getAsJsonArray("_category");
2582      for (int i = 0; i < array.size(); i++) {
2583        if (i == res.getCategory().size())
2584          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2585        if (array.get(i) instanceof JsonObject) 
2586          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2587      }
2588    };
2589    if (json.has("criticality"))
2590      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2591    if (json.has("_criticality"))
2592      parseElementProperties(getJObject(json, "_criticality"), res.getCriticalityElement());
2593    if (json.has("code"))
2594      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2595    if (json.has("patient"))
2596      res.setPatient(parseReference(getJObject(json, "patient")));
2597    if (json.has("encounter"))
2598      res.setEncounter(parseReference(getJObject(json, "encounter")));
2599    Type onset = parseType("onset", json);
2600    if (onset != null)
2601      res.setOnset(onset);
2602    if (json.has("recordedDate"))
2603      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2604    if (json.has("_recordedDate"))
2605      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
2606    if (json.has("recorder"))
2607      res.setRecorder(parseReference(getJObject(json, "recorder")));
2608    if (json.has("asserter"))
2609      res.setAsserter(parseReference(getJObject(json, "asserter")));
2610    if (json.has("lastOccurrence"))
2611      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2612    if (json.has("_lastOccurrence"))
2613      parseElementProperties(getJObject(json, "_lastOccurrence"), res.getLastOccurrenceElement());
2614    if (json.has("note")) {
2615      JsonArray array = json.getAsJsonArray("note");
2616      for (int i = 0; i < array.size(); i++) {
2617        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2618      }
2619    };
2620    if (json.has("reaction")) {
2621      JsonArray array = json.getAsJsonArray("reaction");
2622      for (int i = 0; i < array.size(); i++) {
2623        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2624      }
2625    };
2626  }
2627
2628  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2629    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2630    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2631    return res;
2632  }
2633
2634  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2635    parseBackboneElementProperties(json, res);
2636    if (json.has("substance"))
2637      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
2638    if (json.has("manifestation")) {
2639      JsonArray array = json.getAsJsonArray("manifestation");
2640      for (int i = 0; i < array.size(); i++) {
2641        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2642      }
2643    };
2644    if (json.has("description"))
2645      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2646    if (json.has("_description"))
2647      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2648    if (json.has("onset"))
2649      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2650    if (json.has("_onset"))
2651      parseElementProperties(getJObject(json, "_onset"), res.getOnsetElement());
2652    if (json.has("severity"))
2653      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2654    if (json.has("_severity"))
2655      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
2656    if (json.has("exposureRoute"))
2657      res.setExposureRoute(parseCodeableConcept(getJObject(json, "exposureRoute")));
2658    if (json.has("note")) {
2659      JsonArray array = json.getAsJsonArray("note");
2660      for (int i = 0; i < array.size(); i++) {
2661        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2662      }
2663    };
2664  }
2665
2666  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2667    Appointment res = new Appointment();
2668    parseAppointmentProperties(json, res);
2669    return res;
2670  }
2671
2672  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2673    parseDomainResourceProperties(json, res);
2674    if (json.has("identifier")) {
2675      JsonArray array = json.getAsJsonArray("identifier");
2676      for (int i = 0; i < array.size(); i++) {
2677        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2678      }
2679    };
2680    if (json.has("status"))
2681      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2682    if (json.has("_status"))
2683      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2684    if (json.has("cancelationReason"))
2685      res.setCancelationReason(parseCodeableConcept(getJObject(json, "cancelationReason")));
2686    if (json.has("serviceCategory")) {
2687      JsonArray array = json.getAsJsonArray("serviceCategory");
2688      for (int i = 0; i < array.size(); i++) {
2689        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2690      }
2691    };
2692    if (json.has("serviceType")) {
2693      JsonArray array = json.getAsJsonArray("serviceType");
2694      for (int i = 0; i < array.size(); i++) {
2695        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2696      }
2697    };
2698    if (json.has("specialty")) {
2699      JsonArray array = json.getAsJsonArray("specialty");
2700      for (int i = 0; i < array.size(); i++) {
2701        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2702      }
2703    };
2704    if (json.has("appointmentType"))
2705      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
2706    if (json.has("reasonCode")) {
2707      JsonArray array = json.getAsJsonArray("reasonCode");
2708      for (int i = 0; i < array.size(); i++) {
2709        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2710      }
2711    };
2712    if (json.has("reasonReference")) {
2713      JsonArray array = json.getAsJsonArray("reasonReference");
2714      for (int i = 0; i < array.size(); i++) {
2715        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
2716      }
2717    };
2718    if (json.has("priority"))
2719      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2720    if (json.has("_priority"))
2721      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2722    if (json.has("description"))
2723      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2724    if (json.has("_description"))
2725      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2726    if (json.has("supportingInformation")) {
2727      JsonArray array = json.getAsJsonArray("supportingInformation");
2728      for (int i = 0; i < array.size(); i++) {
2729        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2730      }
2731    };
2732    if (json.has("start"))
2733      res.setStartElement(parseInstant(json.get("start").getAsString()));
2734    if (json.has("_start"))
2735      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2736    if (json.has("end"))
2737      res.setEndElement(parseInstant(json.get("end").getAsString()));
2738    if (json.has("_end"))
2739      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2740    if (json.has("minutesDuration"))
2741      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2742    if (json.has("_minutesDuration"))
2743      parseElementProperties(getJObject(json, "_minutesDuration"), res.getMinutesDurationElement());
2744    if (json.has("slot")) {
2745      JsonArray array = json.getAsJsonArray("slot");
2746      for (int i = 0; i < array.size(); i++) {
2747        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2748      }
2749    };
2750    if (json.has("created"))
2751      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2752    if (json.has("_created"))
2753      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
2754    if (json.has("comment"))
2755      res.setCommentElement(parseString(json.get("comment").getAsString()));
2756    if (json.has("_comment"))
2757      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2758    if (json.has("patientInstruction"))
2759      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
2760    if (json.has("_patientInstruction"))
2761      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
2762    if (json.has("basedOn")) {
2763      JsonArray array = json.getAsJsonArray("basedOn");
2764      for (int i = 0; i < array.size(); i++) {
2765        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
2766      }
2767    };
2768    if (json.has("participant")) {
2769      JsonArray array = json.getAsJsonArray("participant");
2770      for (int i = 0; i < array.size(); i++) {
2771        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
2772      }
2773    };
2774    if (json.has("requestedPeriod")) {
2775      JsonArray array = json.getAsJsonArray("requestedPeriod");
2776      for (int i = 0; i < array.size(); i++) {
2777        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2778      }
2779    };
2780  }
2781
2782  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
2783    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2784    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
2785    return res;
2786  }
2787
2788  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2789    parseBackboneElementProperties(json, res);
2790    if (json.has("type")) {
2791      JsonArray array = json.getAsJsonArray("type");
2792      for (int i = 0; i < array.size(); i++) {
2793        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2794      }
2795    };
2796    if (json.has("actor"))
2797      res.setActor(parseReference(getJObject(json, "actor")));
2798    if (json.has("required"))
2799      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2800    if (json.has("_required"))
2801      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
2802    if (json.has("status"))
2803      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
2804    if (json.has("_status"))
2805      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2806    if (json.has("period"))
2807      res.setPeriod(parsePeriod(getJObject(json, "period")));
2808  }
2809
2810  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2811    AppointmentResponse res = new AppointmentResponse();
2812    parseAppointmentResponseProperties(json, res);
2813    return res;
2814  }
2815
2816  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2817    parseDomainResourceProperties(json, res);
2818    if (json.has("identifier")) {
2819      JsonArray array = json.getAsJsonArray("identifier");
2820      for (int i = 0; i < array.size(); i++) {
2821        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2822      }
2823    };
2824    if (json.has("appointment"))
2825      res.setAppointment(parseReference(getJObject(json, "appointment")));
2826    if (json.has("start"))
2827      res.setStartElement(parseInstant(json.get("start").getAsString()));
2828    if (json.has("_start"))
2829      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2830    if (json.has("end"))
2831      res.setEndElement(parseInstant(json.get("end").getAsString()));
2832    if (json.has("_end"))
2833      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2834    if (json.has("participantType")) {
2835      JsonArray array = json.getAsJsonArray("participantType");
2836      for (int i = 0; i < array.size(); i++) {
2837        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2838      }
2839    };
2840    if (json.has("actor"))
2841      res.setActor(parseReference(getJObject(json, "actor")));
2842    if (json.has("participantStatus"))
2843      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
2844    if (json.has("_participantStatus"))
2845      parseElementProperties(getJObject(json, "_participantStatus"), res.getParticipantStatusElement());
2846    if (json.has("comment"))
2847      res.setCommentElement(parseString(json.get("comment").getAsString()));
2848    if (json.has("_comment"))
2849      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2850  }
2851
2852  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2853    AuditEvent res = new AuditEvent();
2854    parseAuditEventProperties(json, res);
2855    return res;
2856  }
2857
2858  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2859    parseDomainResourceProperties(json, res);
2860    if (json.has("type"))
2861      res.setType(parseCoding(getJObject(json, "type")));
2862    if (json.has("subtype")) {
2863      JsonArray array = json.getAsJsonArray("subtype");
2864      for (int i = 0; i < array.size(); i++) {
2865        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2866      }
2867    };
2868    if (json.has("action"))
2869      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2870    if (json.has("_action"))
2871      parseElementProperties(getJObject(json, "_action"), res.getActionElement());
2872    if (json.has("period"))
2873      res.setPeriod(parsePeriod(getJObject(json, "period")));
2874    if (json.has("recorded"))
2875      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2876    if (json.has("_recorded"))
2877      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
2878    if (json.has("outcome"))
2879      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2880    if (json.has("_outcome"))
2881      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
2882    if (json.has("outcomeDesc"))
2883      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2884    if (json.has("_outcomeDesc"))
2885      parseElementProperties(getJObject(json, "_outcomeDesc"), res.getOutcomeDescElement());
2886    if (json.has("purposeOfEvent")) {
2887      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2888      for (int i = 0; i < array.size(); i++) {
2889        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2890      }
2891    };
2892    if (json.has("agent")) {
2893      JsonArray array = json.getAsJsonArray("agent");
2894      for (int i = 0; i < array.size(); i++) {
2895        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2896      }
2897    };
2898    if (json.has("source"))
2899      res.setSource(parseAuditEventAuditEventSourceComponent(getJObject(json, "source"), res));
2900    if (json.has("entity")) {
2901      JsonArray array = json.getAsJsonArray("entity");
2902      for (int i = 0; i < array.size(); i++) {
2903        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2904      }
2905    };
2906  }
2907
2908  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2909    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2910    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
2911    return res;
2912  }
2913
2914  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
2915    parseBackboneElementProperties(json, res);
2916    if (json.has("type"))
2917      res.setType(parseCodeableConcept(getJObject(json, "type")));
2918    if (json.has("role")) {
2919      JsonArray array = json.getAsJsonArray("role");
2920      for (int i = 0; i < array.size(); i++) {
2921        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2922      }
2923    };
2924    if (json.has("who"))
2925      res.setWho(parseReference(getJObject(json, "who")));
2926    if (json.has("altId"))
2927      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2928    if (json.has("_altId"))
2929      parseElementProperties(getJObject(json, "_altId"), res.getAltIdElement());
2930    if (json.has("name"))
2931      res.setNameElement(parseString(json.get("name").getAsString()));
2932    if (json.has("_name"))
2933      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2934    if (json.has("requestor"))
2935      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2936    if (json.has("_requestor"))
2937      parseElementProperties(getJObject(json, "_requestor"), res.getRequestorElement());
2938    if (json.has("location"))
2939      res.setLocation(parseReference(getJObject(json, "location")));
2940    if (json.has("policy")) {
2941      JsonArray array = json.getAsJsonArray("policy");
2942      for (int i = 0; i < array.size(); i++) {
2943        if (array.get(i).isJsonNull()) {
2944          res.getPolicy().add(new UriType());
2945        } else {
2946          res.getPolicy().add(parseUri(array.get(i).getAsString()));
2947        }
2948      }
2949    };
2950    if (json.has("_policy")) {
2951      JsonArray array = json.getAsJsonArray("_policy");
2952      for (int i = 0; i < array.size(); i++) {
2953        if (i == res.getPolicy().size())
2954          res.getPolicy().add(parseUri(null));
2955        if (array.get(i) instanceof JsonObject) 
2956          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2957      }
2958    };
2959    if (json.has("media"))
2960      res.setMedia(parseCoding(getJObject(json, "media")));
2961    if (json.has("network"))
2962      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(getJObject(json, "network"), owner));
2963    if (json.has("purposeOfUse")) {
2964      JsonArray array = json.getAsJsonArray("purposeOfUse");
2965      for (int i = 0; i < array.size(); i++) {
2966        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2967      }
2968    };
2969  }
2970
2971  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2972    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2973    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
2974    return res;
2975  }
2976
2977  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
2978    parseBackboneElementProperties(json, res);
2979    if (json.has("address"))
2980      res.setAddressElement(parseString(json.get("address").getAsString()));
2981    if (json.has("_address"))
2982      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
2983    if (json.has("type"))
2984      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
2985    if (json.has("_type"))
2986      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2987  }
2988
2989  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2990    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2991    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
2992    return res;
2993  }
2994
2995  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
2996    parseBackboneElementProperties(json, res);
2997    if (json.has("site"))
2998      res.setSiteElement(parseString(json.get("site").getAsString()));
2999    if (json.has("_site"))
3000      parseElementProperties(getJObject(json, "_site"), res.getSiteElement());
3001    if (json.has("observer"))
3002      res.setObserver(parseReference(getJObject(json, "observer")));
3003    if (json.has("type")) {
3004      JsonArray array = json.getAsJsonArray("type");
3005      for (int i = 0; i < array.size(); i++) {
3006        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
3007      }
3008    };
3009  }
3010
3011  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
3012    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
3013    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
3014    return res;
3015  }
3016
3017  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
3018    parseBackboneElementProperties(json, res);
3019    if (json.has("what"))
3020      res.setWhat(parseReference(getJObject(json, "what")));
3021    if (json.has("type"))
3022      res.setType(parseCoding(getJObject(json, "type")));
3023    if (json.has("role"))
3024      res.setRole(parseCoding(getJObject(json, "role")));
3025    if (json.has("lifecycle"))
3026      res.setLifecycle(parseCoding(getJObject(json, "lifecycle")));
3027    if (json.has("securityLabel")) {
3028      JsonArray array = json.getAsJsonArray("securityLabel");
3029      for (int i = 0; i < array.size(); i++) {
3030        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
3031      }
3032    };
3033    if (json.has("name"))
3034      res.setNameElement(parseString(json.get("name").getAsString()));
3035    if (json.has("_name"))
3036      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3037    if (json.has("description"))
3038      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3039    if (json.has("_description"))
3040      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3041    if (json.has("query"))
3042      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
3043    if (json.has("_query"))
3044      parseElementProperties(getJObject(json, "_query"), res.getQueryElement());
3045    if (json.has("detail")) {
3046      JsonArray array = json.getAsJsonArray("detail");
3047      for (int i = 0; i < array.size(); i++) {
3048        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
3049      }
3050    };
3051  }
3052
3053  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
3054    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
3055    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
3056    return res;
3057  }
3058
3059  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
3060    parseBackboneElementProperties(json, res);
3061    if (json.has("type"))
3062      res.setTypeElement(parseString(json.get("type").getAsString()));
3063    if (json.has("_type"))
3064      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3065    Type value = parseType("value", json);
3066    if (value != null)
3067      res.setValue(value);
3068  }
3069
3070  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
3071    Basic res = new Basic();
3072    parseBasicProperties(json, res);
3073    return res;
3074  }
3075
3076  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
3077    parseDomainResourceProperties(json, res);
3078    if (json.has("identifier")) {
3079      JsonArray array = json.getAsJsonArray("identifier");
3080      for (int i = 0; i < array.size(); i++) {
3081        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3082      }
3083    };
3084    if (json.has("code"))
3085      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3086    if (json.has("subject"))
3087      res.setSubject(parseReference(getJObject(json, "subject")));
3088    if (json.has("created"))
3089      res.setCreatedElement(parseDate(json.get("created").getAsString()));
3090    if (json.has("_created"))
3091      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
3092    if (json.has("author"))
3093      res.setAuthor(parseReference(getJObject(json, "author")));
3094  }
3095
3096  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
3097    Binary res = new Binary();
3098    parseBinaryProperties(json, res);
3099    return res;
3100  }
3101
3102  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
3103    parseResourceProperties(json, res);
3104    if (json.has("contentType"))
3105      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
3106    if (json.has("_contentType"))
3107      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
3108    if (json.has("securityContext"))
3109      res.setSecurityContext(parseReference(getJObject(json, "securityContext")));
3110    if (json.has("data"))
3111      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
3112    if (json.has("_data"))
3113      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
3114  }
3115
3116  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
3117    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3118    parseBiologicallyDerivedProductProperties(json, res);
3119    return res;
3120  }
3121
3122  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
3123    parseDomainResourceProperties(json, res);
3124    if (json.has("identifier")) {
3125      JsonArray array = json.getAsJsonArray("identifier");
3126      for (int i = 0; i < array.size(); i++) {
3127        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3128      }
3129    };
3130    if (json.has("productCategory"))
3131      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3132    if (json.has("_productCategory"))
3133      parseElementProperties(getJObject(json, "_productCategory"), res.getProductCategoryElement());
3134    if (json.has("productCode"))
3135      res.setProductCode(parseCodeableConcept(getJObject(json, "productCode")));
3136    if (json.has("status"))
3137      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3138    if (json.has("_status"))
3139      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3140    if (json.has("request")) {
3141      JsonArray array = json.getAsJsonArray("request");
3142      for (int i = 0; i < array.size(); i++) {
3143        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3144      }
3145    };
3146    if (json.has("quantity"))
3147      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
3148    if (json.has("_quantity"))
3149      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
3150    if (json.has("parent")) {
3151      JsonArray array = json.getAsJsonArray("parent");
3152      for (int i = 0; i < array.size(); i++) {
3153        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
3154      }
3155    };
3156    if (json.has("collection"))
3157      res.setCollection(parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(getJObject(json, "collection"), res));
3158    if (json.has("processing")) {
3159      JsonArray array = json.getAsJsonArray("processing");
3160      for (int i = 0; i < array.size(); i++) {
3161        res.getProcessing().add(parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(array.get(i).getAsJsonObject(), res));
3162      }
3163    };
3164    if (json.has("manipulation"))
3165      res.setManipulation(parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(getJObject(json, "manipulation"), res));
3166    if (json.has("storage")) {
3167      JsonArray array = json.getAsJsonArray("storage");
3168      for (int i = 0; i < array.size(); i++) {
3169        res.getStorage().add(parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(array.get(i).getAsJsonObject(), res));
3170      }
3171    };
3172  }
3173
3174  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3175    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3176    parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(json, owner, res);
3177    return res;
3178  }
3179
3180  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
3181    parseBackboneElementProperties(json, res);
3182    if (json.has("collector"))
3183      res.setCollector(parseReference(getJObject(json, "collector")));
3184    if (json.has("source"))
3185      res.setSource(parseReference(getJObject(json, "source")));
3186    Type collected = parseType("collected", json);
3187    if (collected != null)
3188      res.setCollected(collected);
3189  }
3190
3191  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3192    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
3193    parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(json, owner, res);
3194    return res;
3195  }
3196
3197  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res) throws IOException, FHIRFormatError {
3198    parseBackboneElementProperties(json, res);
3199    if (json.has("description"))
3200      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3201    if (json.has("_description"))
3202      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3203    if (json.has("procedure"))
3204      res.setProcedure(parseCodeableConcept(getJObject(json, "procedure")));
3205    if (json.has("additive"))
3206      res.setAdditive(parseReference(getJObject(json, "additive")));
3207    Type time = parseType("time", json);
3208    if (time != null)
3209      res.setTime(time);
3210  }
3211
3212  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3213    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
3214    parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(json, owner, res);
3215    return res;
3216  }
3217
3218  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res) throws IOException, FHIRFormatError {
3219    parseBackboneElementProperties(json, res);
3220    if (json.has("description"))
3221      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3222    if (json.has("_description"))
3223      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3224    Type time = parseType("time", json);
3225    if (time != null)
3226      res.setTime(time);
3227  }
3228
3229  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3230    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
3231    parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(json, owner, res);
3232    return res;
3233  }
3234
3235  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res) throws IOException, FHIRFormatError {
3236    parseBackboneElementProperties(json, res);
3237    if (json.has("description"))
3238      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3239    if (json.has("_description"))
3240      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3241    if (json.has("temperature"))
3242      res.setTemperatureElement(parseDecimal(json.get("temperature").getAsBigDecimal()));
3243    if (json.has("_temperature"))
3244      parseElementProperties(getJObject(json, "_temperature"), res.getTemperatureElement());
3245    if (json.has("scale"))
3246      res.setScaleElement(parseEnumeration(json.get("scale").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
3247    if (json.has("_scale"))
3248      parseElementProperties(getJObject(json, "_scale"), res.getScaleElement());
3249    if (json.has("duration"))
3250      res.setDuration(parsePeriod(getJObject(json, "duration")));
3251  }
3252
3253  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3254    BodyStructure res = new BodyStructure();
3255    parseBodyStructureProperties(json, res);
3256    return res;
3257  }
3258
3259  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3260    parseDomainResourceProperties(json, res);
3261    if (json.has("identifier")) {
3262      JsonArray array = json.getAsJsonArray("identifier");
3263      for (int i = 0; i < array.size(); i++) {
3264        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3265      }
3266    };
3267    if (json.has("active"))
3268      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3269    if (json.has("_active"))
3270      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
3271    if (json.has("morphology"))
3272      res.setMorphology(parseCodeableConcept(getJObject(json, "morphology")));
3273    if (json.has("location"))
3274      res.setLocation(parseCodeableConcept(getJObject(json, "location")));
3275    if (json.has("locationQualifier")) {
3276      JsonArray array = json.getAsJsonArray("locationQualifier");
3277      for (int i = 0; i < array.size(); i++) {
3278        res.getLocationQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3279      }
3280    };
3281    if (json.has("description"))
3282      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3283    if (json.has("_description"))
3284      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3285    if (json.has("image")) {
3286      JsonArray array = json.getAsJsonArray("image");
3287      for (int i = 0; i < array.size(); i++) {
3288        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3289      }
3290    };
3291    if (json.has("patient"))
3292      res.setPatient(parseReference(getJObject(json, "patient")));
3293  }
3294
3295  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3296    Bundle res = new Bundle();
3297    parseBundleProperties(json, res);
3298    return res;
3299  }
3300
3301  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3302    parseResourceProperties(json, res);
3303    if (json.has("identifier"))
3304      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
3305    if (json.has("type"))
3306      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3307    if (json.has("_type"))
3308      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3309    if (json.has("timestamp"))
3310      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3311    if (json.has("_timestamp"))
3312      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
3313    if (json.has("total"))
3314      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3315    if (json.has("_total"))
3316      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
3317    if (json.has("link")) {
3318      JsonArray array = json.getAsJsonArray("link");
3319      for (int i = 0; i < array.size(); i++) {
3320        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
3321      }
3322    };
3323    if (json.has("entry")) {
3324      JsonArray array = json.getAsJsonArray("entry");
3325      for (int i = 0; i < array.size(); i++) {
3326        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
3327      }
3328    };
3329    if (json.has("signature"))
3330      res.setSignature(parseSignature(getJObject(json, "signature")));
3331  }
3332
3333  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3334    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3335    parseBundleBundleLinkComponentProperties(json, owner, res);
3336    return res;
3337  }
3338
3339  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
3340    parseBackboneElementProperties(json, res);
3341    if (json.has("relation"))
3342      res.setRelationElement(parseString(json.get("relation").getAsString()));
3343    if (json.has("_relation"))
3344      parseElementProperties(getJObject(json, "_relation"), res.getRelationElement());
3345    if (json.has("url"))
3346      res.setUrlElement(parseUri(json.get("url").getAsString()));
3347    if (json.has("_url"))
3348      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3349  }
3350
3351  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3352    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3353    parseBundleBundleEntryComponentProperties(json, owner, res);
3354    return res;
3355  }
3356
3357  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3358    parseBackboneElementProperties(json, res);
3359    if (json.has("link")) {
3360      JsonArray array = json.getAsJsonArray("link");
3361      for (int i = 0; i < array.size(); i++) {
3362        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
3363      }
3364    };
3365    if (json.has("fullUrl"))
3366      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3367    if (json.has("_fullUrl"))
3368      parseElementProperties(getJObject(json, "_fullUrl"), res.getFullUrlElement());
3369    if (json.has("resource"))
3370      res.setResource(parseResource(getJObject(json, "resource")));
3371    if (json.has("search"))
3372      res.setSearch(parseBundleBundleEntrySearchComponent(getJObject(json, "search"), owner));
3373    if (json.has("request"))
3374      res.setRequest(parseBundleBundleEntryRequestComponent(getJObject(json, "request"), owner));
3375    if (json.has("response"))
3376      res.setResponse(parseBundleBundleEntryResponseComponent(getJObject(json, "response"), owner));
3377  }
3378
3379  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3380    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3381    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
3382    return res;
3383  }
3384
3385  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3386    parseBackboneElementProperties(json, res);
3387    if (json.has("mode"))
3388      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
3389    if (json.has("_mode"))
3390      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3391    if (json.has("score"))
3392      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3393    if (json.has("_score"))
3394      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
3395  }
3396
3397  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3398    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3399    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
3400    return res;
3401  }
3402
3403  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3404    parseBackboneElementProperties(json, res);
3405    if (json.has("method"))
3406      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3407    if (json.has("_method"))
3408      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
3409    if (json.has("url"))
3410      res.setUrlElement(parseUri(json.get("url").getAsString()));
3411    if (json.has("_url"))
3412      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3413    if (json.has("ifNoneMatch"))
3414      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3415    if (json.has("_ifNoneMatch"))
3416      parseElementProperties(getJObject(json, "_ifNoneMatch"), res.getIfNoneMatchElement());
3417    if (json.has("ifModifiedSince"))
3418      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3419    if (json.has("_ifModifiedSince"))
3420      parseElementProperties(getJObject(json, "_ifModifiedSince"), res.getIfModifiedSinceElement());
3421    if (json.has("ifMatch"))
3422      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3423    if (json.has("_ifMatch"))
3424      parseElementProperties(getJObject(json, "_ifMatch"), res.getIfMatchElement());
3425    if (json.has("ifNoneExist"))
3426      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3427    if (json.has("_ifNoneExist"))
3428      parseElementProperties(getJObject(json, "_ifNoneExist"), res.getIfNoneExistElement());
3429  }
3430
3431  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3432    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3433    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
3434    return res;
3435  }
3436
3437  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3438    parseBackboneElementProperties(json, res);
3439    if (json.has("status"))
3440      res.setStatusElement(parseString(json.get("status").getAsString()));
3441    if (json.has("_status"))
3442      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3443    if (json.has("location"))
3444      res.setLocationElement(parseUri(json.get("location").getAsString()));
3445    if (json.has("_location"))
3446      parseElementProperties(getJObject(json, "_location"), res.getLocationElement());
3447    if (json.has("etag"))
3448      res.setEtagElement(parseString(json.get("etag").getAsString()));
3449    if (json.has("_etag"))
3450      parseElementProperties(getJObject(json, "_etag"), res.getEtagElement());
3451    if (json.has("lastModified"))
3452      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3453    if (json.has("_lastModified"))
3454      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
3455    if (json.has("outcome"))
3456      res.setOutcome(parseResource(getJObject(json, "outcome")));
3457  }
3458
3459  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3460    CapabilityStatement res = new CapabilityStatement();
3461    parseCapabilityStatementProperties(json, res);
3462    return res;
3463  }
3464
3465  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
3466    parseDomainResourceProperties(json, res);
3467    if (json.has("url"))
3468      res.setUrlElement(parseUri(json.get("url").getAsString()));
3469    if (json.has("_url"))
3470      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3471    if (json.has("version"))
3472      res.setVersionElement(parseString(json.get("version").getAsString()));
3473    if (json.has("_version"))
3474      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
3475    if (json.has("name"))
3476      res.setNameElement(parseString(json.get("name").getAsString()));
3477    if (json.has("_name"))
3478      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3479    if (json.has("title"))
3480      res.setTitleElement(parseString(json.get("title").getAsString()));
3481    if (json.has("_title"))
3482      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
3483    if (json.has("status"))
3484      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
3485    if (json.has("_status"))
3486      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3487    if (json.has("experimental"))
3488      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3489    if (json.has("_experimental"))
3490      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
3491    if (json.has("date"))
3492      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3493    if (json.has("_date"))
3494      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
3495    if (json.has("publisher"))
3496      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3497    if (json.has("_publisher"))
3498      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
3499    if (json.has("contact")) {
3500      JsonArray array = json.getAsJsonArray("contact");
3501      for (int i = 0; i < array.size(); i++) {
3502        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3503      }
3504    };
3505    if (json.has("description"))
3506      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3507    if (json.has("_description"))
3508      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3509    if (json.has("useContext")) {
3510      JsonArray array = json.getAsJsonArray("useContext");
3511      for (int i = 0; i < array.size(); i++) {
3512        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3513      }
3514    };
3515    if (json.has("jurisdiction")) {
3516      JsonArray array = json.getAsJsonArray("jurisdiction");
3517      for (int i = 0; i < array.size(); i++) {
3518        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3519      }
3520    };
3521    if (json.has("purpose"))
3522      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3523    if (json.has("_purpose"))
3524      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
3525    if (json.has("copyright"))
3526      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3527    if (json.has("_copyright"))
3528      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
3529    if (json.has("kind"))
3530      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
3531    if (json.has("_kind"))
3532      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
3533    if (json.has("instantiates")) {
3534      JsonArray array = json.getAsJsonArray("instantiates");
3535      for (int i = 0; i < array.size(); i++) {
3536        if (array.get(i).isJsonNull()) {
3537          res.getInstantiates().add(new CanonicalType());
3538        } else {
3539          res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3540        }
3541      }
3542    };
3543    if (json.has("_instantiates")) {
3544      JsonArray array = json.getAsJsonArray("_instantiates");
3545      for (int i = 0; i < array.size(); i++) {
3546        if (i == res.getInstantiates().size())
3547          res.getInstantiates().add(parseCanonical(null));
3548        if (array.get(i) instanceof JsonObject) 
3549          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3550      }
3551    };
3552    if (json.has("imports")) {
3553      JsonArray array = json.getAsJsonArray("imports");
3554      for (int i = 0; i < array.size(); i++) {
3555        if (array.get(i).isJsonNull()) {
3556          res.getImports().add(new CanonicalType());
3557        } else {
3558          res.getImports().add(parseCanonical(array.get(i).getAsString()));
3559        }
3560      }
3561    };
3562    if (json.has("_imports")) {
3563      JsonArray array = json.getAsJsonArray("_imports");
3564      for (int i = 0; i < array.size(); i++) {
3565        if (i == res.getImports().size())
3566          res.getImports().add(parseCanonical(null));
3567        if (array.get(i) instanceof JsonObject) 
3568          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
3569      }
3570    };
3571    if (json.has("software"))
3572      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(getJObject(json, "software"), res));
3573    if (json.has("implementation"))
3574      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(getJObject(json, "implementation"), res));
3575    if (json.has("fhirVersion"))
3576      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
3577    if (json.has("_fhirVersion"))
3578      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
3579    if (json.has("format")) {
3580      JsonArray array = json.getAsJsonArray("format");
3581      for (int i = 0; i < array.size(); i++) {
3582        if (array.get(i).isJsonNull()) {
3583          res.getFormat().add(new CodeType());
3584        } else {
3585          res.getFormat().add(parseCode(array.get(i).getAsString()));
3586        }
3587      }
3588    };
3589    if (json.has("_format")) {
3590      JsonArray array = json.getAsJsonArray("_format");
3591      for (int i = 0; i < array.size(); i++) {
3592        if (i == res.getFormat().size())
3593          res.getFormat().add(parseCode(null));
3594        if (array.get(i) instanceof JsonObject) 
3595          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3596      }
3597    };
3598    if (json.has("patchFormat")) {
3599      JsonArray array = json.getAsJsonArray("patchFormat");
3600      for (int i = 0; i < array.size(); i++) {
3601        if (array.get(i).isJsonNull()) {
3602          res.getPatchFormat().add(new CodeType());
3603        } else {
3604          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3605        }
3606      }
3607    };
3608    if (json.has("_patchFormat")) {
3609      JsonArray array = json.getAsJsonArray("_patchFormat");
3610      for (int i = 0; i < array.size(); i++) {
3611        if (i == res.getPatchFormat().size())
3612          res.getPatchFormat().add(parseCode(null));
3613        if (array.get(i) instanceof JsonObject) 
3614          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3615      }
3616    };
3617    if (json.has("implementationGuide")) {
3618      JsonArray array = json.getAsJsonArray("implementationGuide");
3619      for (int i = 0; i < array.size(); i++) {
3620        if (array.get(i).isJsonNull()) {
3621          res.getImplementationGuide().add(new CanonicalType());
3622        } else {
3623          res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
3624        }
3625      }
3626    };
3627    if (json.has("_implementationGuide")) {
3628      JsonArray array = json.getAsJsonArray("_implementationGuide");
3629      for (int i = 0; i < array.size(); i++) {
3630        if (i == res.getImplementationGuide().size())
3631          res.getImplementationGuide().add(parseCanonical(null));
3632        if (array.get(i) instanceof JsonObject) 
3633          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3634      }
3635    };
3636    if (json.has("rest")) {
3637      JsonArray array = json.getAsJsonArray("rest");
3638      for (int i = 0; i < array.size(); i++) {
3639        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3640      }
3641    };
3642    if (json.has("messaging")) {
3643      JsonArray array = json.getAsJsonArray("messaging");
3644      for (int i = 0; i < array.size(); i++) {
3645        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3646      }
3647    };
3648    if (json.has("document")) {
3649      JsonArray array = json.getAsJsonArray("document");
3650      for (int i = 0; i < array.size(); i++) {
3651        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3652      }
3653    };
3654  }
3655
3656  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3657    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3658    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3659    return res;
3660  }
3661
3662  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3663    parseBackboneElementProperties(json, res);
3664    if (json.has("name"))
3665      res.setNameElement(parseString(json.get("name").getAsString()));
3666    if (json.has("_name"))
3667      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3668    if (json.has("version"))
3669      res.setVersionElement(parseString(json.get("version").getAsString()));
3670    if (json.has("_version"))
3671      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
3672    if (json.has("releaseDate"))
3673      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3674    if (json.has("_releaseDate"))
3675      parseElementProperties(getJObject(json, "_releaseDate"), res.getReleaseDateElement());
3676  }
3677
3678  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3679    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3680    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3681    return res;
3682  }
3683
3684  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3685    parseBackboneElementProperties(json, res);
3686    if (json.has("description"))
3687      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3688    if (json.has("_description"))
3689      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3690    if (json.has("url"))
3691      res.setUrlElement(parseUrl(json.get("url").getAsString()));
3692    if (json.has("_url"))
3693      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3694    if (json.has("custodian"))
3695      res.setCustodian(parseReference(getJObject(json, "custodian")));
3696  }
3697
3698  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3699    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3700    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3701    return res;
3702  }
3703
3704  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3705    parseBackboneElementProperties(json, res);
3706    if (json.has("mode"))
3707      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3708    if (json.has("_mode"))
3709      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3710    if (json.has("documentation"))
3711      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3712    if (json.has("_documentation"))
3713      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3714    if (json.has("security"))
3715      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(getJObject(json, "security"), owner));
3716    if (json.has("resource")) {
3717      JsonArray array = json.getAsJsonArray("resource");
3718      for (int i = 0; i < array.size(); i++) {
3719        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3720      }
3721    };
3722    if (json.has("interaction")) {
3723      JsonArray array = json.getAsJsonArray("interaction");
3724      for (int i = 0; i < array.size(); i++) {
3725        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3726      }
3727    };
3728    if (json.has("searchParam")) {
3729      JsonArray array = json.getAsJsonArray("searchParam");
3730      for (int i = 0; i < array.size(); i++) {
3731        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3732      }
3733    };
3734    if (json.has("operation")) {
3735      JsonArray array = json.getAsJsonArray("operation");
3736      for (int i = 0; i < array.size(); i++) {
3737        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3738      }
3739    };
3740    if (json.has("compartment")) {
3741      JsonArray array = json.getAsJsonArray("compartment");
3742      for (int i = 0; i < array.size(); i++) {
3743        if (array.get(i).isJsonNull()) {
3744          res.getCompartment().add(new CanonicalType());
3745        } else {
3746          res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
3747        }
3748      }
3749    };
3750    if (json.has("_compartment")) {
3751      JsonArray array = json.getAsJsonArray("_compartment");
3752      for (int i = 0; i < array.size(); i++) {
3753        if (i == res.getCompartment().size())
3754          res.getCompartment().add(parseCanonical(null));
3755        if (array.get(i) instanceof JsonObject) 
3756          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3757      }
3758    };
3759  }
3760
3761  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3762    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3763    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
3764    return res;
3765  }
3766
3767  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3768    parseBackboneElementProperties(json, res);
3769    if (json.has("cors"))
3770      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3771    if (json.has("_cors"))
3772      parseElementProperties(getJObject(json, "_cors"), res.getCorsElement());
3773    if (json.has("service")) {
3774      JsonArray array = json.getAsJsonArray("service");
3775      for (int i = 0; i < array.size(); i++) {
3776        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3777      }
3778    };
3779    if (json.has("description"))
3780      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3781    if (json.has("_description"))
3782      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3783  }
3784
3785  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3786    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3787    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
3788    return res;
3789  }
3790
3791  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3792    parseBackboneElementProperties(json, res);
3793    if (json.has("type"))
3794      res.setTypeElement(parseCode(json.get("type").getAsString()));
3795    if (json.has("_type"))
3796      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3797    if (json.has("profile"))
3798      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3799    if (json.has("_profile"))
3800      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
3801    if (json.has("supportedProfile")) {
3802      JsonArray array = json.getAsJsonArray("supportedProfile");
3803      for (int i = 0; i < array.size(); i++) {
3804        if (array.get(i).isJsonNull()) {
3805          res.getSupportedProfile().add(new CanonicalType());
3806        } else {
3807          res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
3808        }
3809      }
3810    };
3811    if (json.has("_supportedProfile")) {
3812      JsonArray array = json.getAsJsonArray("_supportedProfile");
3813      for (int i = 0; i < array.size(); i++) {
3814        if (i == res.getSupportedProfile().size())
3815          res.getSupportedProfile().add(parseCanonical(null));
3816        if (array.get(i) instanceof JsonObject) 
3817          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
3818      }
3819    };
3820    if (json.has("documentation"))
3821      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3822    if (json.has("_documentation"))
3823      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3824    if (json.has("interaction")) {
3825      JsonArray array = json.getAsJsonArray("interaction");
3826      for (int i = 0; i < array.size(); i++) {
3827        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3828      }
3829    };
3830    if (json.has("versioning"))
3831      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3832    if (json.has("_versioning"))
3833      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
3834    if (json.has("readHistory"))
3835      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3836    if (json.has("_readHistory"))
3837      parseElementProperties(getJObject(json, "_readHistory"), res.getReadHistoryElement());
3838    if (json.has("updateCreate"))
3839      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3840    if (json.has("_updateCreate"))
3841      parseElementProperties(getJObject(json, "_updateCreate"), res.getUpdateCreateElement());
3842    if (json.has("conditionalCreate"))
3843      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3844    if (json.has("_conditionalCreate"))
3845      parseElementProperties(getJObject(json, "_conditionalCreate"), res.getConditionalCreateElement());
3846    if (json.has("conditionalRead"))
3847      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3848    if (json.has("_conditionalRead"))
3849      parseElementProperties(getJObject(json, "_conditionalRead"), res.getConditionalReadElement());
3850    if (json.has("conditionalUpdate"))
3851      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3852    if (json.has("_conditionalUpdate"))
3853      parseElementProperties(getJObject(json, "_conditionalUpdate"), res.getConditionalUpdateElement());
3854    if (json.has("conditionalDelete"))
3855      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3856    if (json.has("_conditionalDelete"))
3857      parseElementProperties(getJObject(json, "_conditionalDelete"), res.getConditionalDeleteElement());
3858    if (json.has("referencePolicy")) {
3859      JsonArray array = json.getAsJsonArray("referencePolicy");
3860      for (int i = 0; i < array.size(); i++) {
3861        if (array.get(i).isJsonNull()) {
3862          res.getReferencePolicy().add(new Enumeration<CapabilityStatement.ReferenceHandlingPolicy>());
3863        } else {
3864          res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3865        }
3866      }
3867    };
3868    if (json.has("_referencePolicy")) {
3869      JsonArray array = json.getAsJsonArray("_referencePolicy");
3870      for (int i = 0; i < array.size(); i++) {
3871        if (i == res.getReferencePolicy().size())
3872          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3873        if (array.get(i) instanceof JsonObject) 
3874          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3875      }
3876    };
3877    if (json.has("searchInclude")) {
3878      JsonArray array = json.getAsJsonArray("searchInclude");
3879      for (int i = 0; i < array.size(); i++) {
3880        if (array.get(i).isJsonNull()) {
3881          res.getSearchInclude().add(new StringType());
3882        } else {
3883          res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3884        }
3885      }
3886    };
3887    if (json.has("_searchInclude")) {
3888      JsonArray array = json.getAsJsonArray("_searchInclude");
3889      for (int i = 0; i < array.size(); i++) {
3890        if (i == res.getSearchInclude().size())
3891          res.getSearchInclude().add(parseString(null));
3892        if (array.get(i) instanceof JsonObject) 
3893          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3894      }
3895    };
3896    if (json.has("searchRevInclude")) {
3897      JsonArray array = json.getAsJsonArray("searchRevInclude");
3898      for (int i = 0; i < array.size(); i++) {
3899        if (array.get(i).isJsonNull()) {
3900          res.getSearchRevInclude().add(new StringType());
3901        } else {
3902          res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3903        }
3904      }
3905    };
3906    if (json.has("_searchRevInclude")) {
3907      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3908      for (int i = 0; i < array.size(); i++) {
3909        if (i == res.getSearchRevInclude().size())
3910          res.getSearchRevInclude().add(parseString(null));
3911        if (array.get(i) instanceof JsonObject) 
3912          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3913      }
3914    };
3915    if (json.has("searchParam")) {
3916      JsonArray array = json.getAsJsonArray("searchParam");
3917      for (int i = 0; i < array.size(); i++) {
3918        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3919      }
3920    };
3921    if (json.has("operation")) {
3922      JsonArray array = json.getAsJsonArray("operation");
3923      for (int i = 0; i < array.size(); i++) {
3924        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3925      }
3926    };
3927  }
3928
3929  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3930    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
3931    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
3932    return res;
3933  }
3934
3935  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
3936    parseBackboneElementProperties(json, res);
3937    if (json.has("code"))
3938      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
3939    if (json.has("_code"))
3940      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
3941    if (json.has("documentation"))
3942      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3943    if (json.has("_documentation"))
3944      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3945  }
3946
3947  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3948    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
3949    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
3950    return res;
3951  }
3952
3953  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
3954    parseBackboneElementProperties(json, res);
3955    if (json.has("name"))
3956      res.setNameElement(parseString(json.get("name").getAsString()));
3957    if (json.has("_name"))
3958      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3959    if (json.has("definition"))
3960      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3961    if (json.has("_definition"))
3962      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
3963    if (json.has("type"))
3964      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3965    if (json.has("_type"))
3966      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3967    if (json.has("documentation"))
3968      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3969    if (json.has("_documentation"))
3970      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3971  }
3972
3973  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3974    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
3975    parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(json, owner, res);
3976    return res;
3977  }
3978
3979  protected void parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
3980    parseBackboneElementProperties(json, res);
3981    if (json.has("name"))
3982      res.setNameElement(parseString(json.get("name").getAsString()));
3983    if (json.has("_name"))
3984      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3985    if (json.has("definition"))
3986      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3987    if (json.has("_definition"))
3988      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
3989    if (json.has("documentation"))
3990      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3991    if (json.has("_documentation"))
3992      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3993  }
3994
3995  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3996    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
3997    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
3998    return res;
3999  }
4000
4001  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
4002    parseBackboneElementProperties(json, res);
4003    if (json.has("code"))
4004      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
4005    if (json.has("_code"))
4006      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
4007    if (json.has("documentation"))
4008      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4009    if (json.has("_documentation"))
4010      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4011  }
4012
4013  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4014    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
4015    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
4016    return res;
4017  }
4018
4019  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
4020    parseBackboneElementProperties(json, res);
4021    if (json.has("endpoint")) {
4022      JsonArray array = json.getAsJsonArray("endpoint");
4023      for (int i = 0; i < array.size(); i++) {
4024        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
4025      }
4026    };
4027    if (json.has("reliableCache"))
4028      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
4029    if (json.has("_reliableCache"))
4030      parseElementProperties(getJObject(json, "_reliableCache"), res.getReliableCacheElement());
4031    if (json.has("documentation"))
4032      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4033    if (json.has("_documentation"))
4034      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4035    if (json.has("supportedMessage")) {
4036      JsonArray array = json.getAsJsonArray("supportedMessage");
4037      for (int i = 0; i < array.size(); i++) {
4038        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
4039      }
4040    };
4041  }
4042
4043  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4044    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
4045    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
4046    return res;
4047  }
4048
4049  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
4050    parseBackboneElementProperties(json, res);
4051    if (json.has("protocol"))
4052      res.setProtocol(parseCoding(getJObject(json, "protocol")));
4053    if (json.has("address"))
4054      res.setAddressElement(parseUrl(json.get("address").getAsString()));
4055    if (json.has("_address"))
4056      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
4057  }
4058
4059  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4060    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
4061    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
4062    return res;
4063  }
4064
4065  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
4066    parseBackboneElementProperties(json, res);
4067    if (json.has("mode"))
4068      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
4069    if (json.has("_mode"))
4070      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4071    if (json.has("definition"))
4072      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
4073    if (json.has("_definition"))
4074      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
4075  }
4076
4077  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
4078    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
4079    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
4080    return res;
4081  }
4082
4083  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
4084    parseBackboneElementProperties(json, res);
4085    if (json.has("mode"))
4086      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
4087    if (json.has("_mode"))
4088      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
4089    if (json.has("documentation"))
4090      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
4091    if (json.has("_documentation"))
4092      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
4093    if (json.has("profile"))
4094      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
4095    if (json.has("_profile"))
4096      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
4097  }
4098
4099  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
4100    CarePlan res = new CarePlan();
4101    parseCarePlanProperties(json, res);
4102    return res;
4103  }
4104
4105  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
4106    parseDomainResourceProperties(json, res);
4107    if (json.has("identifier")) {
4108      JsonArray array = json.getAsJsonArray("identifier");
4109      for (int i = 0; i < array.size(); i++) {
4110        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4111      }
4112    };
4113    if (json.has("instantiatesCanonical")) {
4114      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4115      for (int i = 0; i < array.size(); i++) {
4116        if (array.get(i).isJsonNull()) {
4117          res.getInstantiatesCanonical().add(new CanonicalType());
4118        } else {
4119          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4120        }
4121      }
4122    };
4123    if (json.has("_instantiatesCanonical")) {
4124      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4125      for (int i = 0; i < array.size(); i++) {
4126        if (i == res.getInstantiatesCanonical().size())
4127          res.getInstantiatesCanonical().add(parseCanonical(null));
4128        if (array.get(i) instanceof JsonObject) 
4129          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4130      }
4131    };
4132    if (json.has("instantiatesUri")) {
4133      JsonArray array = json.getAsJsonArray("instantiatesUri");
4134      for (int i = 0; i < array.size(); i++) {
4135        if (array.get(i).isJsonNull()) {
4136          res.getInstantiatesUri().add(new UriType());
4137        } else {
4138          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4139        }
4140      }
4141    };
4142    if (json.has("_instantiatesUri")) {
4143      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4144      for (int i = 0; i < array.size(); i++) {
4145        if (i == res.getInstantiatesUri().size())
4146          res.getInstantiatesUri().add(parseUri(null));
4147        if (array.get(i) instanceof JsonObject) 
4148          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4149      }
4150    };
4151    if (json.has("basedOn")) {
4152      JsonArray array = json.getAsJsonArray("basedOn");
4153      for (int i = 0; i < array.size(); i++) {
4154        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4155      }
4156    };
4157    if (json.has("replaces")) {
4158      JsonArray array = json.getAsJsonArray("replaces");
4159      for (int i = 0; i < array.size(); i++) {
4160        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
4161      }
4162    };
4163    if (json.has("partOf")) {
4164      JsonArray array = json.getAsJsonArray("partOf");
4165      for (int i = 0; i < array.size(); i++) {
4166        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4167      }
4168    };
4169    if (json.has("status"))
4170      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
4171    if (json.has("_status"))
4172      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4173    if (json.has("intent"))
4174      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
4175    if (json.has("_intent"))
4176      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
4177    if (json.has("category")) {
4178      JsonArray array = json.getAsJsonArray("category");
4179      for (int i = 0; i < array.size(); i++) {
4180        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4181      }
4182    };
4183    if (json.has("title"))
4184      res.setTitleElement(parseString(json.get("title").getAsString()));
4185    if (json.has("_title"))
4186      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
4187    if (json.has("description"))
4188      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4189    if (json.has("_description"))
4190      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4191    if (json.has("subject"))
4192      res.setSubject(parseReference(getJObject(json, "subject")));
4193    if (json.has("encounter"))
4194      res.setEncounter(parseReference(getJObject(json, "encounter")));
4195    if (json.has("period"))
4196      res.setPeriod(parsePeriod(getJObject(json, "period")));
4197    if (json.has("created"))
4198      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4199    if (json.has("_created"))
4200      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4201    if (json.has("author"))
4202      res.setAuthor(parseReference(getJObject(json, "author")));
4203    if (json.has("contributor")) {
4204      JsonArray array = json.getAsJsonArray("contributor");
4205      for (int i = 0; i < array.size(); i++) {
4206        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
4207      }
4208    };
4209    if (json.has("careTeam")) {
4210      JsonArray array = json.getAsJsonArray("careTeam");
4211      for (int i = 0; i < array.size(); i++) {
4212        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
4213      }
4214    };
4215    if (json.has("addresses")) {
4216      JsonArray array = json.getAsJsonArray("addresses");
4217      for (int i = 0; i < array.size(); i++) {
4218        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
4219      }
4220    };
4221    if (json.has("supportingInfo")) {
4222      JsonArray array = json.getAsJsonArray("supportingInfo");
4223      for (int i = 0; i < array.size(); i++) {
4224        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
4225      }
4226    };
4227    if (json.has("goal")) {
4228      JsonArray array = json.getAsJsonArray("goal");
4229      for (int i = 0; i < array.size(); i++) {
4230        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4231      }
4232    };
4233    if (json.has("activity")) {
4234      JsonArray array = json.getAsJsonArray("activity");
4235      for (int i = 0; i < array.size(); i++) {
4236        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
4237      }
4238    };
4239    if (json.has("note")) {
4240      JsonArray array = json.getAsJsonArray("note");
4241      for (int i = 0; i < array.size(); i++) {
4242        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4243      }
4244    };
4245  }
4246
4247  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4248    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
4249    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
4250    return res;
4251  }
4252
4253  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
4254    parseBackboneElementProperties(json, res);
4255    if (json.has("outcomeCodeableConcept")) {
4256      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
4257      for (int i = 0; i < array.size(); i++) {
4258        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4259      }
4260    };
4261    if (json.has("outcomeReference")) {
4262      JsonArray array = json.getAsJsonArray("outcomeReference");
4263      for (int i = 0; i < array.size(); i++) {
4264        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
4265      }
4266    };
4267    if (json.has("progress")) {
4268      JsonArray array = json.getAsJsonArray("progress");
4269      for (int i = 0; i < array.size(); i++) {
4270        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
4271      }
4272    };
4273    if (json.has("reference"))
4274      res.setReference(parseReference(getJObject(json, "reference")));
4275    if (json.has("detail"))
4276      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(getJObject(json, "detail"), owner));
4277  }
4278
4279  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4280    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
4281    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
4282    return res;
4283  }
4284
4285  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
4286    parseBackboneElementProperties(json, res);
4287    if (json.has("kind"))
4288      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
4289    if (json.has("_kind"))
4290      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
4291    if (json.has("instantiatesCanonical")) {
4292      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4293      for (int i = 0; i < array.size(); i++) {
4294        if (array.get(i).isJsonNull()) {
4295          res.getInstantiatesCanonical().add(new CanonicalType());
4296        } else {
4297          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4298        }
4299      }
4300    };
4301    if (json.has("_instantiatesCanonical")) {
4302      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4303      for (int i = 0; i < array.size(); i++) {
4304        if (i == res.getInstantiatesCanonical().size())
4305          res.getInstantiatesCanonical().add(parseCanonical(null));
4306        if (array.get(i) instanceof JsonObject) 
4307          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4308      }
4309    };
4310    if (json.has("instantiatesUri")) {
4311      JsonArray array = json.getAsJsonArray("instantiatesUri");
4312      for (int i = 0; i < array.size(); i++) {
4313        if (array.get(i).isJsonNull()) {
4314          res.getInstantiatesUri().add(new UriType());
4315        } else {
4316          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4317        }
4318      }
4319    };
4320    if (json.has("_instantiatesUri")) {
4321      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4322      for (int i = 0; i < array.size(); i++) {
4323        if (i == res.getInstantiatesUri().size())
4324          res.getInstantiatesUri().add(parseUri(null));
4325        if (array.get(i) instanceof JsonObject) 
4326          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4327      }
4328    };
4329    if (json.has("code"))
4330      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4331    if (json.has("reasonCode")) {
4332      JsonArray array = json.getAsJsonArray("reasonCode");
4333      for (int i = 0; i < array.size(); i++) {
4334        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4335      }
4336    };
4337    if (json.has("reasonReference")) {
4338      JsonArray array = json.getAsJsonArray("reasonReference");
4339      for (int i = 0; i < array.size(); i++) {
4340        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4341      }
4342    };
4343    if (json.has("goal")) {
4344      JsonArray array = json.getAsJsonArray("goal");
4345      for (int i = 0; i < array.size(); i++) {
4346        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4347      }
4348    };
4349    if (json.has("status"))
4350      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
4351    if (json.has("_status"))
4352      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4353    if (json.has("statusReason"))
4354      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
4355    if (json.has("doNotPerform"))
4356      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
4357    if (json.has("_doNotPerform"))
4358      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
4359    Type scheduled = parseType("scheduled", json);
4360    if (scheduled != null)
4361      res.setScheduled(scheduled);
4362    if (json.has("location"))
4363      res.setLocation(parseReference(getJObject(json, "location")));
4364    if (json.has("performer")) {
4365      JsonArray array = json.getAsJsonArray("performer");
4366      for (int i = 0; i < array.size(); i++) {
4367        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
4368      }
4369    };
4370    Type product = parseType("product", json);
4371    if (product != null)
4372      res.setProduct(product);
4373    if (json.has("dailyAmount"))
4374      res.setDailyAmount(parseQuantity(getJObject(json, "dailyAmount")));
4375    if (json.has("quantity"))
4376      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
4377    if (json.has("description"))
4378      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4379    if (json.has("_description"))
4380      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4381  }
4382
4383  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
4384    CareTeam res = new CareTeam();
4385    parseCareTeamProperties(json, res);
4386    return res;
4387  }
4388
4389  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
4390    parseDomainResourceProperties(json, res);
4391    if (json.has("identifier")) {
4392      JsonArray array = json.getAsJsonArray("identifier");
4393      for (int i = 0; i < array.size(); i++) {
4394        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4395      }
4396    };
4397    if (json.has("status"))
4398      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
4399    if (json.has("_status"))
4400      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4401    if (json.has("category")) {
4402      JsonArray array = json.getAsJsonArray("category");
4403      for (int i = 0; i < array.size(); i++) {
4404        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4405      }
4406    };
4407    if (json.has("name"))
4408      res.setNameElement(parseString(json.get("name").getAsString()));
4409    if (json.has("_name"))
4410      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
4411    if (json.has("subject"))
4412      res.setSubject(parseReference(getJObject(json, "subject")));
4413    if (json.has("encounter"))
4414      res.setEncounter(parseReference(getJObject(json, "encounter")));
4415    if (json.has("period"))
4416      res.setPeriod(parsePeriod(getJObject(json, "period")));
4417    if (json.has("participant")) {
4418      JsonArray array = json.getAsJsonArray("participant");
4419      for (int i = 0; i < array.size(); i++) {
4420        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
4421      }
4422    };
4423    if (json.has("reasonCode")) {
4424      JsonArray array = json.getAsJsonArray("reasonCode");
4425      for (int i = 0; i < array.size(); i++) {
4426        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4427      }
4428    };
4429    if (json.has("reasonReference")) {
4430      JsonArray array = json.getAsJsonArray("reasonReference");
4431      for (int i = 0; i < array.size(); i++) {
4432        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4433      }
4434    };
4435    if (json.has("managingOrganization")) {
4436      JsonArray array = json.getAsJsonArray("managingOrganization");
4437      for (int i = 0; i < array.size(); i++) {
4438        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
4439      }
4440    };
4441    if (json.has("telecom")) {
4442      JsonArray array = json.getAsJsonArray("telecom");
4443      for (int i = 0; i < array.size(); i++) {
4444        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4445      }
4446    };
4447    if (json.has("note")) {
4448      JsonArray array = json.getAsJsonArray("note");
4449      for (int i = 0; i < array.size(); i++) {
4450        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4451      }
4452    };
4453  }
4454
4455  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
4456    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
4457    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
4458    return res;
4459  }
4460
4461  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
4462    parseBackboneElementProperties(json, res);
4463    if (json.has("role")) {
4464      JsonArray array = json.getAsJsonArray("role");
4465      for (int i = 0; i < array.size(); i++) {
4466        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4467      }
4468    };
4469    if (json.has("member"))
4470      res.setMember(parseReference(getJObject(json, "member")));
4471    if (json.has("onBehalfOf"))
4472      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
4473    if (json.has("period"))
4474      res.setPeriod(parsePeriod(getJObject(json, "period")));
4475  }
4476
4477  protected CatalogEntry parseCatalogEntry(JsonObject json) throws IOException, FHIRFormatError {
4478    CatalogEntry res = new CatalogEntry();
4479    parseCatalogEntryProperties(json, res);
4480    return res;
4481  }
4482
4483  protected void parseCatalogEntryProperties(JsonObject json, CatalogEntry res) throws IOException, FHIRFormatError {
4484    parseDomainResourceProperties(json, res);
4485    if (json.has("identifier")) {
4486      JsonArray array = json.getAsJsonArray("identifier");
4487      for (int i = 0; i < array.size(); i++) {
4488        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4489      }
4490    };
4491    if (json.has("type"))
4492      res.setType(parseCodeableConcept(getJObject(json, "type")));
4493    if (json.has("orderable"))
4494      res.setOrderableElement(parseBoolean(json.get("orderable").getAsBoolean()));
4495    if (json.has("_orderable"))
4496      parseElementProperties(getJObject(json, "_orderable"), res.getOrderableElement());
4497    if (json.has("referencedItem"))
4498      res.setReferencedItem(parseReference(getJObject(json, "referencedItem")));
4499    if (json.has("additionalIdentifier")) {
4500      JsonArray array = json.getAsJsonArray("additionalIdentifier");
4501      for (int i = 0; i < array.size(); i++) {
4502        res.getAdditionalIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4503      }
4504    };
4505    if (json.has("classification")) {
4506      JsonArray array = json.getAsJsonArray("classification");
4507      for (int i = 0; i < array.size(); i++) {
4508        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4509      }
4510    };
4511    if (json.has("status"))
4512      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4513    if (json.has("_status"))
4514      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4515    if (json.has("validityPeriod"))
4516      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
4517    if (json.has("validTo"))
4518      res.setValidToElement(parseDateTime(json.get("validTo").getAsString()));
4519    if (json.has("_validTo"))
4520      parseElementProperties(getJObject(json, "_validTo"), res.getValidToElement());
4521    if (json.has("lastUpdated"))
4522      res.setLastUpdatedElement(parseDateTime(json.get("lastUpdated").getAsString()));
4523    if (json.has("_lastUpdated"))
4524      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
4525    if (json.has("additionalCharacteristic")) {
4526      JsonArray array = json.getAsJsonArray("additionalCharacteristic");
4527      for (int i = 0; i < array.size(); i++) {
4528        res.getAdditionalCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4529      }
4530    };
4531    if (json.has("additionalClassification")) {
4532      JsonArray array = json.getAsJsonArray("additionalClassification");
4533      for (int i = 0; i < array.size(); i++) {
4534        res.getAdditionalClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4535      }
4536    };
4537    if (json.has("relatedEntry")) {
4538      JsonArray array = json.getAsJsonArray("relatedEntry");
4539      for (int i = 0; i < array.size(); i++) {
4540        res.getRelatedEntry().add(parseCatalogEntryCatalogEntryRelatedEntryComponent(array.get(i).getAsJsonObject(), res));
4541      }
4542    };
4543  }
4544
4545  protected CatalogEntry.CatalogEntryRelatedEntryComponent parseCatalogEntryCatalogEntryRelatedEntryComponent(JsonObject json, CatalogEntry owner) throws IOException, FHIRFormatError {
4546    CatalogEntry.CatalogEntryRelatedEntryComponent res = new CatalogEntry.CatalogEntryRelatedEntryComponent();
4547    parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(json, owner, res);
4548    return res;
4549  }
4550
4551  protected void parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(JsonObject json, CatalogEntry owner, CatalogEntry.CatalogEntryRelatedEntryComponent res) throws IOException, FHIRFormatError {
4552    parseBackboneElementProperties(json, res);
4553    if (json.has("relationtype"))
4554      res.setRelationtypeElement(parseEnumeration(json.get("relationtype").getAsString(), CatalogEntry.CatalogEntryRelationType.NULL, new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
4555    if (json.has("_relationtype"))
4556      parseElementProperties(getJObject(json, "_relationtype"), res.getRelationtypeElement());
4557    if (json.has("item"))
4558      res.setItem(parseReference(getJObject(json, "item")));
4559  }
4560
4561  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
4562    ChargeItem res = new ChargeItem();
4563    parseChargeItemProperties(json, res);
4564    return res;
4565  }
4566
4567  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
4568    parseDomainResourceProperties(json, res);
4569    if (json.has("identifier")) {
4570      JsonArray array = json.getAsJsonArray("identifier");
4571      for (int i = 0; i < array.size(); i++) {
4572        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4573      }
4574    };
4575    if (json.has("definitionUri")) {
4576      JsonArray array = json.getAsJsonArray("definitionUri");
4577      for (int i = 0; i < array.size(); i++) {
4578        if (array.get(i).isJsonNull()) {
4579          res.getDefinitionUri().add(new UriType());
4580        } else {
4581          res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
4582        }
4583      }
4584    };
4585    if (json.has("_definitionUri")) {
4586      JsonArray array = json.getAsJsonArray("_definitionUri");
4587      for (int i = 0; i < array.size(); i++) {
4588        if (i == res.getDefinitionUri().size())
4589          res.getDefinitionUri().add(parseUri(null));
4590        if (array.get(i) instanceof JsonObject) 
4591          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
4592      }
4593    };
4594    if (json.has("definitionCanonical")) {
4595      JsonArray array = json.getAsJsonArray("definitionCanonical");
4596      for (int i = 0; i < array.size(); i++) {
4597        if (array.get(i).isJsonNull()) {
4598          res.getDefinitionCanonical().add(new CanonicalType());
4599        } else {
4600          res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
4601        }
4602      }
4603    };
4604    if (json.has("_definitionCanonical")) {
4605      JsonArray array = json.getAsJsonArray("_definitionCanonical");
4606      for (int i = 0; i < array.size(); i++) {
4607        if (i == res.getDefinitionCanonical().size())
4608          res.getDefinitionCanonical().add(parseCanonical(null));
4609        if (array.get(i) instanceof JsonObject) 
4610          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
4611      }
4612    };
4613    if (json.has("status"))
4614      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
4615    if (json.has("_status"))
4616      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4617    if (json.has("partOf")) {
4618      JsonArray array = json.getAsJsonArray("partOf");
4619      for (int i = 0; i < array.size(); i++) {
4620        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4621      }
4622    };
4623    if (json.has("code"))
4624      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4625    if (json.has("subject"))
4626      res.setSubject(parseReference(getJObject(json, "subject")));
4627    if (json.has("context"))
4628      res.setContext(parseReference(getJObject(json, "context")));
4629    Type occurrence = parseType("occurrence", json);
4630    if (occurrence != null)
4631      res.setOccurrence(occurrence);
4632    if (json.has("performer")) {
4633      JsonArray array = json.getAsJsonArray("performer");
4634      for (int i = 0; i < array.size(); i++) {
4635        res.getPerformer().add(parseChargeItemChargeItemPerformerComponent(array.get(i).getAsJsonObject(), res));
4636      }
4637    };
4638    if (json.has("performingOrganization"))
4639      res.setPerformingOrganization(parseReference(getJObject(json, "performingOrganization")));
4640    if (json.has("requestingOrganization"))
4641      res.setRequestingOrganization(parseReference(getJObject(json, "requestingOrganization")));
4642    if (json.has("costCenter"))
4643      res.setCostCenter(parseReference(getJObject(json, "costCenter")));
4644    if (json.has("quantity"))
4645      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
4646    if (json.has("bodysite")) {
4647      JsonArray array = json.getAsJsonArray("bodysite");
4648      for (int i = 0; i < array.size(); i++) {
4649        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4650      }
4651    };
4652    if (json.has("factorOverride"))
4653      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
4654    if (json.has("_factorOverride"))
4655      parseElementProperties(getJObject(json, "_factorOverride"), res.getFactorOverrideElement());
4656    if (json.has("priceOverride"))
4657      res.setPriceOverride(parseMoney(getJObject(json, "priceOverride")));
4658    if (json.has("overrideReason"))
4659      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
4660    if (json.has("_overrideReason"))
4661      parseElementProperties(getJObject(json, "_overrideReason"), res.getOverrideReasonElement());
4662    if (json.has("enterer"))
4663      res.setEnterer(parseReference(getJObject(json, "enterer")));
4664    if (json.has("enteredDate"))
4665      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
4666    if (json.has("_enteredDate"))
4667      parseElementProperties(getJObject(json, "_enteredDate"), res.getEnteredDateElement());
4668    if (json.has("reason")) {
4669      JsonArray array = json.getAsJsonArray("reason");
4670      for (int i = 0; i < array.size(); i++) {
4671        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4672      }
4673    };
4674    if (json.has("service")) {
4675      JsonArray array = json.getAsJsonArray("service");
4676      for (int i = 0; i < array.size(); i++) {
4677        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
4678      }
4679    };
4680    Type product = parseType("product", json);
4681    if (product != null)
4682      res.setProduct(product);
4683    if (json.has("account")) {
4684      JsonArray array = json.getAsJsonArray("account");
4685      for (int i = 0; i < array.size(); i++) {
4686        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
4687      }
4688    };
4689    if (json.has("note")) {
4690      JsonArray array = json.getAsJsonArray("note");
4691      for (int i = 0; i < array.size(); i++) {
4692        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4693      }
4694    };
4695    if (json.has("supportingInformation")) {
4696      JsonArray array = json.getAsJsonArray("supportingInformation");
4697      for (int i = 0; i < array.size(); i++) {
4698        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
4699      }
4700    };
4701  }
4702
4703  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemChargeItemPerformerComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
4704    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
4705    parseChargeItemChargeItemPerformerComponentProperties(json, owner, res);
4706    return res;
4707  }
4708
4709  protected void parseChargeItemChargeItemPerformerComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
4710    parseBackboneElementProperties(json, res);
4711    if (json.has("function"))
4712      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
4713    if (json.has("actor"))
4714      res.setActor(parseReference(getJObject(json, "actor")));
4715  }
4716
4717  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
4718    ChargeItemDefinition res = new ChargeItemDefinition();
4719    parseChargeItemDefinitionProperties(json, res);
4720    return res;
4721  }
4722
4723  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
4724    parseDomainResourceProperties(json, res);
4725    if (json.has("url"))
4726      res.setUrlElement(parseUri(json.get("url").getAsString()));
4727    if (json.has("_url"))
4728      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
4729    if (json.has("identifier")) {
4730      JsonArray array = json.getAsJsonArray("identifier");
4731      for (int i = 0; i < array.size(); i++) {
4732        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4733      }
4734    };
4735    if (json.has("version"))
4736      res.setVersionElement(parseString(json.get("version").getAsString()));
4737    if (json.has("_version"))
4738      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
4739    if (json.has("title"))
4740      res.setTitleElement(parseString(json.get("title").getAsString()));
4741    if (json.has("_title"))
4742      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
4743    if (json.has("derivedFromUri")) {
4744      JsonArray array = json.getAsJsonArray("derivedFromUri");
4745      for (int i = 0; i < array.size(); i++) {
4746        if (array.get(i).isJsonNull()) {
4747          res.getDerivedFromUri().add(new UriType());
4748        } else {
4749          res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
4750        }
4751      }
4752    };
4753    if (json.has("_derivedFromUri")) {
4754      JsonArray array = json.getAsJsonArray("_derivedFromUri");
4755      for (int i = 0; i < array.size(); i++) {
4756        if (i == res.getDerivedFromUri().size())
4757          res.getDerivedFromUri().add(parseUri(null));
4758        if (array.get(i) instanceof JsonObject) 
4759          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
4760      }
4761    };
4762    if (json.has("partOf")) {
4763      JsonArray array = json.getAsJsonArray("partOf");
4764      for (int i = 0; i < array.size(); i++) {
4765        if (array.get(i).isJsonNull()) {
4766          res.getPartOf().add(new CanonicalType());
4767        } else {
4768          res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
4769        }
4770      }
4771    };
4772    if (json.has("_partOf")) {
4773      JsonArray array = json.getAsJsonArray("_partOf");
4774      for (int i = 0; i < array.size(); i++) {
4775        if (i == res.getPartOf().size())
4776          res.getPartOf().add(parseCanonical(null));
4777        if (array.get(i) instanceof JsonObject) 
4778          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
4779      }
4780    };
4781    if (json.has("replaces")) {
4782      JsonArray array = json.getAsJsonArray("replaces");
4783      for (int i = 0; i < array.size(); i++) {
4784        if (array.get(i).isJsonNull()) {
4785          res.getReplaces().add(new CanonicalType());
4786        } else {
4787          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
4788        }
4789      }
4790    };
4791    if (json.has("_replaces")) {
4792      JsonArray array = json.getAsJsonArray("_replaces");
4793      for (int i = 0; i < array.size(); i++) {
4794        if (i == res.getReplaces().size())
4795          res.getReplaces().add(parseCanonical(null));
4796        if (array.get(i) instanceof JsonObject) 
4797          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
4798      }
4799    };
4800    if (json.has("status"))
4801      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4802    if (json.has("_status"))
4803      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4804    if (json.has("experimental"))
4805      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4806    if (json.has("_experimental"))
4807      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
4808    if (json.has("date"))
4809      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4810    if (json.has("_date"))
4811      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4812    if (json.has("publisher"))
4813      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4814    if (json.has("_publisher"))
4815      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
4816    if (json.has("contact")) {
4817      JsonArray array = json.getAsJsonArray("contact");
4818      for (int i = 0; i < array.size(); i++) {
4819        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4820      }
4821    };
4822    if (json.has("description"))
4823      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4824    if (json.has("_description"))
4825      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4826    if (json.has("useContext")) {
4827      JsonArray array = json.getAsJsonArray("useContext");
4828      for (int i = 0; i < array.size(); i++) {
4829        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4830      }
4831    };
4832    if (json.has("jurisdiction")) {
4833      JsonArray array = json.getAsJsonArray("jurisdiction");
4834      for (int i = 0; i < array.size(); i++) {
4835        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4836      }
4837    };
4838    if (json.has("copyright"))
4839      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4840    if (json.has("_copyright"))
4841      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
4842    if (json.has("approvalDate"))
4843      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
4844    if (json.has("_approvalDate"))
4845      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
4846    if (json.has("lastReviewDate"))
4847      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
4848    if (json.has("_lastReviewDate"))
4849      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
4850    if (json.has("effectivePeriod"))
4851      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
4852    if (json.has("code"))
4853      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4854    if (json.has("instance")) {
4855      JsonArray array = json.getAsJsonArray("instance");
4856      for (int i = 0; i < array.size(); i++) {
4857        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
4858      }
4859    };
4860    if (json.has("applicability")) {
4861      JsonArray array = json.getAsJsonArray("applicability");
4862      for (int i = 0; i < array.size(); i++) {
4863        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), res));
4864      }
4865    };
4866    if (json.has("propertyGroup")) {
4867      JsonArray array = json.getAsJsonArray("propertyGroup");
4868      for (int i = 0; i < array.size(); i++) {
4869        res.getPropertyGroup().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject(), res));
4870      }
4871    };
4872  }
4873
4874  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4875    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
4876    parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(json, owner, res);
4877    return res;
4878  }
4879
4880  protected void parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
4881    parseBackboneElementProperties(json, res);
4882    if (json.has("description"))
4883      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4884    if (json.has("_description"))
4885      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
4886    if (json.has("language"))
4887      res.setLanguageElement(parseString(json.get("language").getAsString()));
4888    if (json.has("_language"))
4889      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
4890    if (json.has("expression"))
4891      res.setExpressionElement(parseString(json.get("expression").getAsString()));
4892    if (json.has("_expression"))
4893      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
4894  }
4895
4896  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4897    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
4898    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(json, owner, res);
4899    return res;
4900  }
4901
4902  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
4903    parseBackboneElementProperties(json, res);
4904    if (json.has("applicability")) {
4905      JsonArray array = json.getAsJsonArray("applicability");
4906      for (int i = 0; i < array.size(); i++) {
4907        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), owner));
4908      }
4909    };
4910    if (json.has("priceComponent")) {
4911      JsonArray array = json.getAsJsonArray("priceComponent");
4912      for (int i = 0; i < array.size(); i++) {
4913        res.getPriceComponent().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
4914      }
4915    };
4916  }
4917
4918  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4919    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
4920    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(json, owner, res);
4921    return res;
4922  }
4923
4924  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res) throws IOException, FHIRFormatError {
4925    parseBackboneElementProperties(json, res);
4926    if (json.has("type"))
4927      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.NULL, new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory()));
4928    if (json.has("_type"))
4929      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
4930    if (json.has("code"))
4931      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4932    if (json.has("factor"))
4933      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4934    if (json.has("_factor"))
4935      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
4936    if (json.has("amount"))
4937      res.setAmount(parseMoney(getJObject(json, "amount")));
4938  }
4939
4940  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
4941    Claim res = new Claim();
4942    parseClaimProperties(json, res);
4943    return res;
4944  }
4945
4946  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
4947    parseDomainResourceProperties(json, res);
4948    if (json.has("identifier")) {
4949      JsonArray array = json.getAsJsonArray("identifier");
4950      for (int i = 0; i < array.size(); i++) {
4951        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4952      }
4953    };
4954    if (json.has("status"))
4955      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
4956    if (json.has("_status"))
4957      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4958    if (json.has("type"))
4959      res.setType(parseCodeableConcept(getJObject(json, "type")));
4960    if (json.has("subType"))
4961      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
4962    if (json.has("use"))
4963      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
4964    if (json.has("_use"))
4965      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
4966    if (json.has("patient"))
4967      res.setPatient(parseReference(getJObject(json, "patient")));
4968    if (json.has("billablePeriod"))
4969      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
4970    if (json.has("created"))
4971      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4972    if (json.has("_created"))
4973      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4974    if (json.has("enterer"))
4975      res.setEnterer(parseReference(getJObject(json, "enterer")));
4976    if (json.has("insurer"))
4977      res.setInsurer(parseReference(getJObject(json, "insurer")));
4978    if (json.has("provider"))
4979      res.setProvider(parseReference(getJObject(json, "provider")));
4980    if (json.has("priority"))
4981      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
4982    if (json.has("fundsReserve"))
4983      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
4984    if (json.has("related")) {
4985      JsonArray array = json.getAsJsonArray("related");
4986      for (int i = 0; i < array.size(); i++) {
4987        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
4988      }
4989    };
4990    if (json.has("prescription"))
4991      res.setPrescription(parseReference(getJObject(json, "prescription")));
4992    if (json.has("originalPrescription"))
4993      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
4994    if (json.has("payee"))
4995      res.setPayee(parseClaimPayeeComponent(getJObject(json, "payee"), res));
4996    if (json.has("referral"))
4997      res.setReferral(parseReference(getJObject(json, "referral")));
4998    if (json.has("facility"))
4999      res.setFacility(parseReference(getJObject(json, "facility")));
5000    if (json.has("careTeam")) {
5001      JsonArray array = json.getAsJsonArray("careTeam");
5002      for (int i = 0; i < array.size(); i++) {
5003        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
5004      }
5005    };
5006    if (json.has("supportingInfo")) {
5007      JsonArray array = json.getAsJsonArray("supportingInfo");
5008      for (int i = 0; i < array.size(); i++) {
5009        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
5010      }
5011    };
5012    if (json.has("diagnosis")) {
5013      JsonArray array = json.getAsJsonArray("diagnosis");
5014      for (int i = 0; i < array.size(); i++) {
5015        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
5016      }
5017    };
5018    if (json.has("procedure")) {
5019      JsonArray array = json.getAsJsonArray("procedure");
5020      for (int i = 0; i < array.size(); i++) {
5021        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
5022      }
5023    };
5024    if (json.has("insurance")) {
5025      JsonArray array = json.getAsJsonArray("insurance");
5026      for (int i = 0; i < array.size(); i++) {
5027        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
5028      }
5029    };
5030    if (json.has("accident"))
5031      res.setAccident(parseClaimAccidentComponent(getJObject(json, "accident"), res));
5032    if (json.has("item")) {
5033      JsonArray array = json.getAsJsonArray("item");
5034      for (int i = 0; i < array.size(); i++) {
5035        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
5036      }
5037    };
5038    if (json.has("total"))
5039      res.setTotal(parseMoney(getJObject(json, "total")));
5040  }
5041
5042  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5043    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
5044    parseClaimRelatedClaimComponentProperties(json, owner, res);
5045    return res;
5046  }
5047
5048  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
5049    parseBackboneElementProperties(json, res);
5050    if (json.has("claim"))
5051      res.setClaim(parseReference(getJObject(json, "claim")));
5052    if (json.has("relationship"))
5053      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
5054    if (json.has("reference"))
5055      res.setReference(parseIdentifier(getJObject(json, "reference")));
5056  }
5057
5058  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5059    Claim.PayeeComponent res = new Claim.PayeeComponent();
5060    parseClaimPayeeComponentProperties(json, owner, res);
5061    return res;
5062  }
5063
5064  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
5065    parseBackboneElementProperties(json, res);
5066    if (json.has("type"))
5067      res.setType(parseCodeableConcept(getJObject(json, "type")));
5068    if (json.has("party"))
5069      res.setParty(parseReference(getJObject(json, "party")));
5070  }
5071
5072  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5073    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
5074    parseClaimCareTeamComponentProperties(json, owner, res);
5075    return res;
5076  }
5077
5078  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
5079    parseBackboneElementProperties(json, res);
5080    if (json.has("sequence"))
5081      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5082    if (json.has("_sequence"))
5083      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5084    if (json.has("provider"))
5085      res.setProvider(parseReference(getJObject(json, "provider")));
5086    if (json.has("responsible"))
5087      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
5088    if (json.has("_responsible"))
5089      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
5090    if (json.has("role"))
5091      res.setRole(parseCodeableConcept(getJObject(json, "role")));
5092    if (json.has("qualification"))
5093      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
5094  }
5095
5096  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5097    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
5098    parseClaimSupportingInformationComponentProperties(json, owner, res);
5099    return res;
5100  }
5101
5102  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim owner, Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
5103    parseBackboneElementProperties(json, res);
5104    if (json.has("sequence"))
5105      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5106    if (json.has("_sequence"))
5107      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5108    if (json.has("category"))
5109      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5110    if (json.has("code"))
5111      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5112    Type timing = parseType("timing", json);
5113    if (timing != null)
5114      res.setTiming(timing);
5115    Type value = parseType("value", json);
5116    if (value != null)
5117      res.setValue(value);
5118    if (json.has("reason"))
5119      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
5120  }
5121
5122  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5123    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
5124    parseClaimDiagnosisComponentProperties(json, owner, res);
5125    return res;
5126  }
5127
5128  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
5129    parseBackboneElementProperties(json, res);
5130    if (json.has("sequence"))
5131      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5132    if (json.has("_sequence"))
5133      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5134    Type diagnosis = parseType("diagnosis", json);
5135    if (diagnosis != null)
5136      res.setDiagnosis(diagnosis);
5137    if (json.has("type")) {
5138      JsonArray array = json.getAsJsonArray("type");
5139      for (int i = 0; i < array.size(); i++) {
5140        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5141      }
5142    };
5143    if (json.has("onAdmission"))
5144      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
5145    if (json.has("packageCode"))
5146      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
5147  }
5148
5149  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5150    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
5151    parseClaimProcedureComponentProperties(json, owner, res);
5152    return res;
5153  }
5154
5155  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
5156    parseBackboneElementProperties(json, res);
5157    if (json.has("sequence"))
5158      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5159    if (json.has("_sequence"))
5160      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5161    if (json.has("type")) {
5162      JsonArray array = json.getAsJsonArray("type");
5163      for (int i = 0; i < array.size(); i++) {
5164        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5165      }
5166    };
5167    if (json.has("date"))
5168      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5169    if (json.has("_date"))
5170      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5171    Type procedure = parseType("procedure", json);
5172    if (procedure != null)
5173      res.setProcedure(procedure);
5174    if (json.has("udi")) {
5175      JsonArray array = json.getAsJsonArray("udi");
5176      for (int i = 0; i < array.size(); i++) {
5177        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5178      }
5179    };
5180  }
5181
5182  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5183    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
5184    parseClaimInsuranceComponentProperties(json, owner, res);
5185    return res;
5186  }
5187
5188  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
5189    parseBackboneElementProperties(json, res);
5190    if (json.has("sequence"))
5191      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5192    if (json.has("_sequence"))
5193      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5194    if (json.has("focal"))
5195      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5196    if (json.has("_focal"))
5197      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
5198    if (json.has("identifier"))
5199      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
5200    if (json.has("coverage"))
5201      res.setCoverage(parseReference(getJObject(json, "coverage")));
5202    if (json.has("businessArrangement"))
5203      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5204    if (json.has("_businessArrangement"))
5205      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
5206    if (json.has("preAuthRef")) {
5207      JsonArray array = json.getAsJsonArray("preAuthRef");
5208      for (int i = 0; i < array.size(); i++) {
5209        if (array.get(i).isJsonNull()) {
5210          res.getPreAuthRef().add(new StringType());
5211        } else {
5212          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
5213        }
5214      }
5215    };
5216    if (json.has("_preAuthRef")) {
5217      JsonArray array = json.getAsJsonArray("_preAuthRef");
5218      for (int i = 0; i < array.size(); i++) {
5219        if (i == res.getPreAuthRef().size())
5220          res.getPreAuthRef().add(parseString(null));
5221        if (array.get(i) instanceof JsonObject) 
5222          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
5223      }
5224    };
5225    if (json.has("claimResponse"))
5226      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
5227  }
5228
5229  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5230    Claim.AccidentComponent res = new Claim.AccidentComponent();
5231    parseClaimAccidentComponentProperties(json, owner, res);
5232    return res;
5233  }
5234
5235  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
5236    parseBackboneElementProperties(json, res);
5237    if (json.has("date"))
5238      res.setDateElement(parseDate(json.get("date").getAsString()));
5239    if (json.has("_date"))
5240      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5241    if (json.has("type"))
5242      res.setType(parseCodeableConcept(getJObject(json, "type")));
5243    Type location = parseType("location", json);
5244    if (location != null)
5245      res.setLocation(location);
5246  }
5247
5248  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5249    Claim.ItemComponent res = new Claim.ItemComponent();
5250    parseClaimItemComponentProperties(json, owner, res);
5251    return res;
5252  }
5253
5254  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
5255    parseBackboneElementProperties(json, res);
5256    if (json.has("sequence"))
5257      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5258    if (json.has("_sequence"))
5259      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5260    if (json.has("careTeamSequence")) {
5261      JsonArray array = json.getAsJsonArray("careTeamSequence");
5262      for (int i = 0; i < array.size(); i++) {
5263        if (array.get(i).isJsonNull()) {
5264          res.getCareTeamSequence().add(new PositiveIntType());
5265        } else {
5266          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
5267        }
5268      }
5269    };
5270    if (json.has("_careTeamSequence")) {
5271      JsonArray array = json.getAsJsonArray("_careTeamSequence");
5272      for (int i = 0; i < array.size(); i++) {
5273        if (i == res.getCareTeamSequence().size())
5274          res.getCareTeamSequence().add(parsePositiveInt(null));
5275        if (array.get(i) instanceof JsonObject) 
5276          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
5277      }
5278    };
5279    if (json.has("diagnosisSequence")) {
5280      JsonArray array = json.getAsJsonArray("diagnosisSequence");
5281      for (int i = 0; i < array.size(); i++) {
5282        if (array.get(i).isJsonNull()) {
5283          res.getDiagnosisSequence().add(new PositiveIntType());
5284        } else {
5285          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
5286        }
5287      }
5288    };
5289    if (json.has("_diagnosisSequence")) {
5290      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
5291      for (int i = 0; i < array.size(); i++) {
5292        if (i == res.getDiagnosisSequence().size())
5293          res.getDiagnosisSequence().add(parsePositiveInt(null));
5294        if (array.get(i) instanceof JsonObject) 
5295          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
5296      }
5297    };
5298    if (json.has("procedureSequence")) {
5299      JsonArray array = json.getAsJsonArray("procedureSequence");
5300      for (int i = 0; i < array.size(); i++) {
5301        if (array.get(i).isJsonNull()) {
5302          res.getProcedureSequence().add(new PositiveIntType());
5303        } else {
5304          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
5305        }
5306      }
5307    };
5308    if (json.has("_procedureSequence")) {
5309      JsonArray array = json.getAsJsonArray("_procedureSequence");
5310      for (int i = 0; i < array.size(); i++) {
5311        if (i == res.getProcedureSequence().size())
5312          res.getProcedureSequence().add(parsePositiveInt(null));
5313        if (array.get(i) instanceof JsonObject) 
5314          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
5315      }
5316    };
5317    if (json.has("informationSequence")) {
5318      JsonArray array = json.getAsJsonArray("informationSequence");
5319      for (int i = 0; i < array.size(); i++) {
5320        if (array.get(i).isJsonNull()) {
5321          res.getInformationSequence().add(new PositiveIntType());
5322        } else {
5323          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
5324        }
5325      }
5326    };
5327    if (json.has("_informationSequence")) {
5328      JsonArray array = json.getAsJsonArray("_informationSequence");
5329      for (int i = 0; i < array.size(); i++) {
5330        if (i == res.getInformationSequence().size())
5331          res.getInformationSequence().add(parsePositiveInt(null));
5332        if (array.get(i) instanceof JsonObject) 
5333          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
5334      }
5335    };
5336    if (json.has("revenue"))
5337      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
5338    if (json.has("category"))
5339      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5340    if (json.has("productOrService"))
5341      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5342    if (json.has("modifier")) {
5343      JsonArray array = json.getAsJsonArray("modifier");
5344      for (int i = 0; i < array.size(); i++) {
5345        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5346      }
5347    };
5348    if (json.has("programCode")) {
5349      JsonArray array = json.getAsJsonArray("programCode");
5350      for (int i = 0; i < array.size(); i++) {
5351        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5352      }
5353    };
5354    Type serviced = parseType("serviced", json);
5355    if (serviced != null)
5356      res.setServiced(serviced);
5357    Type location = parseType("location", json);
5358    if (location != null)
5359      res.setLocation(location);
5360    if (json.has("quantity"))
5361      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5362    if (json.has("unitPrice"))
5363      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5364    if (json.has("factor"))
5365      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5366    if (json.has("_factor"))
5367      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5368    if (json.has("net"))
5369      res.setNet(parseMoney(getJObject(json, "net")));
5370    if (json.has("udi")) {
5371      JsonArray array = json.getAsJsonArray("udi");
5372      for (int i = 0; i < array.size(); i++) {
5373        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5374      }
5375    };
5376    if (json.has("bodySite"))
5377      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
5378    if (json.has("subSite")) {
5379      JsonArray array = json.getAsJsonArray("subSite");
5380      for (int i = 0; i < array.size(); i++) {
5381        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5382      }
5383    };
5384    if (json.has("encounter")) {
5385      JsonArray array = json.getAsJsonArray("encounter");
5386      for (int i = 0; i < array.size(); i++) {
5387        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
5388      }
5389    };
5390    if (json.has("detail")) {
5391      JsonArray array = json.getAsJsonArray("detail");
5392      for (int i = 0; i < array.size(); i++) {
5393        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
5394      }
5395    };
5396  }
5397
5398  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5399    Claim.DetailComponent res = new Claim.DetailComponent();
5400    parseClaimDetailComponentProperties(json, owner, res);
5401    return res;
5402  }
5403
5404  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
5405    parseBackboneElementProperties(json, res);
5406    if (json.has("sequence"))
5407      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5408    if (json.has("_sequence"))
5409      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5410    if (json.has("revenue"))
5411      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
5412    if (json.has("category"))
5413      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5414    if (json.has("productOrService"))
5415      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5416    if (json.has("modifier")) {
5417      JsonArray array = json.getAsJsonArray("modifier");
5418      for (int i = 0; i < array.size(); i++) {
5419        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5420      }
5421    };
5422    if (json.has("programCode")) {
5423      JsonArray array = json.getAsJsonArray("programCode");
5424      for (int i = 0; i < array.size(); i++) {
5425        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5426      }
5427    };
5428    if (json.has("quantity"))
5429      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5430    if (json.has("unitPrice"))
5431      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5432    if (json.has("factor"))
5433      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5434    if (json.has("_factor"))
5435      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5436    if (json.has("net"))
5437      res.setNet(parseMoney(getJObject(json, "net")));
5438    if (json.has("udi")) {
5439      JsonArray array = json.getAsJsonArray("udi");
5440      for (int i = 0; i < array.size(); i++) {
5441        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5442      }
5443    };
5444    if (json.has("subDetail")) {
5445      JsonArray array = json.getAsJsonArray("subDetail");
5446      for (int i = 0; i < array.size(); i++) {
5447        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5448      }
5449    };
5450  }
5451
5452  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5453    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
5454    parseClaimSubDetailComponentProperties(json, owner, res);
5455    return res;
5456  }
5457
5458  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
5459    parseBackboneElementProperties(json, res);
5460    if (json.has("sequence"))
5461      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5462    if (json.has("_sequence"))
5463      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
5464    if (json.has("revenue"))
5465      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
5466    if (json.has("category"))
5467      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5468    if (json.has("productOrService"))
5469      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5470    if (json.has("modifier")) {
5471      JsonArray array = json.getAsJsonArray("modifier");
5472      for (int i = 0; i < array.size(); i++) {
5473        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5474      }
5475    };
5476    if (json.has("programCode")) {
5477      JsonArray array = json.getAsJsonArray("programCode");
5478      for (int i = 0; i < array.size(); i++) {
5479        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5480      }
5481    };
5482    if (json.has("quantity"))
5483      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5484    if (json.has("unitPrice"))
5485      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5486    if (json.has("factor"))
5487      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5488    if (json.has("_factor"))
5489      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5490    if (json.has("net"))
5491      res.setNet(parseMoney(getJObject(json, "net")));
5492    if (json.has("udi")) {
5493      JsonArray array = json.getAsJsonArray("udi");
5494      for (int i = 0; i < array.size(); i++) {
5495        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5496      }
5497    };
5498  }
5499
5500  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
5501    ClaimResponse res = new ClaimResponse();
5502    parseClaimResponseProperties(json, res);
5503    return res;
5504  }
5505
5506  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
5507    parseDomainResourceProperties(json, res);
5508    if (json.has("identifier")) {
5509      JsonArray array = json.getAsJsonArray("identifier");
5510      for (int i = 0; i < array.size(); i++) {
5511        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5512      }
5513    };
5514    if (json.has("status"))
5515      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
5516    if (json.has("_status"))
5517      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5518    if (json.has("type"))
5519      res.setType(parseCodeableConcept(getJObject(json, "type")));
5520    if (json.has("subType"))
5521      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
5522    if (json.has("use"))
5523      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ClaimResponse.Use.NULL, new ClaimResponse.UseEnumFactory()));
5524    if (json.has("_use"))
5525      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
5526    if (json.has("patient"))
5527      res.setPatient(parseReference(getJObject(json, "patient")));
5528    if (json.has("created"))
5529      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5530    if (json.has("_created"))
5531      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
5532    if (json.has("insurer"))
5533      res.setInsurer(parseReference(getJObject(json, "insurer")));
5534    if (json.has("requestor"))
5535      res.setRequestor(parseReference(getJObject(json, "requestor")));
5536    if (json.has("request"))
5537      res.setRequest(parseReference(getJObject(json, "request")));
5538    if (json.has("outcome"))
5539      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ClaimResponse.RemittanceOutcome.NULL, new ClaimResponse.RemittanceOutcomeEnumFactory()));
5540    if (json.has("_outcome"))
5541      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
5542    if (json.has("disposition"))
5543      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5544    if (json.has("_disposition"))
5545      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
5546    if (json.has("preAuthRef"))
5547      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
5548    if (json.has("_preAuthRef"))
5549      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
5550    if (json.has("preAuthPeriod"))
5551      res.setPreAuthPeriod(parsePeriod(getJObject(json, "preAuthPeriod")));
5552    if (json.has("payeeType"))
5553      res.setPayeeType(parseCodeableConcept(getJObject(json, "payeeType")));
5554    if (json.has("item")) {
5555      JsonArray array = json.getAsJsonArray("item");
5556      for (int i = 0; i < array.size(); i++) {
5557        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
5558      }
5559    };
5560    if (json.has("addItem")) {
5561      JsonArray array = json.getAsJsonArray("addItem");
5562      for (int i = 0; i < array.size(); i++) {
5563        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
5564      }
5565    };
5566    if (json.has("adjudication")) {
5567      JsonArray array = json.getAsJsonArray("adjudication");
5568      for (int i = 0; i < array.size(); i++) {
5569        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), res));
5570      }
5571    };
5572    if (json.has("total")) {
5573      JsonArray array = json.getAsJsonArray("total");
5574      for (int i = 0; i < array.size(); i++) {
5575        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject(), res));
5576      }
5577    };
5578    if (json.has("payment"))
5579      res.setPayment(parseClaimResponsePaymentComponent(getJObject(json, "payment"), res));
5580    if (json.has("fundsReserve"))
5581      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
5582    if (json.has("formCode"))
5583      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
5584    if (json.has("form"))
5585      res.setForm(parseAttachment(getJObject(json, "form")));
5586    if (json.has("processNote")) {
5587      JsonArray array = json.getAsJsonArray("processNote");
5588      for (int i = 0; i < array.size(); i++) {
5589        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
5590      }
5591    };
5592    if (json.has("communicationRequest")) {
5593      JsonArray array = json.getAsJsonArray("communicationRequest");
5594      for (int i = 0; i < array.size(); i++) {
5595        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
5596      }
5597    };
5598    if (json.has("insurance")) {
5599      JsonArray array = json.getAsJsonArray("insurance");
5600      for (int i = 0; i < array.size(); i++) {
5601        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
5602      }
5603    };
5604    if (json.has("error")) {
5605      JsonArray array = json.getAsJsonArray("error");
5606      for (int i = 0; i < array.size(); i++) {
5607        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
5608      }
5609    };
5610  }
5611
5612  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5613    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
5614    parseClaimResponseItemComponentProperties(json, owner, res);
5615    return res;
5616  }
5617
5618  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
5619    parseBackboneElementProperties(json, res);
5620    if (json.has("itemSequence"))
5621      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5622    if (json.has("_itemSequence"))
5623      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
5624    if (json.has("noteNumber")) {
5625      JsonArray array = json.getAsJsonArray("noteNumber");
5626      for (int i = 0; i < array.size(); i++) {
5627        if (array.get(i).isJsonNull()) {
5628          res.getNoteNumber().add(new PositiveIntType());
5629        } else {
5630          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5631        }
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(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5653      }
5654    };
5655  }
5656
5657  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5658    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
5659    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
5660    return res;
5661  }
5662
5663  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
5664    parseBackboneElementProperties(json, res);
5665    if (json.has("category"))
5666      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
5667    if (json.has("reason"))
5668      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
5669    if (json.has("amount"))
5670      res.setAmount(parseMoney(getJObject(json, "amount")));
5671    if (json.has("value"))
5672      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
5673    if (json.has("_value"))
5674      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
5675  }
5676
5677  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5678    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
5679    parseClaimResponseItemDetailComponentProperties(json, owner, res);
5680    return res;
5681  }
5682
5683  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
5684    parseBackboneElementProperties(json, res);
5685    if (json.has("detailSequence"))
5686      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5687    if (json.has("_detailSequence"))
5688      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
5689    if (json.has("noteNumber")) {
5690      JsonArray array = json.getAsJsonArray("noteNumber");
5691      for (int i = 0; i < array.size(); i++) {
5692        if (array.get(i).isJsonNull()) {
5693          res.getNoteNumber().add(new PositiveIntType());
5694        } else {
5695          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5696        }
5697      }
5698    };
5699    if (json.has("_noteNumber")) {
5700      JsonArray array = json.getAsJsonArray("_noteNumber");
5701      for (int i = 0; i < array.size(); i++) {
5702        if (i == res.getNoteNumber().size())
5703          res.getNoteNumber().add(parsePositiveInt(null));
5704        if (array.get(i) instanceof JsonObject) 
5705          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5706      }
5707    };
5708    if (json.has("adjudication")) {
5709      JsonArray array = json.getAsJsonArray("adjudication");
5710      for (int i = 0; i < array.size(); i++) {
5711        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5712      }
5713    };
5714    if (json.has("subDetail")) {
5715      JsonArray array = json.getAsJsonArray("subDetail");
5716      for (int i = 0; i < array.size(); i++) {
5717        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5718      }
5719    };
5720  }
5721
5722  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5723    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
5724    parseClaimResponseSubDetailComponentProperties(json, owner, res);
5725    return res;
5726  }
5727
5728  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
5729    parseBackboneElementProperties(json, res);
5730    if (json.has("subDetailSequence"))
5731      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5732    if (json.has("_subDetailSequence"))
5733      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
5734    if (json.has("noteNumber")) {
5735      JsonArray array = json.getAsJsonArray("noteNumber");
5736      for (int i = 0; i < array.size(); i++) {
5737        if (array.get(i).isJsonNull()) {
5738          res.getNoteNumber().add(new PositiveIntType());
5739        } else {
5740          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5741        }
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.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5762    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
5763    parseClaimResponseAddedItemComponentProperties(json, owner, res);
5764    return res;
5765  }
5766
5767  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
5768    parseBackboneElementProperties(json, res);
5769    if (json.has("itemSequence")) {
5770      JsonArray array = json.getAsJsonArray("itemSequence");
5771      for (int i = 0; i < array.size(); i++) {
5772        if (array.get(i).isJsonNull()) {
5773          res.getItemSequence().add(new PositiveIntType());
5774        } else {
5775          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
5776        }
5777      }
5778    };
5779    if (json.has("_itemSequence")) {
5780      JsonArray array = json.getAsJsonArray("_itemSequence");
5781      for (int i = 0; i < array.size(); i++) {
5782        if (i == res.getItemSequence().size())
5783          res.getItemSequence().add(parsePositiveInt(null));
5784        if (array.get(i) instanceof JsonObject) 
5785          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
5786      }
5787    };
5788    if (json.has("detailSequence")) {
5789      JsonArray array = json.getAsJsonArray("detailSequence");
5790      for (int i = 0; i < array.size(); i++) {
5791        if (array.get(i).isJsonNull()) {
5792          res.getDetailSequence().add(new PositiveIntType());
5793        } else {
5794          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5795        }
5796      }
5797    };
5798    if (json.has("_detailSequence")) {
5799      JsonArray array = json.getAsJsonArray("_detailSequence");
5800      for (int i = 0; i < array.size(); i++) {
5801        if (i == res.getDetailSequence().size())
5802          res.getDetailSequence().add(parsePositiveInt(null));
5803        if (array.get(i) instanceof JsonObject) 
5804          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
5805      }
5806    };
5807    if (json.has("subdetailSequence")) {
5808      JsonArray array = json.getAsJsonArray("subdetailSequence");
5809      for (int i = 0; i < array.size(); i++) {
5810        if (array.get(i).isJsonNull()) {
5811          res.getSubdetailSequence().add(new PositiveIntType());
5812        } else {
5813          res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5814        }
5815      }
5816    };
5817    if (json.has("_subdetailSequence")) {
5818      JsonArray array = json.getAsJsonArray("_subdetailSequence");
5819      for (int i = 0; i < array.size(); i++) {
5820        if (i == res.getSubdetailSequence().size())
5821          res.getSubdetailSequence().add(parsePositiveInt(null));
5822        if (array.get(i) instanceof JsonObject) 
5823          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
5824      }
5825    };
5826    if (json.has("provider")) {
5827      JsonArray array = json.getAsJsonArray("provider");
5828      for (int i = 0; i < array.size(); i++) {
5829        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
5830      }
5831    };
5832    if (json.has("productOrService"))
5833      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5834    if (json.has("modifier")) {
5835      JsonArray array = json.getAsJsonArray("modifier");
5836      for (int i = 0; i < array.size(); i++) {
5837        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5838      }
5839    };
5840    if (json.has("programCode")) {
5841      JsonArray array = json.getAsJsonArray("programCode");
5842      for (int i = 0; i < array.size(); i++) {
5843        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5844      }
5845    };
5846    Type serviced = parseType("serviced", json);
5847    if (serviced != null)
5848      res.setServiced(serviced);
5849    Type location = parseType("location", json);
5850    if (location != null)
5851      res.setLocation(location);
5852    if (json.has("quantity"))
5853      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5854    if (json.has("unitPrice"))
5855      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5856    if (json.has("factor"))
5857      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5858    if (json.has("_factor"))
5859      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5860    if (json.has("net"))
5861      res.setNet(parseMoney(getJObject(json, "net")));
5862    if (json.has("bodySite"))
5863      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
5864    if (json.has("subSite")) {
5865      JsonArray array = json.getAsJsonArray("subSite");
5866      for (int i = 0; i < array.size(); i++) {
5867        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5868      }
5869    };
5870    if (json.has("noteNumber")) {
5871      JsonArray array = json.getAsJsonArray("noteNumber");
5872      for (int i = 0; i < array.size(); i++) {
5873        if (array.get(i).isJsonNull()) {
5874          res.getNoteNumber().add(new PositiveIntType());
5875        } else {
5876          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5877        }
5878      }
5879    };
5880    if (json.has("_noteNumber")) {
5881      JsonArray array = json.getAsJsonArray("_noteNumber");
5882      for (int i = 0; i < array.size(); i++) {
5883        if (i == res.getNoteNumber().size())
5884          res.getNoteNumber().add(parsePositiveInt(null));
5885        if (array.get(i) instanceof JsonObject) 
5886          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5887      }
5888    };
5889    if (json.has("adjudication")) {
5890      JsonArray array = json.getAsJsonArray("adjudication");
5891      for (int i = 0; i < array.size(); i++) {
5892        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5893      }
5894    };
5895    if (json.has("detail")) {
5896      JsonArray array = json.getAsJsonArray("detail");
5897      for (int i = 0; i < array.size(); i++) {
5898        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5899      }
5900    };
5901  }
5902
5903  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5904    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
5905    parseClaimResponseAddedItemDetailComponentProperties(json, owner, res);
5906    return res;
5907  }
5908
5909  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
5910    parseBackboneElementProperties(json, res);
5911    if (json.has("productOrService"))
5912      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5913    if (json.has("modifier")) {
5914      JsonArray array = json.getAsJsonArray("modifier");
5915      for (int i = 0; i < array.size(); i++) {
5916        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5917      }
5918    };
5919    if (json.has("quantity"))
5920      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5921    if (json.has("unitPrice"))
5922      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5923    if (json.has("factor"))
5924      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5925    if (json.has("_factor"))
5926      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5927    if (json.has("net"))
5928      res.setNet(parseMoney(getJObject(json, "net")));
5929    if (json.has("noteNumber")) {
5930      JsonArray array = json.getAsJsonArray("noteNumber");
5931      for (int i = 0; i < array.size(); i++) {
5932        if (array.get(i).isJsonNull()) {
5933          res.getNoteNumber().add(new PositiveIntType());
5934        } else {
5935          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5936        }
5937      }
5938    };
5939    if (json.has("_noteNumber")) {
5940      JsonArray array = json.getAsJsonArray("_noteNumber");
5941      for (int i = 0; i < array.size(); i++) {
5942        if (i == res.getNoteNumber().size())
5943          res.getNoteNumber().add(parsePositiveInt(null));
5944        if (array.get(i) instanceof JsonObject) 
5945          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5946      }
5947    };
5948    if (json.has("adjudication")) {
5949      JsonArray array = json.getAsJsonArray("adjudication");
5950      for (int i = 0; i < array.size(); i++) {
5951        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5952      }
5953    };
5954    if (json.has("subDetail")) {
5955      JsonArray array = json.getAsJsonArray("subDetail");
5956      for (int i = 0; i < array.size(); i++) {
5957        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5958      }
5959    };
5960  }
5961
5962  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5963    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
5964    parseClaimResponseAddedItemSubDetailComponentProperties(json, owner, res);
5965    return res;
5966  }
5967
5968  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
5969    parseBackboneElementProperties(json, res);
5970    if (json.has("productOrService"))
5971      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
5972    if (json.has("modifier")) {
5973      JsonArray array = json.getAsJsonArray("modifier");
5974      for (int i = 0; i < array.size(); i++) {
5975        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5976      }
5977    };
5978    if (json.has("quantity"))
5979      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
5980    if (json.has("unitPrice"))
5981      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
5982    if (json.has("factor"))
5983      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5984    if (json.has("_factor"))
5985      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
5986    if (json.has("net"))
5987      res.setNet(parseMoney(getJObject(json, "net")));
5988    if (json.has("noteNumber")) {
5989      JsonArray array = json.getAsJsonArray("noteNumber");
5990      for (int i = 0; i < array.size(); i++) {
5991        if (array.get(i).isJsonNull()) {
5992          res.getNoteNumber().add(new PositiveIntType());
5993        } else {
5994          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5995        }
5996      }
5997    };
5998    if (json.has("_noteNumber")) {
5999      JsonArray array = json.getAsJsonArray("_noteNumber");
6000      for (int i = 0; i < array.size(); i++) {
6001        if (i == res.getNoteNumber().size())
6002          res.getNoteNumber().add(parsePositiveInt(null));
6003        if (array.get(i) instanceof JsonObject) 
6004          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
6005      }
6006    };
6007    if (json.has("adjudication")) {
6008      JsonArray array = json.getAsJsonArray("adjudication");
6009      for (int i = 0; i < array.size(); i++) {
6010        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
6011      }
6012    };
6013  }
6014
6015  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6016    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
6017    parseClaimResponseTotalComponentProperties(json, owner, res);
6018    return res;
6019  }
6020
6021  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
6022    parseBackboneElementProperties(json, res);
6023    if (json.has("category"))
6024      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
6025    if (json.has("amount"))
6026      res.setAmount(parseMoney(getJObject(json, "amount")));
6027  }
6028
6029  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6030    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
6031    parseClaimResponsePaymentComponentProperties(json, owner, res);
6032    return res;
6033  }
6034
6035  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
6036    parseBackboneElementProperties(json, res);
6037    if (json.has("type"))
6038      res.setType(parseCodeableConcept(getJObject(json, "type")));
6039    if (json.has("adjustment"))
6040      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
6041    if (json.has("adjustmentReason"))
6042      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
6043    if (json.has("date"))
6044      res.setDateElement(parseDate(json.get("date").getAsString()));
6045    if (json.has("_date"))
6046      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6047    if (json.has("amount"))
6048      res.setAmount(parseMoney(getJObject(json, "amount")));
6049    if (json.has("identifier"))
6050      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6051  }
6052
6053  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6054    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
6055    parseClaimResponseNoteComponentProperties(json, owner, res);
6056    return res;
6057  }
6058
6059  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
6060    parseBackboneElementProperties(json, res);
6061    if (json.has("number"))
6062      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
6063    if (json.has("_number"))
6064      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
6065    if (json.has("type"))
6066      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
6067    if (json.has("_type"))
6068      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
6069    if (json.has("text"))
6070      res.setTextElement(parseString(json.get("text").getAsString()));
6071    if (json.has("_text"))
6072      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6073    if (json.has("language"))
6074      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
6075  }
6076
6077  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6078    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
6079    parseClaimResponseInsuranceComponentProperties(json, owner, res);
6080    return res;
6081  }
6082
6083  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
6084    parseBackboneElementProperties(json, res);
6085    if (json.has("sequence"))
6086      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
6087    if (json.has("_sequence"))
6088      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6089    if (json.has("focal"))
6090      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
6091    if (json.has("_focal"))
6092      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
6093    if (json.has("coverage"))
6094      res.setCoverage(parseReference(getJObject(json, "coverage")));
6095    if (json.has("businessArrangement"))
6096      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
6097    if (json.has("_businessArrangement"))
6098      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
6099    if (json.has("claimResponse"))
6100      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
6101  }
6102
6103  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
6104    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
6105    parseClaimResponseErrorComponentProperties(json, owner, res);
6106    return res;
6107  }
6108
6109  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
6110    parseBackboneElementProperties(json, res);
6111    if (json.has("itemSequence"))
6112      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
6113    if (json.has("_itemSequence"))
6114      parseElementProperties(getJObject(json, "_itemSequence"), res.getItemSequenceElement());
6115    if (json.has("detailSequence"))
6116      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
6117    if (json.has("_detailSequence"))
6118      parseElementProperties(getJObject(json, "_detailSequence"), res.getDetailSequenceElement());
6119    if (json.has("subDetailSequence"))
6120      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
6121    if (json.has("_subDetailSequence"))
6122      parseElementProperties(getJObject(json, "_subDetailSequence"), res.getSubDetailSequenceElement());
6123    if (json.has("code"))
6124      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6125  }
6126
6127  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
6128    ClinicalImpression res = new ClinicalImpression();
6129    parseClinicalImpressionProperties(json, res);
6130    return res;
6131  }
6132
6133  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
6134    parseDomainResourceProperties(json, res);
6135    if (json.has("identifier")) {
6136      JsonArray array = json.getAsJsonArray("identifier");
6137      for (int i = 0; i < array.size(); i++) {
6138        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6139      }
6140    };
6141    if (json.has("status"))
6142      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
6143    if (json.has("_status"))
6144      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6145    if (json.has("statusReason"))
6146      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
6147    if (json.has("code"))
6148      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6149    if (json.has("description"))
6150      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6151    if (json.has("_description"))
6152      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6153    if (json.has("subject"))
6154      res.setSubject(parseReference(getJObject(json, "subject")));
6155    if (json.has("encounter"))
6156      res.setEncounter(parseReference(getJObject(json, "encounter")));
6157    Type effective = parseType("effective", json);
6158    if (effective != null)
6159      res.setEffective(effective);
6160    if (json.has("date"))
6161      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6162    if (json.has("_date"))
6163      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6164    if (json.has("assessor"))
6165      res.setAssessor(parseReference(getJObject(json, "assessor")));
6166    if (json.has("previous"))
6167      res.setPrevious(parseReference(getJObject(json, "previous")));
6168    if (json.has("problem")) {
6169      JsonArray array = json.getAsJsonArray("problem");
6170      for (int i = 0; i < array.size(); i++) {
6171        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
6172      }
6173    };
6174    if (json.has("investigation")) {
6175      JsonArray array = json.getAsJsonArray("investigation");
6176      for (int i = 0; i < array.size(); i++) {
6177        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
6178      }
6179    };
6180    if (json.has("protocol")) {
6181      JsonArray array = json.getAsJsonArray("protocol");
6182      for (int i = 0; i < array.size(); i++) {
6183        if (array.get(i).isJsonNull()) {
6184          res.getProtocol().add(new UriType());
6185        } else {
6186          res.getProtocol().add(parseUri(array.get(i).getAsString()));
6187        }
6188      }
6189    };
6190    if (json.has("_protocol")) {
6191      JsonArray array = json.getAsJsonArray("_protocol");
6192      for (int i = 0; i < array.size(); i++) {
6193        if (i == res.getProtocol().size())
6194          res.getProtocol().add(parseUri(null));
6195        if (array.get(i) instanceof JsonObject) 
6196          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
6197      }
6198    };
6199    if (json.has("summary"))
6200      res.setSummaryElement(parseString(json.get("summary").getAsString()));
6201    if (json.has("_summary"))
6202      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
6203    if (json.has("finding")) {
6204      JsonArray array = json.getAsJsonArray("finding");
6205      for (int i = 0; i < array.size(); i++) {
6206        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
6207      }
6208    };
6209    if (json.has("prognosisCodeableConcept")) {
6210      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
6211      for (int i = 0; i < array.size(); i++) {
6212        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6213      }
6214    };
6215    if (json.has("prognosisReference")) {
6216      JsonArray array = json.getAsJsonArray("prognosisReference");
6217      for (int i = 0; i < array.size(); i++) {
6218        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
6219      }
6220    };
6221    if (json.has("supportingInfo")) {
6222      JsonArray array = json.getAsJsonArray("supportingInfo");
6223      for (int i = 0; i < array.size(); i++) {
6224        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
6225      }
6226    };
6227    if (json.has("note")) {
6228      JsonArray array = json.getAsJsonArray("note");
6229      for (int i = 0; i < array.size(); i++) {
6230        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6231      }
6232    };
6233  }
6234
6235  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6236    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
6237    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
6238    return res;
6239  }
6240
6241  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
6242    parseBackboneElementProperties(json, res);
6243    if (json.has("code"))
6244      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6245    if (json.has("item")) {
6246      JsonArray array = json.getAsJsonArray("item");
6247      for (int i = 0; i < array.size(); i++) {
6248        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
6249      }
6250    };
6251  }
6252
6253  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6254    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
6255    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
6256    return res;
6257  }
6258
6259  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
6260    parseBackboneElementProperties(json, res);
6261    if (json.has("itemCodeableConcept"))
6262      res.setItemCodeableConcept(parseCodeableConcept(getJObject(json, "itemCodeableConcept")));
6263    if (json.has("itemReference"))
6264      res.setItemReference(parseReference(getJObject(json, "itemReference")));
6265    if (json.has("basis"))
6266      res.setBasisElement(parseString(json.get("basis").getAsString()));
6267    if (json.has("_basis"))
6268      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
6269  }
6270
6271  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
6272    CodeSystem res = new CodeSystem();
6273    parseCodeSystemProperties(json, res);
6274    return res;
6275  }
6276
6277  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
6278    parseDomainResourceProperties(json, res);
6279    if (json.has("url"))
6280      res.setUrlElement(parseUri(json.get("url").getAsString()));
6281    if (json.has("_url"))
6282      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6283    if (json.has("identifier")) {
6284      JsonArray array = json.getAsJsonArray("identifier");
6285      for (int i = 0; i < array.size(); i++) {
6286        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6287      }
6288    };
6289    if (json.has("version"))
6290      res.setVersionElement(parseString(json.get("version").getAsString()));
6291    if (json.has("_version"))
6292      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
6293    if (json.has("name"))
6294      res.setNameElement(parseString(json.get("name").getAsString()));
6295    if (json.has("_name"))
6296      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
6297    if (json.has("title"))
6298      res.setTitleElement(parseString(json.get("title").getAsString()));
6299    if (json.has("_title"))
6300      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6301    if (json.has("status"))
6302      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6303    if (json.has("_status"))
6304      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6305    if (json.has("experimental"))
6306      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6307    if (json.has("_experimental"))
6308      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
6309    if (json.has("date"))
6310      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6311    if (json.has("_date"))
6312      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6313    if (json.has("publisher"))
6314      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6315    if (json.has("_publisher"))
6316      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
6317    if (json.has("contact")) {
6318      JsonArray array = json.getAsJsonArray("contact");
6319      for (int i = 0; i < array.size(); i++) {
6320        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6321      }
6322    };
6323    if (json.has("description"))
6324      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6325    if (json.has("_description"))
6326      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6327    if (json.has("useContext")) {
6328      JsonArray array = json.getAsJsonArray("useContext");
6329      for (int i = 0; i < array.size(); i++) {
6330        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6331      }
6332    };
6333    if (json.has("jurisdiction")) {
6334      JsonArray array = json.getAsJsonArray("jurisdiction");
6335      for (int i = 0; i < array.size(); i++) {
6336        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6337      }
6338    };
6339    if (json.has("purpose"))
6340      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6341    if (json.has("_purpose"))
6342      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
6343    if (json.has("copyright"))
6344      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6345    if (json.has("_copyright"))
6346      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6347    if (json.has("caseSensitive"))
6348      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
6349    if (json.has("_caseSensitive"))
6350      parseElementProperties(getJObject(json, "_caseSensitive"), res.getCaseSensitiveElement());
6351    if (json.has("valueSet"))
6352      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
6353    if (json.has("_valueSet"))
6354      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
6355    if (json.has("hierarchyMeaning"))
6356      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
6357    if (json.has("_hierarchyMeaning"))
6358      parseElementProperties(getJObject(json, "_hierarchyMeaning"), res.getHierarchyMeaningElement());
6359    if (json.has("compositional"))
6360      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
6361    if (json.has("_compositional"))
6362      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
6363    if (json.has("versionNeeded"))
6364      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
6365    if (json.has("_versionNeeded"))
6366      parseElementProperties(getJObject(json, "_versionNeeded"), res.getVersionNeededElement());
6367    if (json.has("content"))
6368      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
6369    if (json.has("_content"))
6370      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
6371    if (json.has("supplements"))
6372      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
6373    if (json.has("_supplements"))
6374      parseElementProperties(getJObject(json, "_supplements"), res.getSupplementsElement());
6375    if (json.has("count"))
6376      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
6377    if (json.has("_count"))
6378      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
6379    if (json.has("filter")) {
6380      JsonArray array = json.getAsJsonArray("filter");
6381      for (int i = 0; i < array.size(); i++) {
6382        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
6383      }
6384    };
6385    if (json.has("property")) {
6386      JsonArray array = json.getAsJsonArray("property");
6387      for (int i = 0; i < array.size(); i++) {
6388        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
6389      }
6390    };
6391    if (json.has("concept")) {
6392      JsonArray array = json.getAsJsonArray("concept");
6393      for (int i = 0; i < array.size(); i++) {
6394        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
6395      }
6396    };
6397  }
6398
6399  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6400    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
6401    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
6402    return res;
6403  }
6404
6405  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
6406    parseBackboneElementProperties(json, res);
6407    if (json.has("code"))
6408      res.setCodeElement(parseCode(json.get("code").getAsString()));
6409    if (json.has("_code"))
6410      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6411    if (json.has("description"))
6412      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6413    if (json.has("_description"))
6414      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6415    if (json.has("operator")) {
6416      JsonArray array = json.getAsJsonArray("operator");
6417      for (int i = 0; i < array.size(); i++) {
6418        if (array.get(i).isJsonNull()) {
6419          res.getOperator().add(new Enumeration<CodeSystem.FilterOperator>());
6420        } else {
6421          res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
6422        }
6423      }
6424    };
6425    if (json.has("_operator")) {
6426      JsonArray array = json.getAsJsonArray("_operator");
6427      for (int i = 0; i < array.size(); i++) {
6428        if (i == res.getOperator().size())
6429          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
6430        if (array.get(i) instanceof JsonObject) 
6431          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
6432      }
6433    };
6434    if (json.has("value"))
6435      res.setValueElement(parseString(json.get("value").getAsString()));
6436    if (json.has("_value"))
6437      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6438  }
6439
6440  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6441    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
6442    parseCodeSystemPropertyComponentProperties(json, owner, res);
6443    return res;
6444  }
6445
6446  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
6447    parseBackboneElementProperties(json, res);
6448    if (json.has("code"))
6449      res.setCodeElement(parseCode(json.get("code").getAsString()));
6450    if (json.has("_code"))
6451      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6452    if (json.has("uri"))
6453      res.setUriElement(parseUri(json.get("uri").getAsString()));
6454    if (json.has("_uri"))
6455      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
6456    if (json.has("description"))
6457      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6458    if (json.has("_description"))
6459      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6460    if (json.has("type"))
6461      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
6462    if (json.has("_type"))
6463      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
6464  }
6465
6466  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6467    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
6468    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
6469    return res;
6470  }
6471
6472  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
6473    parseBackboneElementProperties(json, res);
6474    if (json.has("code"))
6475      res.setCodeElement(parseCode(json.get("code").getAsString()));
6476    if (json.has("_code"))
6477      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6478    if (json.has("display"))
6479      res.setDisplayElement(parseString(json.get("display").getAsString()));
6480    if (json.has("_display"))
6481      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6482    if (json.has("definition"))
6483      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
6484    if (json.has("_definition"))
6485      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
6486    if (json.has("designation")) {
6487      JsonArray array = json.getAsJsonArray("designation");
6488      for (int i = 0; i < array.size(); i++) {
6489        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
6490      }
6491    };
6492    if (json.has("property")) {
6493      JsonArray array = json.getAsJsonArray("property");
6494      for (int i = 0; i < array.size(); i++) {
6495        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
6496      }
6497    };
6498    if (json.has("concept")) {
6499      JsonArray array = json.getAsJsonArray("concept");
6500      for (int i = 0; i < array.size(); i++) {
6501        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
6502      }
6503    };
6504  }
6505
6506  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6507    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
6508    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
6509    return res;
6510  }
6511
6512  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
6513    parseBackboneElementProperties(json, res);
6514    if (json.has("language"))
6515      res.setLanguageElement(parseCode(json.get("language").getAsString()));
6516    if (json.has("_language"))
6517      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
6518    if (json.has("use"))
6519      res.setUse(parseCoding(getJObject(json, "use")));
6520    if (json.has("value"))
6521      res.setValueElement(parseString(json.get("value").getAsString()));
6522    if (json.has("_value"))
6523      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
6524  }
6525
6526  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6527    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
6528    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
6529    return res;
6530  }
6531
6532  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
6533    parseBackboneElementProperties(json, res);
6534    if (json.has("code"))
6535      res.setCodeElement(parseCode(json.get("code").getAsString()));
6536    if (json.has("_code"))
6537      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6538    Type value = parseType("value", json);
6539    if (value != null)
6540      res.setValue(value);
6541  }
6542
6543  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
6544    Communication res = new Communication();
6545    parseCommunicationProperties(json, res);
6546    return res;
6547  }
6548
6549  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
6550    parseDomainResourceProperties(json, res);
6551    if (json.has("identifier")) {
6552      JsonArray array = json.getAsJsonArray("identifier");
6553      for (int i = 0; i < array.size(); i++) {
6554        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6555      }
6556    };
6557    if (json.has("instantiatesCanonical")) {
6558      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
6559      for (int i = 0; i < array.size(); i++) {
6560        if (array.get(i).isJsonNull()) {
6561          res.getInstantiatesCanonical().add(new CanonicalType());
6562        } else {
6563          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
6564        }
6565      }
6566    };
6567    if (json.has("_instantiatesCanonical")) {
6568      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
6569      for (int i = 0; i < array.size(); i++) {
6570        if (i == res.getInstantiatesCanonical().size())
6571          res.getInstantiatesCanonical().add(parseCanonical(null));
6572        if (array.get(i) instanceof JsonObject) 
6573          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
6574      }
6575    };
6576    if (json.has("instantiatesUri")) {
6577      JsonArray array = json.getAsJsonArray("instantiatesUri");
6578      for (int i = 0; i < array.size(); i++) {
6579        if (array.get(i).isJsonNull()) {
6580          res.getInstantiatesUri().add(new UriType());
6581        } else {
6582          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
6583        }
6584      }
6585    };
6586    if (json.has("_instantiatesUri")) {
6587      JsonArray array = json.getAsJsonArray("_instantiatesUri");
6588      for (int i = 0; i < array.size(); i++) {
6589        if (i == res.getInstantiatesUri().size())
6590          res.getInstantiatesUri().add(parseUri(null));
6591        if (array.get(i) instanceof JsonObject) 
6592          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
6593      }
6594    };
6595    if (json.has("basedOn")) {
6596      JsonArray array = json.getAsJsonArray("basedOn");
6597      for (int i = 0; i < array.size(); i++) {
6598        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
6599      }
6600    };
6601    if (json.has("partOf")) {
6602      JsonArray array = json.getAsJsonArray("partOf");
6603      for (int i = 0; i < array.size(); i++) {
6604        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
6605      }
6606    };
6607    if (json.has("inResponseTo")) {
6608      JsonArray array = json.getAsJsonArray("inResponseTo");
6609      for (int i = 0; i < array.size(); i++) {
6610        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
6611      }
6612    };
6613    if (json.has("status"))
6614      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
6615    if (json.has("_status"))
6616      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6617    if (json.has("statusReason"))
6618      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
6619    if (json.has("category")) {
6620      JsonArray array = json.getAsJsonArray("category");
6621      for (int i = 0; i < array.size(); i++) {
6622        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6623      }
6624    };
6625    if (json.has("priority"))
6626      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Communication.CommunicationPriority.NULL, new Communication.CommunicationPriorityEnumFactory()));
6627    if (json.has("_priority"))
6628      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
6629    if (json.has("medium")) {
6630      JsonArray array = json.getAsJsonArray("medium");
6631      for (int i = 0; i < array.size(); i++) {
6632        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6633      }
6634    };
6635    if (json.has("subject"))
6636      res.setSubject(parseReference(getJObject(json, "subject")));
6637    if (json.has("topic"))
6638      res.setTopic(parseCodeableConcept(getJObject(json, "topic")));
6639    if (json.has("about")) {
6640      JsonArray array = json.getAsJsonArray("about");
6641      for (int i = 0; i < array.size(); i++) {
6642        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
6643      }
6644    };
6645    if (json.has("encounter"))
6646      res.setEncounter(parseReference(getJObject(json, "encounter")));
6647    if (json.has("sent"))
6648      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
6649    if (json.has("_sent"))
6650      parseElementProperties(getJObject(json, "_sent"), res.getSentElement());
6651    if (json.has("received"))
6652      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
6653    if (json.has("_received"))
6654      parseElementProperties(getJObject(json, "_received"), res.getReceivedElement());
6655    if (json.has("recipient")) {
6656      JsonArray array = json.getAsJsonArray("recipient");
6657      for (int i = 0; i < array.size(); i++) {
6658        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6659      }
6660    };
6661    if (json.has("sender"))
6662      res.setSender(parseReference(getJObject(json, "sender")));
6663    if (json.has("reasonCode")) {
6664      JsonArray array = json.getAsJsonArray("reasonCode");
6665      for (int i = 0; i < array.size(); i++) {
6666        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6667      }
6668    };
6669    if (json.has("reasonReference")) {
6670      JsonArray array = json.getAsJsonArray("reasonReference");
6671      for (int i = 0; i < array.size(); i++) {
6672        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
6673      }
6674    };
6675    if (json.has("payload")) {
6676      JsonArray array = json.getAsJsonArray("payload");
6677      for (int i = 0; i < array.size(); i++) {
6678        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
6679      }
6680    };
6681    if (json.has("note")) {
6682      JsonArray array = json.getAsJsonArray("note");
6683      for (int i = 0; i < array.size(); i++) {
6684        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6685      }
6686    };
6687  }
6688
6689  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
6690    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
6691    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
6692    return res;
6693  }
6694
6695  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
6696    parseBackboneElementProperties(json, res);
6697    Type content = parseType("content", json);
6698    if (content != null)
6699      res.setContent(content);
6700  }
6701
6702  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
6703    CommunicationRequest res = new CommunicationRequest();
6704    parseCommunicationRequestProperties(json, res);
6705    return res;
6706  }
6707
6708  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
6709    parseDomainResourceProperties(json, res);
6710    if (json.has("identifier")) {
6711      JsonArray array = json.getAsJsonArray("identifier");
6712      for (int i = 0; i < array.size(); i++) {
6713        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6714      }
6715    };
6716    if (json.has("basedOn")) {
6717      JsonArray array = json.getAsJsonArray("basedOn");
6718      for (int i = 0; i < array.size(); i++) {
6719        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
6720      }
6721    };
6722    if (json.has("replaces")) {
6723      JsonArray array = json.getAsJsonArray("replaces");
6724      for (int i = 0; i < array.size(); i++) {
6725        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
6726      }
6727    };
6728    if (json.has("groupIdentifier"))
6729      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
6730    if (json.has("status"))
6731      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
6732    if (json.has("_status"))
6733      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6734    if (json.has("statusReason"))
6735      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
6736    if (json.has("category")) {
6737      JsonArray array = json.getAsJsonArray("category");
6738      for (int i = 0; i < array.size(); i++) {
6739        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6740      }
6741    };
6742    if (json.has("priority"))
6743      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
6744    if (json.has("_priority"))
6745      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
6746    if (json.has("doNotPerform"))
6747      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
6748    if (json.has("_doNotPerform"))
6749      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
6750    if (json.has("medium")) {
6751      JsonArray array = json.getAsJsonArray("medium");
6752      for (int i = 0; i < array.size(); i++) {
6753        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6754      }
6755    };
6756    if (json.has("subject"))
6757      res.setSubject(parseReference(getJObject(json, "subject")));
6758    if (json.has("about")) {
6759      JsonArray array = json.getAsJsonArray("about");
6760      for (int i = 0; i < array.size(); i++) {
6761        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
6762      }
6763    };
6764    if (json.has("encounter"))
6765      res.setEncounter(parseReference(getJObject(json, "encounter")));
6766    if (json.has("payload")) {
6767      JsonArray array = json.getAsJsonArray("payload");
6768      for (int i = 0; i < array.size(); i++) {
6769        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
6770      }
6771    };
6772    Type occurrence = parseType("occurrence", json);
6773    if (occurrence != null)
6774      res.setOccurrence(occurrence);
6775    if (json.has("authoredOn"))
6776      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
6777    if (json.has("_authoredOn"))
6778      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
6779    if (json.has("requester"))
6780      res.setRequester(parseReference(getJObject(json, "requester")));
6781    if (json.has("recipient")) {
6782      JsonArray array = json.getAsJsonArray("recipient");
6783      for (int i = 0; i < array.size(); i++) {
6784        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6785      }
6786    };
6787    if (json.has("sender"))
6788      res.setSender(parseReference(getJObject(json, "sender")));
6789    if (json.has("reasonCode")) {
6790      JsonArray array = json.getAsJsonArray("reasonCode");
6791      for (int i = 0; i < array.size(); i++) {
6792        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6793      }
6794    };
6795    if (json.has("reasonReference")) {
6796      JsonArray array = json.getAsJsonArray("reasonReference");
6797      for (int i = 0; i < array.size(); i++) {
6798        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
6799      }
6800    };
6801    if (json.has("note")) {
6802      JsonArray array = json.getAsJsonArray("note");
6803      for (int i = 0; i < array.size(); i++) {
6804        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6805      }
6806    };
6807  }
6808
6809  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
6810    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
6811    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
6812    return res;
6813  }
6814
6815  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
6816    parseBackboneElementProperties(json, res);
6817    Type content = parseType("content", json);
6818    if (content != null)
6819      res.setContent(content);
6820  }
6821
6822  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
6823    CompartmentDefinition res = new CompartmentDefinition();
6824    parseCompartmentDefinitionProperties(json, res);
6825    return res;
6826  }
6827
6828  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
6829    parseDomainResourceProperties(json, res);
6830    if (json.has("url"))
6831      res.setUrlElement(parseUri(json.get("url").getAsString()));
6832    if (json.has("_url"))
6833      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6834    if (json.has("version"))
6835      res.setVersionElement(parseString(json.get("version").getAsString()));
6836    if (json.has("_version"))
6837      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
6838    if (json.has("name"))
6839      res.setNameElement(parseString(json.get("name").getAsString()));
6840    if (json.has("_name"))
6841      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
6842    if (json.has("status"))
6843      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6844    if (json.has("_status"))
6845      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6846    if (json.has("experimental"))
6847      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6848    if (json.has("_experimental"))
6849      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
6850    if (json.has("date"))
6851      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6852    if (json.has("_date"))
6853      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6854    if (json.has("publisher"))
6855      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6856    if (json.has("_publisher"))
6857      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
6858    if (json.has("contact")) {
6859      JsonArray array = json.getAsJsonArray("contact");
6860      for (int i = 0; i < array.size(); i++) {
6861        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6862      }
6863    };
6864    if (json.has("description"))
6865      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6866    if (json.has("_description"))
6867      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6868    if (json.has("useContext")) {
6869      JsonArray array = json.getAsJsonArray("useContext");
6870      for (int i = 0; i < array.size(); i++) {
6871        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6872      }
6873    };
6874    if (json.has("purpose"))
6875      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6876    if (json.has("_purpose"))
6877      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
6878    if (json.has("code"))
6879      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
6880    if (json.has("_code"))
6881      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6882    if (json.has("search"))
6883      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
6884    if (json.has("_search"))
6885      parseElementProperties(getJObject(json, "_search"), res.getSearchElement());
6886    if (json.has("resource")) {
6887      JsonArray array = json.getAsJsonArray("resource");
6888      for (int i = 0; i < array.size(); i++) {
6889        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
6890      }
6891    };
6892  }
6893
6894  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
6895    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
6896    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
6897    return res;
6898  }
6899
6900  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
6901    parseBackboneElementProperties(json, res);
6902    if (json.has("code"))
6903      res.setCodeElement(parseCode(json.get("code").getAsString()));
6904    if (json.has("_code"))
6905      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6906    if (json.has("param")) {
6907      JsonArray array = json.getAsJsonArray("param");
6908      for (int i = 0; i < array.size(); i++) {
6909        if (array.get(i).isJsonNull()) {
6910          res.getParam().add(new StringType());
6911        } else {
6912          res.getParam().add(parseString(array.get(i).getAsString()));
6913        }
6914      }
6915    };
6916    if (json.has("_param")) {
6917      JsonArray array = json.getAsJsonArray("_param");
6918      for (int i = 0; i < array.size(); i++) {
6919        if (i == res.getParam().size())
6920          res.getParam().add(parseString(null));
6921        if (array.get(i) instanceof JsonObject) 
6922          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
6923      }
6924    };
6925    if (json.has("documentation"))
6926      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
6927    if (json.has("_documentation"))
6928      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
6929  }
6930
6931  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
6932    Composition res = new Composition();
6933    parseCompositionProperties(json, res);
6934    return res;
6935  }
6936
6937  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
6938    parseDomainResourceProperties(json, res);
6939    if (json.has("identifier"))
6940      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6941    if (json.has("status"))
6942      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
6943    if (json.has("_status"))
6944      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6945    if (json.has("type"))
6946      res.setType(parseCodeableConcept(getJObject(json, "type")));
6947    if (json.has("category")) {
6948      JsonArray array = json.getAsJsonArray("category");
6949      for (int i = 0; i < array.size(); i++) {
6950        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6951      }
6952    };
6953    if (json.has("subject"))
6954      res.setSubject(parseReference(getJObject(json, "subject")));
6955    if (json.has("encounter"))
6956      res.setEncounter(parseReference(getJObject(json, "encounter")));
6957    if (json.has("date"))
6958      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6959    if (json.has("_date"))
6960      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6961    if (json.has("author")) {
6962      JsonArray array = json.getAsJsonArray("author");
6963      for (int i = 0; i < array.size(); i++) {
6964        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6965      }
6966    };
6967    if (json.has("title"))
6968      res.setTitleElement(parseString(json.get("title").getAsString()));
6969    if (json.has("_title"))
6970      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
6971    if (json.has("confidentiality"))
6972      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
6973    if (json.has("_confidentiality"))
6974      parseElementProperties(getJObject(json, "_confidentiality"), res.getConfidentialityElement());
6975    if (json.has("attester")) {
6976      JsonArray array = json.getAsJsonArray("attester");
6977      for (int i = 0; i < array.size(); i++) {
6978        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
6979      }
6980    };
6981    if (json.has("custodian"))
6982      res.setCustodian(parseReference(getJObject(json, "custodian")));
6983    if (json.has("relatesTo")) {
6984      JsonArray array = json.getAsJsonArray("relatesTo");
6985      for (int i = 0; i < array.size(); i++) {
6986        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
6987      }
6988    };
6989    if (json.has("event")) {
6990      JsonArray array = json.getAsJsonArray("event");
6991      for (int i = 0; i < array.size(); i++) {
6992        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
6993      }
6994    };
6995    if (json.has("section")) {
6996      JsonArray array = json.getAsJsonArray("section");
6997      for (int i = 0; i < array.size(); i++) {
6998        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
6999      }
7000    };
7001  }
7002
7003  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
7004    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
7005    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
7006    return res;
7007  }
7008
7009  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
7010    parseBackboneElementProperties(json, res);
7011    if (json.has("mode"))
7012      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
7013    if (json.has("_mode"))
7014      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
7015    if (json.has("time"))
7016      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
7017    if (json.has("_time"))
7018      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
7019    if (json.has("party"))
7020      res.setParty(parseReference(getJObject(json, "party")));
7021  }
7022
7023  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
7024    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
7025    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
7026    return res;
7027  }
7028
7029  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
7030    parseBackboneElementProperties(json, res);
7031    if (json.has("code"))
7032      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
7033    if (json.has("_code"))
7034      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7035    Type target = parseType("target", json);
7036    if (target != null)
7037      res.setTarget(target);
7038  }
7039
7040  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
7041    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
7042    parseCompositionCompositionEventComponentProperties(json, owner, res);
7043    return res;
7044  }
7045
7046  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
7047    parseBackboneElementProperties(json, res);
7048    if (json.has("code")) {
7049      JsonArray array = json.getAsJsonArray("code");
7050      for (int i = 0; i < array.size(); i++) {
7051        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7052      }
7053    };
7054    if (json.has("period"))
7055      res.setPeriod(parsePeriod(getJObject(json, "period")));
7056    if (json.has("detail")) {
7057      JsonArray array = json.getAsJsonArray("detail");
7058      for (int i = 0; i < array.size(); i++) {
7059        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
7060      }
7061    };
7062  }
7063
7064  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
7065    Composition.SectionComponent res = new Composition.SectionComponent();
7066    parseCompositionSectionComponentProperties(json, owner, res);
7067    return res;
7068  }
7069
7070  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
7071    parseBackboneElementProperties(json, res);
7072    if (json.has("title"))
7073      res.setTitleElement(parseString(json.get("title").getAsString()));
7074    if (json.has("_title"))
7075      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
7076    if (json.has("code"))
7077      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7078    if (json.has("author")) {
7079      JsonArray array = json.getAsJsonArray("author");
7080      for (int i = 0; i < array.size(); i++) {
7081        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7082      }
7083    };
7084    if (json.has("focus"))
7085      res.setFocus(parseReference(getJObject(json, "focus")));
7086    if (json.has("text"))
7087      res.setText(parseNarrative(getJObject(json, "text")));
7088    if (json.has("mode"))
7089      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
7090    if (json.has("_mode"))
7091      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
7092    if (json.has("orderedBy"))
7093      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
7094    if (json.has("entry")) {
7095      JsonArray array = json.getAsJsonArray("entry");
7096      for (int i = 0; i < array.size(); i++) {
7097        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
7098      }
7099    };
7100    if (json.has("emptyReason"))
7101      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
7102    if (json.has("section")) {
7103      JsonArray array = json.getAsJsonArray("section");
7104      for (int i = 0; i < array.size(); i++) {
7105        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
7106      }
7107    };
7108  }
7109
7110  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
7111    ConceptMap res = new ConceptMap();
7112    parseConceptMapProperties(json, res);
7113    return res;
7114  }
7115
7116  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
7117    parseDomainResourceProperties(json, res);
7118    if (json.has("url"))
7119      res.setUrlElement(parseUri(json.get("url").getAsString()));
7120    if (json.has("_url"))
7121      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7122    if (json.has("identifier"))
7123      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7124    if (json.has("version"))
7125      res.setVersionElement(parseString(json.get("version").getAsString()));
7126    if (json.has("_version"))
7127      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7128    if (json.has("name"))
7129      res.setNameElement(parseString(json.get("name").getAsString()));
7130    if (json.has("_name"))
7131      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7132    if (json.has("title"))
7133      res.setTitleElement(parseString(json.get("title").getAsString()));
7134    if (json.has("_title"))
7135      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
7136    if (json.has("status"))
7137      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7138    if (json.has("_status"))
7139      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7140    if (json.has("experimental"))
7141      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7142    if (json.has("_experimental"))
7143      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
7144    if (json.has("date"))
7145      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7146    if (json.has("_date"))
7147      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7148    if (json.has("publisher"))
7149      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7150    if (json.has("_publisher"))
7151      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
7152    if (json.has("contact")) {
7153      JsonArray array = json.getAsJsonArray("contact");
7154      for (int i = 0; i < array.size(); i++) {
7155        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7156      }
7157    };
7158    if (json.has("description"))
7159      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
7160    if (json.has("_description"))
7161      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7162    if (json.has("useContext")) {
7163      JsonArray array = json.getAsJsonArray("useContext");
7164      for (int i = 0; i < array.size(); i++) {
7165        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7166      }
7167    };
7168    if (json.has("jurisdiction")) {
7169      JsonArray array = json.getAsJsonArray("jurisdiction");
7170      for (int i = 0; i < array.size(); i++) {
7171        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7172      }
7173    };
7174    if (json.has("purpose"))
7175      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
7176    if (json.has("_purpose"))
7177      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
7178    if (json.has("copyright"))
7179      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7180    if (json.has("_copyright"))
7181      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
7182    Type source = parseType("source", json);
7183    if (source != null)
7184      res.setSource(source);
7185    Type target = parseType("target", json);
7186    if (target != null)
7187      res.setTarget(target);
7188    if (json.has("group")) {
7189      JsonArray array = json.getAsJsonArray("group");
7190      for (int i = 0; i < array.size(); i++) {
7191        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
7192      }
7193    };
7194  }
7195
7196  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7197    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
7198    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
7199    return res;
7200  }
7201
7202  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
7203    parseBackboneElementProperties(json, res);
7204    if (json.has("source"))
7205      res.setSourceElement(parseUri(json.get("source").getAsString()));
7206    if (json.has("_source"))
7207      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
7208    if (json.has("sourceVersion"))
7209      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
7210    if (json.has("_sourceVersion"))
7211      parseElementProperties(getJObject(json, "_sourceVersion"), res.getSourceVersionElement());
7212    if (json.has("target"))
7213      res.setTargetElement(parseUri(json.get("target").getAsString()));
7214    if (json.has("_target"))
7215      parseElementProperties(getJObject(json, "_target"), res.getTargetElement());
7216    if (json.has("targetVersion"))
7217      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
7218    if (json.has("_targetVersion"))
7219      parseElementProperties(getJObject(json, "_targetVersion"), res.getTargetVersionElement());
7220    if (json.has("element")) {
7221      JsonArray array = json.getAsJsonArray("element");
7222      for (int i = 0; i < array.size(); i++) {
7223        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
7224      }
7225    };
7226    if (json.has("unmapped"))
7227      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(getJObject(json, "unmapped"), owner));
7228  }
7229
7230  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7231    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
7232    parseConceptMapSourceElementComponentProperties(json, owner, res);
7233    return res;
7234  }
7235
7236  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
7237    parseBackboneElementProperties(json, res);
7238    if (json.has("code"))
7239      res.setCodeElement(parseCode(json.get("code").getAsString()));
7240    if (json.has("_code"))
7241      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7242    if (json.has("display"))
7243      res.setDisplayElement(parseString(json.get("display").getAsString()));
7244    if (json.has("_display"))
7245      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
7246    if (json.has("target")) {
7247      JsonArray array = json.getAsJsonArray("target");
7248      for (int i = 0; i < array.size(); i++) {
7249        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
7250      }
7251    };
7252  }
7253
7254  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7255    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
7256    parseConceptMapTargetElementComponentProperties(json, owner, res);
7257    return res;
7258  }
7259
7260  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
7261    parseBackboneElementProperties(json, res);
7262    if (json.has("code"))
7263      res.setCodeElement(parseCode(json.get("code").getAsString()));
7264    if (json.has("_code"))
7265      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7266    if (json.has("display"))
7267      res.setDisplayElement(parseString(json.get("display").getAsString()));
7268    if (json.has("_display"))
7269      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
7270    if (json.has("equivalence"))
7271      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
7272    if (json.has("_equivalence"))
7273      parseElementProperties(getJObject(json, "_equivalence"), res.getEquivalenceElement());
7274    if (json.has("comment"))
7275      res.setCommentElement(parseString(json.get("comment").getAsString()));
7276    if (json.has("_comment"))
7277      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
7278    if (json.has("dependsOn")) {
7279      JsonArray array = json.getAsJsonArray("dependsOn");
7280      for (int i = 0; i < array.size(); i++) {
7281        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7282      }
7283    };
7284    if (json.has("product")) {
7285      JsonArray array = json.getAsJsonArray("product");
7286      for (int i = 0; i < array.size(); i++) {
7287        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7288      }
7289    };
7290  }
7291
7292  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7293    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
7294    parseConceptMapOtherElementComponentProperties(json, owner, res);
7295    return res;
7296  }
7297
7298  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
7299    parseBackboneElementProperties(json, res);
7300    if (json.has("property"))
7301      res.setPropertyElement(parseUri(json.get("property").getAsString()));
7302    if (json.has("_property"))
7303      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
7304    if (json.has("system"))
7305      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
7306    if (json.has("_system"))
7307      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
7308    if (json.has("value"))
7309      res.setValueElement(parseString(json.get("value").getAsString()));
7310    if (json.has("_value"))
7311      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
7312    if (json.has("display"))
7313      res.setDisplayElement(parseString(json.get("display").getAsString()));
7314    if (json.has("_display"))
7315      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
7316  }
7317
7318  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7319    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
7320    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
7321    return res;
7322  }
7323
7324  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
7325    parseBackboneElementProperties(json, res);
7326    if (json.has("mode"))
7327      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
7328    if (json.has("_mode"))
7329      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
7330    if (json.has("code"))
7331      res.setCodeElement(parseCode(json.get("code").getAsString()));
7332    if (json.has("_code"))
7333      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7334    if (json.has("display"))
7335      res.setDisplayElement(parseString(json.get("display").getAsString()));
7336    if (json.has("_display"))
7337      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
7338    if (json.has("url"))
7339      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
7340    if (json.has("_url"))
7341      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7342  }
7343
7344  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
7345    Condition res = new Condition();
7346    parseConditionProperties(json, res);
7347    return res;
7348  }
7349
7350  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
7351    parseDomainResourceProperties(json, res);
7352    if (json.has("identifier")) {
7353      JsonArray array = json.getAsJsonArray("identifier");
7354      for (int i = 0; i < array.size(); i++) {
7355        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7356      }
7357    };
7358    if (json.has("clinicalStatus"))
7359      res.setClinicalStatus(parseCodeableConcept(getJObject(json, "clinicalStatus")));
7360    if (json.has("verificationStatus"))
7361      res.setVerificationStatus(parseCodeableConcept(getJObject(json, "verificationStatus")));
7362    if (json.has("category")) {
7363      JsonArray array = json.getAsJsonArray("category");
7364      for (int i = 0; i < array.size(); i++) {
7365        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7366      }
7367    };
7368    if (json.has("severity"))
7369      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
7370    if (json.has("code"))
7371      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7372    if (json.has("bodySite")) {
7373      JsonArray array = json.getAsJsonArray("bodySite");
7374      for (int i = 0; i < array.size(); i++) {
7375        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7376      }
7377    };
7378    if (json.has("subject"))
7379      res.setSubject(parseReference(getJObject(json, "subject")));
7380    if (json.has("encounter"))
7381      res.setEncounter(parseReference(getJObject(json, "encounter")));
7382    Type onset = parseType("onset", json);
7383    if (onset != null)
7384      res.setOnset(onset);
7385    Type abatement = parseType("abatement", json);
7386    if (abatement != null)
7387      res.setAbatement(abatement);
7388    if (json.has("recordedDate"))
7389      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
7390    if (json.has("_recordedDate"))
7391      parseElementProperties(getJObject(json, "_recordedDate"), res.getRecordedDateElement());
7392    if (json.has("recorder"))
7393      res.setRecorder(parseReference(getJObject(json, "recorder")));
7394    if (json.has("asserter"))
7395      res.setAsserter(parseReference(getJObject(json, "asserter")));
7396    if (json.has("stage")) {
7397      JsonArray array = json.getAsJsonArray("stage");
7398      for (int i = 0; i < array.size(); i++) {
7399        res.getStage().add(parseConditionConditionStageComponent(array.get(i).getAsJsonObject(), res));
7400      }
7401    };
7402    if (json.has("evidence")) {
7403      JsonArray array = json.getAsJsonArray("evidence");
7404      for (int i = 0; i < array.size(); i++) {
7405        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
7406      }
7407    };
7408    if (json.has("note")) {
7409      JsonArray array = json.getAsJsonArray("note");
7410      for (int i = 0; i < array.size(); i++) {
7411        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7412      }
7413    };
7414  }
7415
7416  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
7417    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
7418    parseConditionConditionStageComponentProperties(json, owner, res);
7419    return res;
7420  }
7421
7422  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
7423    parseBackboneElementProperties(json, res);
7424    if (json.has("summary"))
7425      res.setSummary(parseCodeableConcept(getJObject(json, "summary")));
7426    if (json.has("assessment")) {
7427      JsonArray array = json.getAsJsonArray("assessment");
7428      for (int i = 0; i < array.size(); i++) {
7429        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
7430      }
7431    };
7432    if (json.has("type"))
7433      res.setType(parseCodeableConcept(getJObject(json, "type")));
7434  }
7435
7436  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
7437    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
7438    parseConditionConditionEvidenceComponentProperties(json, owner, res);
7439    return res;
7440  }
7441
7442  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
7443    parseBackboneElementProperties(json, res);
7444    if (json.has("code")) {
7445      JsonArray array = json.getAsJsonArray("code");
7446      for (int i = 0; i < array.size(); i++) {
7447        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7448      }
7449    };
7450    if (json.has("detail")) {
7451      JsonArray array = json.getAsJsonArray("detail");
7452      for (int i = 0; i < array.size(); i++) {
7453        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
7454      }
7455    };
7456  }
7457
7458  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
7459    Consent res = new Consent();
7460    parseConsentProperties(json, res);
7461    return res;
7462  }
7463
7464  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
7465    parseDomainResourceProperties(json, res);
7466    if (json.has("identifier")) {
7467      JsonArray array = json.getAsJsonArray("identifier");
7468      for (int i = 0; i < array.size(); i++) {
7469        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7470      }
7471    };
7472    if (json.has("status"))
7473      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
7474    if (json.has("_status"))
7475      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7476    if (json.has("scope"))
7477      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
7478    if (json.has("category")) {
7479      JsonArray array = json.getAsJsonArray("category");
7480      for (int i = 0; i < array.size(); i++) {
7481        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7482      }
7483    };
7484    if (json.has("patient"))
7485      res.setPatient(parseReference(getJObject(json, "patient")));
7486    if (json.has("dateTime"))
7487      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
7488    if (json.has("_dateTime"))
7489      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
7490    if (json.has("performer")) {
7491      JsonArray array = json.getAsJsonArray("performer");
7492      for (int i = 0; i < array.size(); i++) {
7493        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
7494      }
7495    };
7496    if (json.has("organization")) {
7497      JsonArray array = json.getAsJsonArray("organization");
7498      for (int i = 0; i < array.size(); i++) {
7499        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
7500      }
7501    };
7502    Type source = parseType("source", json);
7503    if (source != null)
7504      res.setSource(source);
7505    if (json.has("policy")) {
7506      JsonArray array = json.getAsJsonArray("policy");
7507      for (int i = 0; i < array.size(); i++) {
7508        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
7509      }
7510    };
7511    if (json.has("policyRule"))
7512      res.setPolicyRule(parseCodeableConcept(getJObject(json, "policyRule")));
7513    if (json.has("verification")) {
7514      JsonArray array = json.getAsJsonArray("verification");
7515      for (int i = 0; i < array.size(); i++) {
7516        res.getVerification().add(parseConsentConsentVerificationComponent(array.get(i).getAsJsonObject(), res));
7517      }
7518    };
7519    if (json.has("provision"))
7520      res.setProvision(parseConsentprovisionComponent(getJObject(json, "provision"), res));
7521  }
7522
7523  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7524    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
7525    parseConsentConsentPolicyComponentProperties(json, owner, res);
7526    return res;
7527  }
7528
7529  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
7530    parseBackboneElementProperties(json, res);
7531    if (json.has("authority"))
7532      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
7533    if (json.has("_authority"))
7534      parseElementProperties(getJObject(json, "_authority"), res.getAuthorityElement());
7535    if (json.has("uri"))
7536      res.setUriElement(parseUri(json.get("uri").getAsString()));
7537    if (json.has("_uri"))
7538      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
7539  }
7540
7541  protected Consent.ConsentVerificationComponent parseConsentConsentVerificationComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7542    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
7543    parseConsentConsentVerificationComponentProperties(json, owner, res);
7544    return res;
7545  }
7546
7547  protected void parseConsentConsentVerificationComponentProperties(JsonObject json, Consent owner, Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
7548    parseBackboneElementProperties(json, res);
7549    if (json.has("verified"))
7550      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
7551    if (json.has("_verified"))
7552      parseElementProperties(getJObject(json, "_verified"), res.getVerifiedElement());
7553    if (json.has("verifiedWith"))
7554      res.setVerifiedWith(parseReference(getJObject(json, "verifiedWith")));
7555    if (json.has("verificationDate"))
7556      res.setVerificationDateElement(parseDateTime(json.get("verificationDate").getAsString()));
7557    if (json.has("_verificationDate"))
7558      parseElementProperties(getJObject(json, "_verificationDate"), res.getVerificationDateElement());
7559  }
7560
7561  protected Consent.provisionComponent parseConsentprovisionComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7562    Consent.provisionComponent res = new Consent.provisionComponent();
7563    parseConsentprovisionComponentProperties(json, owner, res);
7564    return res;
7565  }
7566
7567  protected void parseConsentprovisionComponentProperties(JsonObject json, Consent owner, Consent.provisionComponent res) throws IOException, FHIRFormatError {
7568    parseBackboneElementProperties(json, res);
7569    if (json.has("type"))
7570      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentProvisionType.NULL, new Consent.ConsentProvisionTypeEnumFactory()));
7571    if (json.has("_type"))
7572      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7573    if (json.has("period"))
7574      res.setPeriod(parsePeriod(getJObject(json, "period")));
7575    if (json.has("actor")) {
7576      JsonArray array = json.getAsJsonArray("actor");
7577      for (int i = 0; i < array.size(); i++) {
7578        res.getActor().add(parseConsentprovisionActorComponent(array.get(i).getAsJsonObject(), owner));
7579      }
7580    };
7581    if (json.has("action")) {
7582      JsonArray array = json.getAsJsonArray("action");
7583      for (int i = 0; i < array.size(); i++) {
7584        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7585      }
7586    };
7587    if (json.has("securityLabel")) {
7588      JsonArray array = json.getAsJsonArray("securityLabel");
7589      for (int i = 0; i < array.size(); i++) {
7590        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
7591      }
7592    };
7593    if (json.has("purpose")) {
7594      JsonArray array = json.getAsJsonArray("purpose");
7595      for (int i = 0; i < array.size(); i++) {
7596        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
7597      }
7598    };
7599    if (json.has("class")) {
7600      JsonArray array = json.getAsJsonArray("class");
7601      for (int i = 0; i < array.size(); i++) {
7602        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
7603      }
7604    };
7605    if (json.has("code")) {
7606      JsonArray array = json.getAsJsonArray("code");
7607      for (int i = 0; i < array.size(); i++) {
7608        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7609      }
7610    };
7611    if (json.has("dataPeriod"))
7612      res.setDataPeriod(parsePeriod(getJObject(json, "dataPeriod")));
7613    if (json.has("data")) {
7614      JsonArray array = json.getAsJsonArray("data");
7615      for (int i = 0; i < array.size(); i++) {
7616        res.getData().add(parseConsentprovisionDataComponent(array.get(i).getAsJsonObject(), owner));
7617      }
7618    };
7619    if (json.has("provision")) {
7620      JsonArray array = json.getAsJsonArray("provision");
7621      for (int i = 0; i < array.size(); i++) {
7622        res.getProvision().add(parseConsentprovisionComponent(array.get(i).getAsJsonObject(), owner));
7623      }
7624    };
7625  }
7626
7627  protected Consent.provisionActorComponent parseConsentprovisionActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7628    Consent.provisionActorComponent res = new Consent.provisionActorComponent();
7629    parseConsentprovisionActorComponentProperties(json, owner, res);
7630    return res;
7631  }
7632
7633  protected void parseConsentprovisionActorComponentProperties(JsonObject json, Consent owner, Consent.provisionActorComponent res) throws IOException, FHIRFormatError {
7634    parseBackboneElementProperties(json, res);
7635    if (json.has("role"))
7636      res.setRole(parseCodeableConcept(getJObject(json, "role")));
7637    if (json.has("reference"))
7638      res.setReference(parseReference(getJObject(json, "reference")));
7639  }
7640
7641  protected Consent.provisionDataComponent parseConsentprovisionDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7642    Consent.provisionDataComponent res = new Consent.provisionDataComponent();
7643    parseConsentprovisionDataComponentProperties(json, owner, res);
7644    return res;
7645  }
7646
7647  protected void parseConsentprovisionDataComponentProperties(JsonObject json, Consent owner, Consent.provisionDataComponent res) throws IOException, FHIRFormatError {
7648    parseBackboneElementProperties(json, res);
7649    if (json.has("meaning"))
7650      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
7651    if (json.has("_meaning"))
7652      parseElementProperties(getJObject(json, "_meaning"), res.getMeaningElement());
7653    if (json.has("reference"))
7654      res.setReference(parseReference(getJObject(json, "reference")));
7655  }
7656
7657  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
7658    Contract res = new Contract();
7659    parseContractProperties(json, res);
7660    return res;
7661  }
7662
7663  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
7664    parseDomainResourceProperties(json, res);
7665    if (json.has("identifier")) {
7666      JsonArray array = json.getAsJsonArray("identifier");
7667      for (int i = 0; i < array.size(); i++) {
7668        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7669      }
7670    };
7671    if (json.has("url"))
7672      res.setUrlElement(parseUri(json.get("url").getAsString()));
7673    if (json.has("_url"))
7674      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7675    if (json.has("version"))
7676      res.setVersionElement(parseString(json.get("version").getAsString()));
7677    if (json.has("_version"))
7678      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7679    if (json.has("status"))
7680      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
7681    if (json.has("_status"))
7682      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7683    if (json.has("legalState"))
7684      res.setLegalState(parseCodeableConcept(getJObject(json, "legalState")));
7685    if (json.has("instantiatesCanonical"))
7686      res.setInstantiatesCanonical(parseReference(getJObject(json, "instantiatesCanonical")));
7687    if (json.has("instantiatesUri"))
7688      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
7689    if (json.has("_instantiatesUri"))
7690      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
7691    if (json.has("contentDerivative"))
7692      res.setContentDerivative(parseCodeableConcept(getJObject(json, "contentDerivative")));
7693    if (json.has("issued"))
7694      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
7695    if (json.has("_issued"))
7696      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
7697    if (json.has("applies"))
7698      res.setApplies(parsePeriod(getJObject(json, "applies")));
7699    if (json.has("expirationType"))
7700      res.setExpirationType(parseCodeableConcept(getJObject(json, "expirationType")));
7701    if (json.has("subject")) {
7702      JsonArray array = json.getAsJsonArray("subject");
7703      for (int i = 0; i < array.size(); i++) {
7704        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
7705      }
7706    };
7707    if (json.has("authority")) {
7708      JsonArray array = json.getAsJsonArray("authority");
7709      for (int i = 0; i < array.size(); i++) {
7710        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
7711      }
7712    };
7713    if (json.has("domain")) {
7714      JsonArray array = json.getAsJsonArray("domain");
7715      for (int i = 0; i < array.size(); i++) {
7716        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
7717      }
7718    };
7719    if (json.has("site")) {
7720      JsonArray array = json.getAsJsonArray("site");
7721      for (int i = 0; i < array.size(); i++) {
7722        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
7723      }
7724    };
7725    if (json.has("name"))
7726      res.setNameElement(parseString(json.get("name").getAsString()));
7727    if (json.has("_name"))
7728      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7729    if (json.has("title"))
7730      res.setTitleElement(parseString(json.get("title").getAsString()));
7731    if (json.has("_title"))
7732      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
7733    if (json.has("subtitle"))
7734      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
7735    if (json.has("_subtitle"))
7736      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
7737    if (json.has("alias")) {
7738      JsonArray array = json.getAsJsonArray("alias");
7739      for (int i = 0; i < array.size(); i++) {
7740        if (array.get(i).isJsonNull()) {
7741          res.getAlias().add(new StringType());
7742        } else {
7743          res.getAlias().add(parseString(array.get(i).getAsString()));
7744        }
7745      }
7746    };
7747    if (json.has("_alias")) {
7748      JsonArray array = json.getAsJsonArray("_alias");
7749      for (int i = 0; i < array.size(); i++) {
7750        if (i == res.getAlias().size())
7751          res.getAlias().add(parseString(null));
7752        if (array.get(i) instanceof JsonObject) 
7753          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
7754      }
7755    };
7756    if (json.has("author"))
7757      res.setAuthor(parseReference(getJObject(json, "author")));
7758    if (json.has("scope"))
7759      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
7760    Type topic = parseType("topic", json);
7761    if (topic != null)
7762      res.setTopic(topic);
7763    if (json.has("type"))
7764      res.setType(parseCodeableConcept(getJObject(json, "type")));
7765    if (json.has("subType")) {
7766      JsonArray array = json.getAsJsonArray("subType");
7767      for (int i = 0; i < array.size(); i++) {
7768        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7769      }
7770    };
7771    if (json.has("contentDefinition"))
7772      res.setContentDefinition(parseContractContentDefinitionComponent(getJObject(json, "contentDefinition"), res));
7773    if (json.has("term")) {
7774      JsonArray array = json.getAsJsonArray("term");
7775      for (int i = 0; i < array.size(); i++) {
7776        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
7777      }
7778    };
7779    if (json.has("supportingInfo")) {
7780      JsonArray array = json.getAsJsonArray("supportingInfo");
7781      for (int i = 0; i < array.size(); i++) {
7782        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7783      }
7784    };
7785    if (json.has("relevantHistory")) {
7786      JsonArray array = json.getAsJsonArray("relevantHistory");
7787      for (int i = 0; i < array.size(); i++) {
7788        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
7789      }
7790    };
7791    if (json.has("signer")) {
7792      JsonArray array = json.getAsJsonArray("signer");
7793      for (int i = 0; i < array.size(); i++) {
7794        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
7795      }
7796    };
7797    if (json.has("friendly")) {
7798      JsonArray array = json.getAsJsonArray("friendly");
7799      for (int i = 0; i < array.size(); i++) {
7800        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
7801      }
7802    };
7803    if (json.has("legal")) {
7804      JsonArray array = json.getAsJsonArray("legal");
7805      for (int i = 0; i < array.size(); i++) {
7806        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
7807      }
7808    };
7809    if (json.has("rule")) {
7810      JsonArray array = json.getAsJsonArray("rule");
7811      for (int i = 0; i < array.size(); i++) {
7812        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
7813      }
7814    };
7815    Type legallyBinding = parseType("legallyBinding", json);
7816    if (legallyBinding != null)
7817      res.setLegallyBinding(legallyBinding);
7818  }
7819
7820  protected Contract.ContentDefinitionComponent parseContractContentDefinitionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7821    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
7822    parseContractContentDefinitionComponentProperties(json, owner, res);
7823    return res;
7824  }
7825
7826  protected void parseContractContentDefinitionComponentProperties(JsonObject json, Contract owner, Contract.ContentDefinitionComponent res) throws IOException, FHIRFormatError {
7827    parseBackboneElementProperties(json, res);
7828    if (json.has("type"))
7829      res.setType(parseCodeableConcept(getJObject(json, "type")));
7830    if (json.has("subType"))
7831      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
7832    if (json.has("publisher"))
7833      res.setPublisher(parseReference(getJObject(json, "publisher")));
7834    if (json.has("publicationDate"))
7835      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
7836    if (json.has("_publicationDate"))
7837      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
7838    if (json.has("publicationStatus"))
7839      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Contract.ContractPublicationStatus.NULL, new Contract.ContractPublicationStatusEnumFactory()));
7840    if (json.has("_publicationStatus"))
7841      parseElementProperties(getJObject(json, "_publicationStatus"), res.getPublicationStatusElement());
7842    if (json.has("copyright"))
7843      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7844    if (json.has("_copyright"))
7845      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
7846  }
7847
7848  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7849    Contract.TermComponent res = new Contract.TermComponent();
7850    parseContractTermComponentProperties(json, owner, res);
7851    return res;
7852  }
7853
7854  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
7855    parseBackboneElementProperties(json, res);
7856    if (json.has("identifier"))
7857      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7858    if (json.has("issued"))
7859      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
7860    if (json.has("_issued"))
7861      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
7862    if (json.has("applies"))
7863      res.setApplies(parsePeriod(getJObject(json, "applies")));
7864    Type topic = parseType("topic", json);
7865    if (topic != null)
7866      res.setTopic(topic);
7867    if (json.has("type"))
7868      res.setType(parseCodeableConcept(getJObject(json, "type")));
7869    if (json.has("subType"))
7870      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
7871    if (json.has("text"))
7872      res.setTextElement(parseString(json.get("text").getAsString()));
7873    if (json.has("_text"))
7874      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
7875    if (json.has("securityLabel")) {
7876      JsonArray array = json.getAsJsonArray("securityLabel");
7877      for (int i = 0; i < array.size(); i++) {
7878        res.getSecurityLabel().add(parseContractSecurityLabelComponent(array.get(i).getAsJsonObject(), owner));
7879      }
7880    };
7881    if (json.has("offer"))
7882      res.setOffer(parseContractContractOfferComponent(getJObject(json, "offer"), owner));
7883    if (json.has("asset")) {
7884      JsonArray array = json.getAsJsonArray("asset");
7885      for (int i = 0; i < array.size(); i++) {
7886        res.getAsset().add(parseContractContractAssetComponent(array.get(i).getAsJsonObject(), owner));
7887      }
7888    };
7889    if (json.has("action")) {
7890      JsonArray array = json.getAsJsonArray("action");
7891      for (int i = 0; i < array.size(); i++) {
7892        res.getAction().add(parseContractActionComponent(array.get(i).getAsJsonObject(), owner));
7893      }
7894    };
7895    if (json.has("group")) {
7896      JsonArray array = json.getAsJsonArray("group");
7897      for (int i = 0; i < array.size(); i++) {
7898        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
7899      }
7900    };
7901  }
7902
7903  protected Contract.SecurityLabelComponent parseContractSecurityLabelComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7904    Contract.SecurityLabelComponent res = new Contract.SecurityLabelComponent();
7905    parseContractSecurityLabelComponentProperties(json, owner, res);
7906    return res;
7907  }
7908
7909  protected void parseContractSecurityLabelComponentProperties(JsonObject json, Contract owner, Contract.SecurityLabelComponent res) throws IOException, FHIRFormatError {
7910    parseBackboneElementProperties(json, res);
7911    if (json.has("number")) {
7912      JsonArray array = json.getAsJsonArray("number");
7913      for (int i = 0; i < array.size(); i++) {
7914        if (array.get(i).isJsonNull()) {
7915          res.getNumber().add(new UnsignedIntType());
7916        } else {
7917          res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7918        }
7919      }
7920    };
7921    if (json.has("_number")) {
7922      JsonArray array = json.getAsJsonArray("_number");
7923      for (int i = 0; i < array.size(); i++) {
7924        if (i == res.getNumber().size())
7925          res.getNumber().add(parseUnsignedInt(null));
7926        if (array.get(i) instanceof JsonObject) 
7927          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
7928      }
7929    };
7930    if (json.has("classification"))
7931      res.setClassification(parseCoding(getJObject(json, "classification")));
7932    if (json.has("category")) {
7933      JsonArray array = json.getAsJsonArray("category");
7934      for (int i = 0; i < array.size(); i++) {
7935        res.getCategory().add(parseCoding(array.get(i).getAsJsonObject()));
7936      }
7937    };
7938    if (json.has("control")) {
7939      JsonArray array = json.getAsJsonArray("control");
7940      for (int i = 0; i < array.size(); i++) {
7941        res.getControl().add(parseCoding(array.get(i).getAsJsonObject()));
7942      }
7943    };
7944  }
7945
7946  protected Contract.ContractOfferComponent parseContractContractOfferComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7947    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
7948    parseContractContractOfferComponentProperties(json, owner, res);
7949    return res;
7950  }
7951
7952  protected void parseContractContractOfferComponentProperties(JsonObject json, Contract owner, Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
7953    parseBackboneElementProperties(json, res);
7954    if (json.has("identifier")) {
7955      JsonArray array = json.getAsJsonArray("identifier");
7956      for (int i = 0; i < array.size(); i++) {
7957        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7958      }
7959    };
7960    if (json.has("party")) {
7961      JsonArray array = json.getAsJsonArray("party");
7962      for (int i = 0; i < array.size(); i++) {
7963        res.getParty().add(parseContractContractPartyComponent(array.get(i).getAsJsonObject(), owner));
7964      }
7965    };
7966    if (json.has("topic"))
7967      res.setTopic(parseReference(getJObject(json, "topic")));
7968    if (json.has("type"))
7969      res.setType(parseCodeableConcept(getJObject(json, "type")));
7970    if (json.has("decision"))
7971      res.setDecision(parseCodeableConcept(getJObject(json, "decision")));
7972    if (json.has("decisionMode")) {
7973      JsonArray array = json.getAsJsonArray("decisionMode");
7974      for (int i = 0; i < array.size(); i++) {
7975        res.getDecisionMode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7976      }
7977    };
7978    if (json.has("answer")) {
7979      JsonArray array = json.getAsJsonArray("answer");
7980      for (int i = 0; i < array.size(); i++) {
7981        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
7982      }
7983    };
7984    if (json.has("text"))
7985      res.setTextElement(parseString(json.get("text").getAsString()));
7986    if (json.has("_text"))
7987      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
7988    if (json.has("linkId")) {
7989      JsonArray array = json.getAsJsonArray("linkId");
7990      for (int i = 0; i < array.size(); i++) {
7991        if (array.get(i).isJsonNull()) {
7992          res.getLinkId().add(new StringType());
7993        } else {
7994          res.getLinkId().add(parseString(array.get(i).getAsString()));
7995        }
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("securityLabelNumber")) {
8008      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8009      for (int i = 0; i < array.size(); i++) {
8010        if (array.get(i).isJsonNull()) {
8011          res.getSecurityLabelNumber().add(new UnsignedIntType());
8012        } else {
8013          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8014        }
8015      }
8016    };
8017    if (json.has("_securityLabelNumber")) {
8018      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8019      for (int i = 0; i < array.size(); i++) {
8020        if (i == res.getSecurityLabelNumber().size())
8021          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8022        if (array.get(i) instanceof JsonObject) 
8023          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8024      }
8025    };
8026  }
8027
8028  protected Contract.ContractPartyComponent parseContractContractPartyComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8029    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
8030    parseContractContractPartyComponentProperties(json, owner, res);
8031    return res;
8032  }
8033
8034  protected void parseContractContractPartyComponentProperties(JsonObject json, Contract owner, Contract.ContractPartyComponent res) throws IOException, FHIRFormatError {
8035    parseBackboneElementProperties(json, res);
8036    if (json.has("reference")) {
8037      JsonArray array = json.getAsJsonArray("reference");
8038      for (int i = 0; i < array.size(); i++) {
8039        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
8040      }
8041    };
8042    if (json.has("role"))
8043      res.setRole(parseCodeableConcept(getJObject(json, "role")));
8044  }
8045
8046  protected Contract.AnswerComponent parseContractAnswerComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8047    Contract.AnswerComponent res = new Contract.AnswerComponent();
8048    parseContractAnswerComponentProperties(json, owner, res);
8049    return res;
8050  }
8051
8052  protected void parseContractAnswerComponentProperties(JsonObject json, Contract owner, Contract.AnswerComponent res) throws IOException, FHIRFormatError {
8053    parseBackboneElementProperties(json, res);
8054    Type value = parseType("value", json);
8055    if (value != null)
8056      res.setValue(value);
8057  }
8058
8059  protected Contract.ContractAssetComponent parseContractContractAssetComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8060    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
8061    parseContractContractAssetComponentProperties(json, owner, res);
8062    return res;
8063  }
8064
8065  protected void parseContractContractAssetComponentProperties(JsonObject json, Contract owner, Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
8066    parseBackboneElementProperties(json, res);
8067    if (json.has("scope"))
8068      res.setScope(parseCodeableConcept(getJObject(json, "scope")));
8069    if (json.has("type")) {
8070      JsonArray array = json.getAsJsonArray("type");
8071      for (int i = 0; i < array.size(); i++) {
8072        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8073      }
8074    };
8075    if (json.has("typeReference")) {
8076      JsonArray array = json.getAsJsonArray("typeReference");
8077      for (int i = 0; i < array.size(); i++) {
8078        res.getTypeReference().add(parseReference(array.get(i).getAsJsonObject()));
8079      }
8080    };
8081    if (json.has("subtype")) {
8082      JsonArray array = json.getAsJsonArray("subtype");
8083      for (int i = 0; i < array.size(); i++) {
8084        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8085      }
8086    };
8087    if (json.has("relationship"))
8088      res.setRelationship(parseCoding(getJObject(json, "relationship")));
8089    if (json.has("context")) {
8090      JsonArray array = json.getAsJsonArray("context");
8091      for (int i = 0; i < array.size(); i++) {
8092        res.getContext().add(parseContractAssetContextComponent(array.get(i).getAsJsonObject(), owner));
8093      }
8094    };
8095    if (json.has("condition"))
8096      res.setConditionElement(parseString(json.get("condition").getAsString()));
8097    if (json.has("_condition"))
8098      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
8099    if (json.has("periodType")) {
8100      JsonArray array = json.getAsJsonArray("periodType");
8101      for (int i = 0; i < array.size(); i++) {
8102        res.getPeriodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8103      }
8104    };
8105    if (json.has("period")) {
8106      JsonArray array = json.getAsJsonArray("period");
8107      for (int i = 0; i < array.size(); i++) {
8108        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
8109      }
8110    };
8111    if (json.has("usePeriod")) {
8112      JsonArray array = json.getAsJsonArray("usePeriod");
8113      for (int i = 0; i < array.size(); i++) {
8114        res.getUsePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
8115      }
8116    };
8117    if (json.has("text"))
8118      res.setTextElement(parseString(json.get("text").getAsString()));
8119    if (json.has("_text"))
8120      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
8121    if (json.has("linkId")) {
8122      JsonArray array = json.getAsJsonArray("linkId");
8123      for (int i = 0; i < array.size(); i++) {
8124        if (array.get(i).isJsonNull()) {
8125          res.getLinkId().add(new StringType());
8126        } else {
8127          res.getLinkId().add(parseString(array.get(i).getAsString()));
8128        }
8129      }
8130    };
8131    if (json.has("_linkId")) {
8132      JsonArray array = json.getAsJsonArray("_linkId");
8133      for (int i = 0; i < array.size(); i++) {
8134        if (i == res.getLinkId().size())
8135          res.getLinkId().add(parseString(null));
8136        if (array.get(i) instanceof JsonObject) 
8137          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
8138      }
8139    };
8140    if (json.has("answer")) {
8141      JsonArray array = json.getAsJsonArray("answer");
8142      for (int i = 0; i < array.size(); i++) {
8143        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
8144      }
8145    };
8146    if (json.has("securityLabelNumber")) {
8147      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8148      for (int i = 0; i < array.size(); i++) {
8149        if (array.get(i).isJsonNull()) {
8150          res.getSecurityLabelNumber().add(new UnsignedIntType());
8151        } else {
8152          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8153        }
8154      }
8155    };
8156    if (json.has("_securityLabelNumber")) {
8157      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8158      for (int i = 0; i < array.size(); i++) {
8159        if (i == res.getSecurityLabelNumber().size())
8160          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8161        if (array.get(i) instanceof JsonObject) 
8162          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8163      }
8164    };
8165    if (json.has("valuedItem")) {
8166      JsonArray array = json.getAsJsonArray("valuedItem");
8167      for (int i = 0; i < array.size(); i++) {
8168        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), owner));
8169      }
8170    };
8171  }
8172
8173  protected Contract.AssetContextComponent parseContractAssetContextComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8174    Contract.AssetContextComponent res = new Contract.AssetContextComponent();
8175    parseContractAssetContextComponentProperties(json, owner, res);
8176    return res;
8177  }
8178
8179  protected void parseContractAssetContextComponentProperties(JsonObject json, Contract owner, Contract.AssetContextComponent res) throws IOException, FHIRFormatError {
8180    parseBackboneElementProperties(json, res);
8181    if (json.has("reference"))
8182      res.setReference(parseReference(getJObject(json, "reference")));
8183    if (json.has("code")) {
8184      JsonArray array = json.getAsJsonArray("code");
8185      for (int i = 0; i < array.size(); i++) {
8186        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8187      }
8188    };
8189    if (json.has("text"))
8190      res.setTextElement(parseString(json.get("text").getAsString()));
8191    if (json.has("_text"))
8192      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
8193  }
8194
8195  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8196    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
8197    parseContractValuedItemComponentProperties(json, owner, res);
8198    return res;
8199  }
8200
8201  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
8202    parseBackboneElementProperties(json, res);
8203    Type entity = parseType("entity", json);
8204    if (entity != null)
8205      res.setEntity(entity);
8206    if (json.has("identifier"))
8207      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
8208    if (json.has("effectiveTime"))
8209      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
8210    if (json.has("_effectiveTime"))
8211      parseElementProperties(getJObject(json, "_effectiveTime"), res.getEffectiveTimeElement());
8212    if (json.has("quantity"))
8213      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
8214    if (json.has("unitPrice"))
8215      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
8216    if (json.has("factor"))
8217      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
8218    if (json.has("_factor"))
8219      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
8220    if (json.has("points"))
8221      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
8222    if (json.has("_points"))
8223      parseElementProperties(getJObject(json, "_points"), res.getPointsElement());
8224    if (json.has("net"))
8225      res.setNet(parseMoney(getJObject(json, "net")));
8226    if (json.has("payment"))
8227      res.setPaymentElement(parseString(json.get("payment").getAsString()));
8228    if (json.has("_payment"))
8229      parseElementProperties(getJObject(json, "_payment"), res.getPaymentElement());
8230    if (json.has("paymentDate"))
8231      res.setPaymentDateElement(parseDateTime(json.get("paymentDate").getAsString()));
8232    if (json.has("_paymentDate"))
8233      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
8234    if (json.has("responsible"))
8235      res.setResponsible(parseReference(getJObject(json, "responsible")));
8236    if (json.has("recipient"))
8237      res.setRecipient(parseReference(getJObject(json, "recipient")));
8238    if (json.has("linkId")) {
8239      JsonArray array = json.getAsJsonArray("linkId");
8240      for (int i = 0; i < array.size(); i++) {
8241        if (array.get(i).isJsonNull()) {
8242          res.getLinkId().add(new StringType());
8243        } else {
8244          res.getLinkId().add(parseString(array.get(i).getAsString()));
8245        }
8246      }
8247    };
8248    if (json.has("_linkId")) {
8249      JsonArray array = json.getAsJsonArray("_linkId");
8250      for (int i = 0; i < array.size(); i++) {
8251        if (i == res.getLinkId().size())
8252          res.getLinkId().add(parseString(null));
8253        if (array.get(i) instanceof JsonObject) 
8254          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
8255      }
8256    };
8257    if (json.has("securityLabelNumber")) {
8258      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8259      for (int i = 0; i < array.size(); i++) {
8260        if (array.get(i).isJsonNull()) {
8261          res.getSecurityLabelNumber().add(new UnsignedIntType());
8262        } else {
8263          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8264        }
8265      }
8266    };
8267    if (json.has("_securityLabelNumber")) {
8268      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8269      for (int i = 0; i < array.size(); i++) {
8270        if (i == res.getSecurityLabelNumber().size())
8271          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8272        if (array.get(i) instanceof JsonObject) 
8273          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8274      }
8275    };
8276  }
8277
8278  protected Contract.ActionComponent parseContractActionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8279    Contract.ActionComponent res = new Contract.ActionComponent();
8280    parseContractActionComponentProperties(json, owner, res);
8281    return res;
8282  }
8283
8284  protected void parseContractActionComponentProperties(JsonObject json, Contract owner, Contract.ActionComponent res) throws IOException, FHIRFormatError {
8285    parseBackboneElementProperties(json, res);
8286    if (json.has("doNotPerform"))
8287      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
8288    if (json.has("_doNotPerform"))
8289      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
8290    if (json.has("type"))
8291      res.setType(parseCodeableConcept(getJObject(json, "type")));
8292    if (json.has("subject")) {
8293      JsonArray array = json.getAsJsonArray("subject");
8294      for (int i = 0; i < array.size(); i++) {
8295        res.getSubject().add(parseContractActionSubjectComponent(array.get(i).getAsJsonObject(), owner));
8296      }
8297    };
8298    if (json.has("intent"))
8299      res.setIntent(parseCodeableConcept(getJObject(json, "intent")));
8300    if (json.has("linkId")) {
8301      JsonArray array = json.getAsJsonArray("linkId");
8302      for (int i = 0; i < array.size(); i++) {
8303        if (array.get(i).isJsonNull()) {
8304          res.getLinkId().add(new StringType());
8305        } else {
8306          res.getLinkId().add(parseString(array.get(i).getAsString()));
8307        }
8308      }
8309    };
8310    if (json.has("_linkId")) {
8311      JsonArray array = json.getAsJsonArray("_linkId");
8312      for (int i = 0; i < array.size(); i++) {
8313        if (i == res.getLinkId().size())
8314          res.getLinkId().add(parseString(null));
8315        if (array.get(i) instanceof JsonObject) 
8316          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
8317      }
8318    };
8319    if (json.has("status"))
8320      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
8321    if (json.has("context"))
8322      res.setContext(parseReference(getJObject(json, "context")));
8323    if (json.has("contextLinkId")) {
8324      JsonArray array = json.getAsJsonArray("contextLinkId");
8325      for (int i = 0; i < array.size(); i++) {
8326        if (array.get(i).isJsonNull()) {
8327          res.getContextLinkId().add(new StringType());
8328        } else {
8329          res.getContextLinkId().add(parseString(array.get(i).getAsString()));
8330        }
8331      }
8332    };
8333    if (json.has("_contextLinkId")) {
8334      JsonArray array = json.getAsJsonArray("_contextLinkId");
8335      for (int i = 0; i < array.size(); i++) {
8336        if (i == res.getContextLinkId().size())
8337          res.getContextLinkId().add(parseString(null));
8338        if (array.get(i) instanceof JsonObject) 
8339          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextLinkId().get(i));
8340      }
8341    };
8342    Type occurrence = parseType("occurrence", json);
8343    if (occurrence != null)
8344      res.setOccurrence(occurrence);
8345    if (json.has("requester")) {
8346      JsonArray array = json.getAsJsonArray("requester");
8347      for (int i = 0; i < array.size(); i++) {
8348        res.getRequester().add(parseReference(array.get(i).getAsJsonObject()));
8349      }
8350    };
8351    if (json.has("requesterLinkId")) {
8352      JsonArray array = json.getAsJsonArray("requesterLinkId");
8353      for (int i = 0; i < array.size(); i++) {
8354        if (array.get(i).isJsonNull()) {
8355          res.getRequesterLinkId().add(new StringType());
8356        } else {
8357          res.getRequesterLinkId().add(parseString(array.get(i).getAsString()));
8358        }
8359      }
8360    };
8361    if (json.has("_requesterLinkId")) {
8362      JsonArray array = json.getAsJsonArray("_requesterLinkId");
8363      for (int i = 0; i < array.size(); i++) {
8364        if (i == res.getRequesterLinkId().size())
8365          res.getRequesterLinkId().add(parseString(null));
8366        if (array.get(i) instanceof JsonObject) 
8367          parseElementProperties(array.get(i).getAsJsonObject(), res.getRequesterLinkId().get(i));
8368      }
8369    };
8370    if (json.has("performerType")) {
8371      JsonArray array = json.getAsJsonArray("performerType");
8372      for (int i = 0; i < array.size(); i++) {
8373        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8374      }
8375    };
8376    if (json.has("performerRole"))
8377      res.setPerformerRole(parseCodeableConcept(getJObject(json, "performerRole")));
8378    if (json.has("performer"))
8379      res.setPerformer(parseReference(getJObject(json, "performer")));
8380    if (json.has("performerLinkId")) {
8381      JsonArray array = json.getAsJsonArray("performerLinkId");
8382      for (int i = 0; i < array.size(); i++) {
8383        if (array.get(i).isJsonNull()) {
8384          res.getPerformerLinkId().add(new StringType());
8385        } else {
8386          res.getPerformerLinkId().add(parseString(array.get(i).getAsString()));
8387        }
8388      }
8389    };
8390    if (json.has("_performerLinkId")) {
8391      JsonArray array = json.getAsJsonArray("_performerLinkId");
8392      for (int i = 0; i < array.size(); i++) {
8393        if (i == res.getPerformerLinkId().size())
8394          res.getPerformerLinkId().add(parseString(null));
8395        if (array.get(i) instanceof JsonObject) 
8396          parseElementProperties(array.get(i).getAsJsonObject(), res.getPerformerLinkId().get(i));
8397      }
8398    };
8399    if (json.has("reasonCode")) {
8400      JsonArray array = json.getAsJsonArray("reasonCode");
8401      for (int i = 0; i < array.size(); i++) {
8402        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8403      }
8404    };
8405    if (json.has("reasonReference")) {
8406      JsonArray array = json.getAsJsonArray("reasonReference");
8407      for (int i = 0; i < array.size(); i++) {
8408        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
8409      }
8410    };
8411    if (json.has("reason")) {
8412      JsonArray array = json.getAsJsonArray("reason");
8413      for (int i = 0; i < array.size(); i++) {
8414        if (array.get(i).isJsonNull()) {
8415          res.getReason().add(new StringType());
8416        } else {
8417          res.getReason().add(parseString(array.get(i).getAsString()));
8418        }
8419      }
8420    };
8421    if (json.has("_reason")) {
8422      JsonArray array = json.getAsJsonArray("_reason");
8423      for (int i = 0; i < array.size(); i++) {
8424        if (i == res.getReason().size())
8425          res.getReason().add(parseString(null));
8426        if (array.get(i) instanceof JsonObject) 
8427          parseElementProperties(array.get(i).getAsJsonObject(), res.getReason().get(i));
8428      }
8429    };
8430    if (json.has("reasonLinkId")) {
8431      JsonArray array = json.getAsJsonArray("reasonLinkId");
8432      for (int i = 0; i < array.size(); i++) {
8433        if (array.get(i).isJsonNull()) {
8434          res.getReasonLinkId().add(new StringType());
8435        } else {
8436          res.getReasonLinkId().add(parseString(array.get(i).getAsString()));
8437        }
8438      }
8439    };
8440    if (json.has("_reasonLinkId")) {
8441      JsonArray array = json.getAsJsonArray("_reasonLinkId");
8442      for (int i = 0; i < array.size(); i++) {
8443        if (i == res.getReasonLinkId().size())
8444          res.getReasonLinkId().add(parseString(null));
8445        if (array.get(i) instanceof JsonObject) 
8446          parseElementProperties(array.get(i).getAsJsonObject(), res.getReasonLinkId().get(i));
8447      }
8448    };
8449    if (json.has("note")) {
8450      JsonArray array = json.getAsJsonArray("note");
8451      for (int i = 0; i < array.size(); i++) {
8452        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8453      }
8454    };
8455    if (json.has("securityLabelNumber")) {
8456      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8457      for (int i = 0; i < array.size(); i++) {
8458        if (array.get(i).isJsonNull()) {
8459          res.getSecurityLabelNumber().add(new UnsignedIntType());
8460        } else {
8461          res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8462        }
8463      }
8464    };
8465    if (json.has("_securityLabelNumber")) {
8466      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8467      for (int i = 0; i < array.size(); i++) {
8468        if (i == res.getSecurityLabelNumber().size())
8469          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8470        if (array.get(i) instanceof JsonObject) 
8471          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8472      }
8473    };
8474  }
8475
8476  protected Contract.ActionSubjectComponent parseContractActionSubjectComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8477    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
8478    parseContractActionSubjectComponentProperties(json, owner, res);
8479    return res;
8480  }
8481
8482  protected void parseContractActionSubjectComponentProperties(JsonObject json, Contract owner, Contract.ActionSubjectComponent res) throws IOException, FHIRFormatError {
8483    parseBackboneElementProperties(json, res);
8484    if (json.has("reference")) {
8485      JsonArray array = json.getAsJsonArray("reference");
8486      for (int i = 0; i < array.size(); i++) {
8487        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
8488      }
8489    };
8490    if (json.has("role"))
8491      res.setRole(parseCodeableConcept(getJObject(json, "role")));
8492  }
8493
8494  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8495    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
8496    parseContractSignatoryComponentProperties(json, owner, res);
8497    return res;
8498  }
8499
8500  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
8501    parseBackboneElementProperties(json, res);
8502    if (json.has("type"))
8503      res.setType(parseCoding(getJObject(json, "type")));
8504    if (json.has("party"))
8505      res.setParty(parseReference(getJObject(json, "party")));
8506    if (json.has("signature")) {
8507      JsonArray array = json.getAsJsonArray("signature");
8508      for (int i = 0; i < array.size(); i++) {
8509        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
8510      }
8511    };
8512  }
8513
8514  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8515    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
8516    parseContractFriendlyLanguageComponentProperties(json, owner, res);
8517    return res;
8518  }
8519
8520  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
8521    parseBackboneElementProperties(json, res);
8522    Type content = parseType("content", json);
8523    if (content != null)
8524      res.setContent(content);
8525  }
8526
8527  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8528    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
8529    parseContractLegalLanguageComponentProperties(json, owner, res);
8530    return res;
8531  }
8532
8533  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
8534    parseBackboneElementProperties(json, res);
8535    Type content = parseType("content", json);
8536    if (content != null)
8537      res.setContent(content);
8538  }
8539
8540  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8541    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
8542    parseContractComputableLanguageComponentProperties(json, owner, res);
8543    return res;
8544  }
8545
8546  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
8547    parseBackboneElementProperties(json, res);
8548    Type content = parseType("content", json);
8549    if (content != null)
8550      res.setContent(content);
8551  }
8552
8553  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
8554    Coverage res = new Coverage();
8555    parseCoverageProperties(json, res);
8556    return res;
8557  }
8558
8559  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
8560    parseDomainResourceProperties(json, res);
8561    if (json.has("identifier")) {
8562      JsonArray array = json.getAsJsonArray("identifier");
8563      for (int i = 0; i < array.size(); i++) {
8564        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8565      }
8566    };
8567    if (json.has("status"))
8568      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
8569    if (json.has("_status"))
8570      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8571    if (json.has("type"))
8572      res.setType(parseCodeableConcept(getJObject(json, "type")));
8573    if (json.has("policyHolder"))
8574      res.setPolicyHolder(parseReference(getJObject(json, "policyHolder")));
8575    if (json.has("subscriber"))
8576      res.setSubscriber(parseReference(getJObject(json, "subscriber")));
8577    if (json.has("subscriberId"))
8578      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
8579    if (json.has("_subscriberId"))
8580      parseElementProperties(getJObject(json, "_subscriberId"), res.getSubscriberIdElement());
8581    if (json.has("beneficiary"))
8582      res.setBeneficiary(parseReference(getJObject(json, "beneficiary")));
8583    if (json.has("dependent"))
8584      res.setDependentElement(parseString(json.get("dependent").getAsString()));
8585    if (json.has("_dependent"))
8586      parseElementProperties(getJObject(json, "_dependent"), res.getDependentElement());
8587    if (json.has("relationship"))
8588      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
8589    if (json.has("period"))
8590      res.setPeriod(parsePeriod(getJObject(json, "period")));
8591    if (json.has("payor")) {
8592      JsonArray array = json.getAsJsonArray("payor");
8593      for (int i = 0; i < array.size(); i++) {
8594        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
8595      }
8596    };
8597    if (json.has("class")) {
8598      JsonArray array = json.getAsJsonArray("class");
8599      for (int i = 0; i < array.size(); i++) {
8600        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject(), res));
8601      }
8602    };
8603    if (json.has("order"))
8604      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
8605    if (json.has("_order"))
8606      parseElementProperties(getJObject(json, "_order"), res.getOrderElement());
8607    if (json.has("network"))
8608      res.setNetworkElement(parseString(json.get("network").getAsString()));
8609    if (json.has("_network"))
8610      parseElementProperties(getJObject(json, "_network"), res.getNetworkElement());
8611    if (json.has("costToBeneficiary")) {
8612      JsonArray array = json.getAsJsonArray("costToBeneficiary");
8613      for (int i = 0; i < array.size(); i++) {
8614        res.getCostToBeneficiary().add(parseCoverageCostToBeneficiaryComponent(array.get(i).getAsJsonObject(), res));
8615      }
8616    };
8617    if (json.has("subrogation"))
8618      res.setSubrogationElement(parseBoolean(json.get("subrogation").getAsBoolean()));
8619    if (json.has("_subrogation"))
8620      parseElementProperties(getJObject(json, "_subrogation"), res.getSubrogationElement());
8621    if (json.has("contract")) {
8622      JsonArray array = json.getAsJsonArray("contract");
8623      for (int i = 0; i < array.size(); i++) {
8624        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
8625      }
8626    };
8627  }
8628
8629  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8630    Coverage.ClassComponent res = new Coverage.ClassComponent();
8631    parseCoverageClassComponentProperties(json, owner, res);
8632    return res;
8633  }
8634
8635  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage owner, Coverage.ClassComponent res) throws IOException, FHIRFormatError {
8636    parseBackboneElementProperties(json, res);
8637    if (json.has("type"))
8638      res.setType(parseCodeableConcept(getJObject(json, "type")));
8639    if (json.has("value"))
8640      res.setValueElement(parseString(json.get("value").getAsString()));
8641    if (json.has("_value"))
8642      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
8643    if (json.has("name"))
8644      res.setNameElement(parseString(json.get("name").getAsString()));
8645    if (json.has("_name"))
8646      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8647  }
8648
8649  protected Coverage.CostToBeneficiaryComponent parseCoverageCostToBeneficiaryComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8650    Coverage.CostToBeneficiaryComponent res = new Coverage.CostToBeneficiaryComponent();
8651    parseCoverageCostToBeneficiaryComponentProperties(json, owner, res);
8652    return res;
8653  }
8654
8655  protected void parseCoverageCostToBeneficiaryComponentProperties(JsonObject json, Coverage owner, Coverage.CostToBeneficiaryComponent res) throws IOException, FHIRFormatError {
8656    parseBackboneElementProperties(json, res);
8657    if (json.has("type"))
8658      res.setType(parseCodeableConcept(getJObject(json, "type")));
8659    Type value = parseType("value", json);
8660    if (value != null)
8661      res.setValue(value);
8662    if (json.has("exception")) {
8663      JsonArray array = json.getAsJsonArray("exception");
8664      for (int i = 0; i < array.size(); i++) {
8665        res.getException().add(parseCoverageExemptionComponent(array.get(i).getAsJsonObject(), owner));
8666      }
8667    };
8668  }
8669
8670  protected Coverage.ExemptionComponent parseCoverageExemptionComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8671    Coverage.ExemptionComponent res = new Coverage.ExemptionComponent();
8672    parseCoverageExemptionComponentProperties(json, owner, res);
8673    return res;
8674  }
8675
8676  protected void parseCoverageExemptionComponentProperties(JsonObject json, Coverage owner, Coverage.ExemptionComponent res) throws IOException, FHIRFormatError {
8677    parseBackboneElementProperties(json, res);
8678    if (json.has("type"))
8679      res.setType(parseCodeableConcept(getJObject(json, "type")));
8680    if (json.has("period"))
8681      res.setPeriod(parsePeriod(getJObject(json, "period")));
8682  }
8683
8684  protected CoverageEligibilityRequest parseCoverageEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
8685    CoverageEligibilityRequest res = new CoverageEligibilityRequest();
8686    parseCoverageEligibilityRequestProperties(json, res);
8687    return res;
8688  }
8689
8690  protected void parseCoverageEligibilityRequestProperties(JsonObject json, CoverageEligibilityRequest res) throws IOException, FHIRFormatError {
8691    parseDomainResourceProperties(json, res);
8692    if (json.has("identifier")) {
8693      JsonArray array = json.getAsJsonArray("identifier");
8694      for (int i = 0; i < array.size(); i++) {
8695        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8696      }
8697    };
8698    if (json.has("status"))
8699      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityRequest.EligibilityRequestStatus.NULL, new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory()));
8700    if (json.has("_status"))
8701      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8702    if (json.has("priority"))
8703      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
8704    if (json.has("purpose")) {
8705      JsonArray array = json.getAsJsonArray("purpose");
8706      for (int i = 0; i < array.size(); i++) {
8707        if (array.get(i).isJsonNull()) {
8708          res.getPurpose().add(new Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose>());
8709        } else {
8710          res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
8711        }
8712      }
8713    };
8714    if (json.has("_purpose")) {
8715      JsonArray array = json.getAsJsonArray("_purpose");
8716      for (int i = 0; i < array.size(); i++) {
8717        if (i == res.getPurpose().size())
8718          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
8719        if (array.get(i) instanceof JsonObject) 
8720          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
8721      }
8722    };
8723    if (json.has("patient"))
8724      res.setPatient(parseReference(getJObject(json, "patient")));
8725    Type serviced = parseType("serviced", json);
8726    if (serviced != null)
8727      res.setServiced(serviced);
8728    if (json.has("created"))
8729      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8730    if (json.has("_created"))
8731      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8732    if (json.has("enterer"))
8733      res.setEnterer(parseReference(getJObject(json, "enterer")));
8734    if (json.has("provider"))
8735      res.setProvider(parseReference(getJObject(json, "provider")));
8736    if (json.has("insurer"))
8737      res.setInsurer(parseReference(getJObject(json, "insurer")));
8738    if (json.has("facility"))
8739      res.setFacility(parseReference(getJObject(json, "facility")));
8740    if (json.has("supportingInfo")) {
8741      JsonArray array = json.getAsJsonArray("supportingInfo");
8742      for (int i = 0; i < array.size(); i++) {
8743        res.getSupportingInfo().add(parseCoverageEligibilityRequestSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
8744      }
8745    };
8746    if (json.has("insurance")) {
8747      JsonArray array = json.getAsJsonArray("insurance");
8748      for (int i = 0; i < array.size(); i++) {
8749        res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(array.get(i).getAsJsonObject(), res));
8750      }
8751    };
8752    if (json.has("item")) {
8753      JsonArray array = json.getAsJsonArray("item");
8754      for (int i = 0; i < array.size(); i++) {
8755        res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(array.get(i).getAsJsonObject(), res));
8756      }
8757    };
8758  }
8759
8760  protected CoverageEligibilityRequest.SupportingInformationComponent parseCoverageEligibilityRequestSupportingInformationComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8761    CoverageEligibilityRequest.SupportingInformationComponent res = new CoverageEligibilityRequest.SupportingInformationComponent();
8762    parseCoverageEligibilityRequestSupportingInformationComponentProperties(json, owner, res);
8763    return res;
8764  }
8765
8766  protected void parseCoverageEligibilityRequestSupportingInformationComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.SupportingInformationComponent res) throws IOException, FHIRFormatError {
8767    parseBackboneElementProperties(json, res);
8768    if (json.has("sequence"))
8769      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8770    if (json.has("_sequence"))
8771      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
8772    if (json.has("information"))
8773      res.setInformation(parseReference(getJObject(json, "information")));
8774    if (json.has("appliesToAll"))
8775      res.setAppliesToAllElement(parseBoolean(json.get("appliesToAll").getAsBoolean()));
8776    if (json.has("_appliesToAll"))
8777      parseElementProperties(getJObject(json, "_appliesToAll"), res.getAppliesToAllElement());
8778  }
8779
8780  protected CoverageEligibilityRequest.InsuranceComponent parseCoverageEligibilityRequestInsuranceComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8781    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
8782    parseCoverageEligibilityRequestInsuranceComponentProperties(json, owner, res);
8783    return res;
8784  }
8785
8786  protected void parseCoverageEligibilityRequestInsuranceComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.InsuranceComponent res) throws IOException, FHIRFormatError {
8787    parseBackboneElementProperties(json, res);
8788    if (json.has("focal"))
8789      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
8790    if (json.has("_focal"))
8791      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
8792    if (json.has("coverage"))
8793      res.setCoverage(parseReference(getJObject(json, "coverage")));
8794    if (json.has("businessArrangement"))
8795      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
8796    if (json.has("_businessArrangement"))
8797      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
8798  }
8799
8800  protected CoverageEligibilityRequest.DetailsComponent parseCoverageEligibilityRequestDetailsComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8801    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
8802    parseCoverageEligibilityRequestDetailsComponentProperties(json, owner, res);
8803    return res;
8804  }
8805
8806  protected void parseCoverageEligibilityRequestDetailsComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DetailsComponent res) throws IOException, FHIRFormatError {
8807    parseBackboneElementProperties(json, res);
8808    if (json.has("supportingInfoSequence")) {
8809      JsonArray array = json.getAsJsonArray("supportingInfoSequence");
8810      for (int i = 0; i < array.size(); i++) {
8811        if (array.get(i).isJsonNull()) {
8812          res.getSupportingInfoSequence().add(new PositiveIntType());
8813        } else {
8814          res.getSupportingInfoSequence().add(parsePositiveInt(array.get(i).getAsString()));
8815        }
8816      }
8817    };
8818    if (json.has("_supportingInfoSequence")) {
8819      JsonArray array = json.getAsJsonArray("_supportingInfoSequence");
8820      for (int i = 0; i < array.size(); i++) {
8821        if (i == res.getSupportingInfoSequence().size())
8822          res.getSupportingInfoSequence().add(parsePositiveInt(null));
8823        if (array.get(i) instanceof JsonObject) 
8824          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportingInfoSequence().get(i));
8825      }
8826    };
8827    if (json.has("category"))
8828      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
8829    if (json.has("productOrService"))
8830      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
8831    if (json.has("modifier")) {
8832      JsonArray array = json.getAsJsonArray("modifier");
8833      for (int i = 0; i < array.size(); i++) {
8834        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8835      }
8836    };
8837    if (json.has("provider"))
8838      res.setProvider(parseReference(getJObject(json, "provider")));
8839    if (json.has("quantity"))
8840      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
8841    if (json.has("unitPrice"))
8842      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
8843    if (json.has("facility"))
8844      res.setFacility(parseReference(getJObject(json, "facility")));
8845    if (json.has("diagnosis")) {
8846      JsonArray array = json.getAsJsonArray("diagnosis");
8847      for (int i = 0; i < array.size(); i++) {
8848        res.getDiagnosis().add(parseCoverageEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject(), owner));
8849      }
8850    };
8851    if (json.has("detail")) {
8852      JsonArray array = json.getAsJsonArray("detail");
8853      for (int i = 0; i < array.size(); i++) {
8854        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8855      }
8856    };
8857  }
8858
8859  protected CoverageEligibilityRequest.DiagnosisComponent parseCoverageEligibilityRequestDiagnosisComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8860    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
8861    parseCoverageEligibilityRequestDiagnosisComponentProperties(json, owner, res);
8862    return res;
8863  }
8864
8865  protected void parseCoverageEligibilityRequestDiagnosisComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DiagnosisComponent res) throws IOException, FHIRFormatError {
8866    parseBackboneElementProperties(json, res);
8867    Type diagnosis = parseType("diagnosis", json);
8868    if (diagnosis != null)
8869      res.setDiagnosis(diagnosis);
8870  }
8871
8872  protected CoverageEligibilityResponse parseCoverageEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
8873    CoverageEligibilityResponse res = new CoverageEligibilityResponse();
8874    parseCoverageEligibilityResponseProperties(json, res);
8875    return res;
8876  }
8877
8878  protected void parseCoverageEligibilityResponseProperties(JsonObject json, CoverageEligibilityResponse res) throws IOException, FHIRFormatError {
8879    parseDomainResourceProperties(json, res);
8880    if (json.has("identifier")) {
8881      JsonArray array = json.getAsJsonArray("identifier");
8882      for (int i = 0; i < array.size(); i++) {
8883        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8884      }
8885    };
8886    if (json.has("status"))
8887      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityResponse.EligibilityResponseStatus.NULL, new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory()));
8888    if (json.has("_status"))
8889      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8890    if (json.has("purpose")) {
8891      JsonArray array = json.getAsJsonArray("purpose");
8892      for (int i = 0; i < array.size(); i++) {
8893        if (array.get(i).isJsonNull()) {
8894          res.getPurpose().add(new Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose>());
8895        } else {
8896          res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
8897        }
8898      }
8899    };
8900    if (json.has("_purpose")) {
8901      JsonArray array = json.getAsJsonArray("_purpose");
8902      for (int i = 0; i < array.size(); i++) {
8903        if (i == res.getPurpose().size())
8904          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
8905        if (array.get(i) instanceof JsonObject) 
8906          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
8907      }
8908    };
8909    if (json.has("patient"))
8910      res.setPatient(parseReference(getJObject(json, "patient")));
8911    Type serviced = parseType("serviced", json);
8912    if (serviced != null)
8913      res.setServiced(serviced);
8914    if (json.has("created"))
8915      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8916    if (json.has("_created"))
8917      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8918    if (json.has("requestor"))
8919      res.setRequestor(parseReference(getJObject(json, "requestor")));
8920    if (json.has("request"))
8921      res.setRequest(parseReference(getJObject(json, "request")));
8922    if (json.has("outcome"))
8923      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
8924    if (json.has("_outcome"))
8925      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
8926    if (json.has("disposition"))
8927      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8928    if (json.has("_disposition"))
8929      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
8930    if (json.has("insurer"))
8931      res.setInsurer(parseReference(getJObject(json, "insurer")));
8932    if (json.has("insurance")) {
8933      JsonArray array = json.getAsJsonArray("insurance");
8934      for (int i = 0; i < array.size(); i++) {
8935        res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
8936      }
8937    };
8938    if (json.has("preAuthRef"))
8939      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
8940    if (json.has("_preAuthRef"))
8941      parseElementProperties(getJObject(json, "_preAuthRef"), res.getPreAuthRefElement());
8942    if (json.has("form"))
8943      res.setForm(parseCodeableConcept(getJObject(json, "form")));
8944    if (json.has("error")) {
8945      JsonArray array = json.getAsJsonArray("error");
8946      for (int i = 0; i < array.size(); i++) {
8947        res.getError().add(parseCoverageEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
8948      }
8949    };
8950  }
8951
8952  protected CoverageEligibilityResponse.InsuranceComponent parseCoverageEligibilityResponseInsuranceComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8953    CoverageEligibilityResponse.InsuranceComponent res = new CoverageEligibilityResponse.InsuranceComponent();
8954    parseCoverageEligibilityResponseInsuranceComponentProperties(json, owner, res);
8955    return res;
8956  }
8957
8958  protected void parseCoverageEligibilityResponseInsuranceComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
8959    parseBackboneElementProperties(json, res);
8960    if (json.has("coverage"))
8961      res.setCoverage(parseReference(getJObject(json, "coverage")));
8962    if (json.has("inforce"))
8963      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
8964    if (json.has("_inforce"))
8965      parseElementProperties(getJObject(json, "_inforce"), res.getInforceElement());
8966    if (json.has("benefitPeriod"))
8967      res.setBenefitPeriod(parsePeriod(getJObject(json, "benefitPeriod")));
8968    if (json.has("item")) {
8969      JsonArray array = json.getAsJsonArray("item");
8970      for (int i = 0; i < array.size(); i++) {
8971        res.getItem().add(parseCoverageEligibilityResponseItemsComponent(array.get(i).getAsJsonObject(), owner));
8972      }
8973    };
8974  }
8975
8976  protected CoverageEligibilityResponse.ItemsComponent parseCoverageEligibilityResponseItemsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8977    CoverageEligibilityResponse.ItemsComponent res = new CoverageEligibilityResponse.ItemsComponent();
8978    parseCoverageEligibilityResponseItemsComponentProperties(json, owner, res);
8979    return res;
8980  }
8981
8982  protected void parseCoverageEligibilityResponseItemsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ItemsComponent res) throws IOException, FHIRFormatError {
8983    parseBackboneElementProperties(json, res);
8984    if (json.has("category"))
8985      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
8986    if (json.has("productOrService"))
8987      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
8988    if (json.has("modifier")) {
8989      JsonArray array = json.getAsJsonArray("modifier");
8990      for (int i = 0; i < array.size(); i++) {
8991        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8992      }
8993    };
8994    if (json.has("provider"))
8995      res.setProvider(parseReference(getJObject(json, "provider")));
8996    if (json.has("excluded"))
8997      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
8998    if (json.has("_excluded"))
8999      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
9000    if (json.has("name"))
9001      res.setNameElement(parseString(json.get("name").getAsString()));
9002    if (json.has("_name"))
9003      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9004    if (json.has("description"))
9005      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9006    if (json.has("_description"))
9007      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
9008    if (json.has("network"))
9009      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
9010    if (json.has("unit"))
9011      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
9012    if (json.has("term"))
9013      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
9014    if (json.has("benefit")) {
9015      JsonArray array = json.getAsJsonArray("benefit");
9016      for (int i = 0; i < array.size(); i++) {
9017        res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
9018      }
9019    };
9020    if (json.has("authorizationRequired"))
9021      res.setAuthorizationRequiredElement(parseBoolean(json.get("authorizationRequired").getAsBoolean()));
9022    if (json.has("_authorizationRequired"))
9023      parseElementProperties(getJObject(json, "_authorizationRequired"), res.getAuthorizationRequiredElement());
9024    if (json.has("authorizationSupporting")) {
9025      JsonArray array = json.getAsJsonArray("authorizationSupporting");
9026      for (int i = 0; i < array.size(); i++) {
9027        res.getAuthorizationSupporting().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9028      }
9029    };
9030    if (json.has("authorizationUrl"))
9031      res.setAuthorizationUrlElement(parseUri(json.get("authorizationUrl").getAsString()));
9032    if (json.has("_authorizationUrl"))
9033      parseElementProperties(getJObject(json, "_authorizationUrl"), res.getAuthorizationUrlElement());
9034  }
9035
9036  protected CoverageEligibilityResponse.BenefitComponent parseCoverageEligibilityResponseBenefitComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
9037    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
9038    parseCoverageEligibilityResponseBenefitComponentProperties(json, owner, res);
9039    return res;
9040  }
9041
9042  protected void parseCoverageEligibilityResponseBenefitComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
9043    parseBackboneElementProperties(json, res);
9044    if (json.has("type"))
9045      res.setType(parseCodeableConcept(getJObject(json, "type")));
9046    Type allowed = parseType("allowed", json);
9047    if (allowed != null)
9048      res.setAllowed(allowed);
9049    Type used = parseType("used", json);
9050    if (used != null)
9051      res.setUsed(used);
9052  }
9053
9054  protected CoverageEligibilityResponse.ErrorsComponent parseCoverageEligibilityResponseErrorsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
9055    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
9056    parseCoverageEligibilityResponseErrorsComponentProperties(json, owner, res);
9057    return res;
9058  }
9059
9060  protected void parseCoverageEligibilityResponseErrorsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
9061    parseBackboneElementProperties(json, res);
9062    if (json.has("code"))
9063      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9064  }
9065
9066  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
9067    DetectedIssue res = new DetectedIssue();
9068    parseDetectedIssueProperties(json, res);
9069    return res;
9070  }
9071
9072  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
9073    parseDomainResourceProperties(json, res);
9074    if (json.has("identifier")) {
9075      JsonArray array = json.getAsJsonArray("identifier");
9076      for (int i = 0; i < array.size(); i++) {
9077        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9078      }
9079    };
9080    if (json.has("status"))
9081      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
9082    if (json.has("_status"))
9083      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9084    if (json.has("code"))
9085      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9086    if (json.has("severity"))
9087      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
9088    if (json.has("_severity"))
9089      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
9090    if (json.has("patient"))
9091      res.setPatient(parseReference(getJObject(json, "patient")));
9092    Type identified = parseType("identified", json);
9093    if (identified != null)
9094      res.setIdentified(identified);
9095    if (json.has("author"))
9096      res.setAuthor(parseReference(getJObject(json, "author")));
9097    if (json.has("implicated")) {
9098      JsonArray array = json.getAsJsonArray("implicated");
9099      for (int i = 0; i < array.size(); i++) {
9100        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
9101      }
9102    };
9103    if (json.has("evidence")) {
9104      JsonArray array = json.getAsJsonArray("evidence");
9105      for (int i = 0; i < array.size(); i++) {
9106        res.getEvidence().add(parseDetectedIssueDetectedIssueEvidenceComponent(array.get(i).getAsJsonObject(), res));
9107      }
9108    };
9109    if (json.has("detail"))
9110      res.setDetailElement(parseString(json.get("detail").getAsString()));
9111    if (json.has("_detail"))
9112      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
9113    if (json.has("reference"))
9114      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
9115    if (json.has("_reference"))
9116      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
9117    if (json.has("mitigation")) {
9118      JsonArray array = json.getAsJsonArray("mitigation");
9119      for (int i = 0; i < array.size(); i++) {
9120        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
9121      }
9122    };
9123  }
9124
9125  protected DetectedIssue.DetectedIssueEvidenceComponent parseDetectedIssueDetectedIssueEvidenceComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
9126    DetectedIssue.DetectedIssueEvidenceComponent res = new DetectedIssue.DetectedIssueEvidenceComponent();
9127    parseDetectedIssueDetectedIssueEvidenceComponentProperties(json, owner, res);
9128    return res;
9129  }
9130
9131  protected void parseDetectedIssueDetectedIssueEvidenceComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueEvidenceComponent res) throws IOException, FHIRFormatError {
9132    parseBackboneElementProperties(json, res);
9133    if (json.has("code")) {
9134      JsonArray array = json.getAsJsonArray("code");
9135      for (int i = 0; i < array.size(); i++) {
9136        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9137      }
9138    };
9139    if (json.has("detail")) {
9140      JsonArray array = json.getAsJsonArray("detail");
9141      for (int i = 0; i < array.size(); i++) {
9142        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
9143      }
9144    };
9145  }
9146
9147  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
9148    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
9149    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
9150    return res;
9151  }
9152
9153  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
9154    parseBackboneElementProperties(json, res);
9155    if (json.has("action"))
9156      res.setAction(parseCodeableConcept(getJObject(json, "action")));
9157    if (json.has("date"))
9158      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9159    if (json.has("_date"))
9160      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9161    if (json.has("author"))
9162      res.setAuthor(parseReference(getJObject(json, "author")));
9163  }
9164
9165  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
9166    Device res = new Device();
9167    parseDeviceProperties(json, res);
9168    return res;
9169  }
9170
9171  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
9172    parseDomainResourceProperties(json, res);
9173    if (json.has("identifier")) {
9174      JsonArray array = json.getAsJsonArray("identifier");
9175      for (int i = 0; i < array.size(); i++) {
9176        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9177      }
9178    };
9179    if (json.has("definition"))
9180      res.setDefinition(parseReference(getJObject(json, "definition")));
9181    if (json.has("udiCarrier")) {
9182      JsonArray array = json.getAsJsonArray("udiCarrier");
9183      for (int i = 0; i < array.size(); i++) {
9184        res.getUdiCarrier().add(parseDeviceDeviceUdiCarrierComponent(array.get(i).getAsJsonObject(), res));
9185      }
9186    };
9187    if (json.has("status"))
9188      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
9189    if (json.has("_status"))
9190      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9191    if (json.has("statusReason")) {
9192      JsonArray array = json.getAsJsonArray("statusReason");
9193      for (int i = 0; i < array.size(); i++) {
9194        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9195      }
9196    };
9197    if (json.has("distinctIdentifier"))
9198      res.setDistinctIdentifierElement(parseString(json.get("distinctIdentifier").getAsString()));
9199    if (json.has("_distinctIdentifier"))
9200      parseElementProperties(getJObject(json, "_distinctIdentifier"), res.getDistinctIdentifierElement());
9201    if (json.has("manufacturer"))
9202      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
9203    if (json.has("_manufacturer"))
9204      parseElementProperties(getJObject(json, "_manufacturer"), res.getManufacturerElement());
9205    if (json.has("manufactureDate"))
9206      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
9207    if (json.has("_manufactureDate"))
9208      parseElementProperties(getJObject(json, "_manufactureDate"), res.getManufactureDateElement());
9209    if (json.has("expirationDate"))
9210      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
9211    if (json.has("_expirationDate"))
9212      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
9213    if (json.has("lotNumber"))
9214      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
9215    if (json.has("_lotNumber"))
9216      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
9217    if (json.has("serialNumber"))
9218      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
9219    if (json.has("_serialNumber"))
9220      parseElementProperties(getJObject(json, "_serialNumber"), res.getSerialNumberElement());
9221    if (json.has("deviceName")) {
9222      JsonArray array = json.getAsJsonArray("deviceName");
9223      for (int i = 0; i < array.size(); i++) {
9224        res.getDeviceName().add(parseDeviceDeviceDeviceNameComponent(array.get(i).getAsJsonObject(), res));
9225      }
9226    };
9227    if (json.has("modelNumber"))
9228      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
9229    if (json.has("_modelNumber"))
9230      parseElementProperties(getJObject(json, "_modelNumber"), res.getModelNumberElement());
9231    if (json.has("partNumber"))
9232      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
9233    if (json.has("_partNumber"))
9234      parseElementProperties(getJObject(json, "_partNumber"), res.getPartNumberElement());
9235    if (json.has("type"))
9236      res.setType(parseCodeableConcept(getJObject(json, "type")));
9237    if (json.has("specialization")) {
9238      JsonArray array = json.getAsJsonArray("specialization");
9239      for (int i = 0; i < array.size(); i++) {
9240        res.getSpecialization().add(parseDeviceDeviceSpecializationComponent(array.get(i).getAsJsonObject(), res));
9241      }
9242    };
9243    if (json.has("version")) {
9244      JsonArray array = json.getAsJsonArray("version");
9245      for (int i = 0; i < array.size(); i++) {
9246        res.getVersion().add(parseDeviceDeviceVersionComponent(array.get(i).getAsJsonObject(), res));
9247      }
9248    };
9249    if (json.has("property")) {
9250      JsonArray array = json.getAsJsonArray("property");
9251      for (int i = 0; i < array.size(); i++) {
9252        res.getProperty().add(parseDeviceDevicePropertyComponent(array.get(i).getAsJsonObject(), res));
9253      }
9254    };
9255    if (json.has("patient"))
9256      res.setPatient(parseReference(getJObject(json, "patient")));
9257    if (json.has("owner"))
9258      res.setOwner(parseReference(getJObject(json, "owner")));
9259    if (json.has("contact")) {
9260      JsonArray array = json.getAsJsonArray("contact");
9261      for (int i = 0; i < array.size(); i++) {
9262        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
9263      }
9264    };
9265    if (json.has("location"))
9266      res.setLocation(parseReference(getJObject(json, "location")));
9267    if (json.has("url"))
9268      res.setUrlElement(parseUri(json.get("url").getAsString()));
9269    if (json.has("_url"))
9270      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
9271    if (json.has("note")) {
9272      JsonArray array = json.getAsJsonArray("note");
9273      for (int i = 0; i < array.size(); i++) {
9274        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9275      }
9276    };
9277    if (json.has("safety")) {
9278      JsonArray array = json.getAsJsonArray("safety");
9279      for (int i = 0; i < array.size(); i++) {
9280        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9281      }
9282    };
9283    if (json.has("parent"))
9284      res.setParent(parseReference(getJObject(json, "parent")));
9285  }
9286
9287  protected Device.DeviceUdiCarrierComponent parseDeviceDeviceUdiCarrierComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9288    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
9289    parseDeviceDeviceUdiCarrierComponentProperties(json, owner, res);
9290    return res;
9291  }
9292
9293  protected void parseDeviceDeviceUdiCarrierComponentProperties(JsonObject json, Device owner, Device.DeviceUdiCarrierComponent res) throws IOException, FHIRFormatError {
9294    parseBackboneElementProperties(json, res);
9295    if (json.has("deviceIdentifier"))
9296      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
9297    if (json.has("_deviceIdentifier"))
9298      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
9299    if (json.has("issuer"))
9300      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
9301    if (json.has("_issuer"))
9302      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
9303    if (json.has("jurisdiction"))
9304      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
9305    if (json.has("_jurisdiction"))
9306      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
9307    if (json.has("carrierAIDC"))
9308      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
9309    if (json.has("_carrierAIDC"))
9310      parseElementProperties(getJObject(json, "_carrierAIDC"), res.getCarrierAIDCElement());
9311    if (json.has("carrierHRF"))
9312      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
9313    if (json.has("_carrierHRF"))
9314      parseElementProperties(getJObject(json, "_carrierHRF"), res.getCarrierHRFElement());
9315    if (json.has("entryType"))
9316      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
9317    if (json.has("_entryType"))
9318      parseElementProperties(getJObject(json, "_entryType"), res.getEntryTypeElement());
9319  }
9320
9321  protected Device.DeviceDeviceNameComponent parseDeviceDeviceDeviceNameComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9322    Device.DeviceDeviceNameComponent res = new Device.DeviceDeviceNameComponent();
9323    parseDeviceDeviceDeviceNameComponentProperties(json, owner, res);
9324    return res;
9325  }
9326
9327  protected void parseDeviceDeviceDeviceNameComponentProperties(JsonObject json, Device owner, Device.DeviceDeviceNameComponent res) throws IOException, FHIRFormatError {
9328    parseBackboneElementProperties(json, res);
9329    if (json.has("name"))
9330      res.setNameElement(parseString(json.get("name").getAsString()));
9331    if (json.has("_name"))
9332      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9333    if (json.has("type"))
9334      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Device.DeviceNameType.NULL, new Device.DeviceNameTypeEnumFactory()));
9335    if (json.has("_type"))
9336      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
9337  }
9338
9339  protected Device.DeviceSpecializationComponent parseDeviceDeviceSpecializationComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9340    Device.DeviceSpecializationComponent res = new Device.DeviceSpecializationComponent();
9341    parseDeviceDeviceSpecializationComponentProperties(json, owner, res);
9342    return res;
9343  }
9344
9345  protected void parseDeviceDeviceSpecializationComponentProperties(JsonObject json, Device owner, Device.DeviceSpecializationComponent res) throws IOException, FHIRFormatError {
9346    parseBackboneElementProperties(json, res);
9347    if (json.has("systemType"))
9348      res.setSystemType(parseCodeableConcept(getJObject(json, "systemType")));
9349    if (json.has("version"))
9350      res.setVersionElement(parseString(json.get("version").getAsString()));
9351    if (json.has("_version"))
9352      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
9353  }
9354
9355  protected Device.DeviceVersionComponent parseDeviceDeviceVersionComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9356    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
9357    parseDeviceDeviceVersionComponentProperties(json, owner, res);
9358    return res;
9359  }
9360
9361  protected void parseDeviceDeviceVersionComponentProperties(JsonObject json, Device owner, Device.DeviceVersionComponent res) throws IOException, FHIRFormatError {
9362    parseBackboneElementProperties(json, res);
9363    if (json.has("type"))
9364      res.setType(parseCodeableConcept(getJObject(json, "type")));
9365    if (json.has("component"))
9366      res.setComponent(parseIdentifier(getJObject(json, "component")));
9367    if (json.has("value"))
9368      res.setValueElement(parseString(json.get("value").getAsString()));
9369    if (json.has("_value"))
9370      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
9371  }
9372
9373  protected Device.DevicePropertyComponent parseDeviceDevicePropertyComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9374    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
9375    parseDeviceDevicePropertyComponentProperties(json, owner, res);
9376    return res;
9377  }
9378
9379  protected void parseDeviceDevicePropertyComponentProperties(JsonObject json, Device owner, Device.DevicePropertyComponent res) throws IOException, FHIRFormatError {
9380    parseBackboneElementProperties(json, res);
9381    if (json.has("type"))
9382      res.setType(parseCodeableConcept(getJObject(json, "type")));
9383    if (json.has("valueQuantity")) {
9384      JsonArray array = json.getAsJsonArray("valueQuantity");
9385      for (int i = 0; i < array.size(); i++) {
9386        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
9387      }
9388    };
9389    if (json.has("valueCode")) {
9390      JsonArray array = json.getAsJsonArray("valueCode");
9391      for (int i = 0; i < array.size(); i++) {
9392        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9393      }
9394    };
9395  }
9396
9397  protected DeviceDefinition parseDeviceDefinition(JsonObject json) throws IOException, FHIRFormatError {
9398    DeviceDefinition res = new DeviceDefinition();
9399    parseDeviceDefinitionProperties(json, res);
9400    return res;
9401  }
9402
9403  protected void parseDeviceDefinitionProperties(JsonObject json, DeviceDefinition res) throws IOException, FHIRFormatError {
9404    parseDomainResourceProperties(json, res);
9405    if (json.has("identifier")) {
9406      JsonArray array = json.getAsJsonArray("identifier");
9407      for (int i = 0; i < array.size(); i++) {
9408        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9409      }
9410    };
9411    if (json.has("udiDeviceIdentifier")) {
9412      JsonArray array = json.getAsJsonArray("udiDeviceIdentifier");
9413      for (int i = 0; i < array.size(); i++) {
9414        res.getUdiDeviceIdentifier().add(parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject(), res));
9415      }
9416    };
9417    Type manufacturer = parseType("manufacturer", json);
9418    if (manufacturer != null)
9419      res.setManufacturer(manufacturer);
9420    if (json.has("deviceName")) {
9421      JsonArray array = json.getAsJsonArray("deviceName");
9422      for (int i = 0; i < array.size(); i++) {
9423        res.getDeviceName().add(parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(array.get(i).getAsJsonObject(), res));
9424      }
9425    };
9426    if (json.has("modelNumber"))
9427      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
9428    if (json.has("_modelNumber"))
9429      parseElementProperties(getJObject(json, "_modelNumber"), res.getModelNumberElement());
9430    if (json.has("type"))
9431      res.setType(parseCodeableConcept(getJObject(json, "type")));
9432    if (json.has("specialization")) {
9433      JsonArray array = json.getAsJsonArray("specialization");
9434      for (int i = 0; i < array.size(); i++) {
9435        res.getSpecialization().add(parseDeviceDefinitionDeviceDefinitionSpecializationComponent(array.get(i).getAsJsonObject(), res));
9436      }
9437    };
9438    if (json.has("version")) {
9439      JsonArray array = json.getAsJsonArray("version");
9440      for (int i = 0; i < array.size(); i++) {
9441        if (array.get(i).isJsonNull()) {
9442          res.getVersion().add(new StringType());
9443        } else {
9444          res.getVersion().add(parseString(array.get(i).getAsString()));
9445        }
9446      }
9447    };
9448    if (json.has("_version")) {
9449      JsonArray array = json.getAsJsonArray("_version");
9450      for (int i = 0; i < array.size(); i++) {
9451        if (i == res.getVersion().size())
9452          res.getVersion().add(parseString(null));
9453        if (array.get(i) instanceof JsonObject) 
9454          parseElementProperties(array.get(i).getAsJsonObject(), res.getVersion().get(i));
9455      }
9456    };
9457    if (json.has("safety")) {
9458      JsonArray array = json.getAsJsonArray("safety");
9459      for (int i = 0; i < array.size(); i++) {
9460        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9461      }
9462    };
9463    if (json.has("shelfLifeStorage")) {
9464      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
9465      for (int i = 0; i < array.size(); i++) {
9466        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
9467      }
9468    };
9469    if (json.has("physicalCharacteristics"))
9470      res.setPhysicalCharacteristics(parseProdCharacteristic(getJObject(json, "physicalCharacteristics")));
9471    if (json.has("languageCode")) {
9472      JsonArray array = json.getAsJsonArray("languageCode");
9473      for (int i = 0; i < array.size(); i++) {
9474        res.getLanguageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9475      }
9476    };
9477    if (json.has("capability")) {
9478      JsonArray array = json.getAsJsonArray("capability");
9479      for (int i = 0; i < array.size(); i++) {
9480        res.getCapability().add(parseDeviceDefinitionDeviceDefinitionCapabilityComponent(array.get(i).getAsJsonObject(), res));
9481      }
9482    };
9483    if (json.has("property")) {
9484      JsonArray array = json.getAsJsonArray("property");
9485      for (int i = 0; i < array.size(); i++) {
9486        res.getProperty().add(parseDeviceDefinitionDeviceDefinitionPropertyComponent(array.get(i).getAsJsonObject(), res));
9487      }
9488    };
9489    if (json.has("owner"))
9490      res.setOwner(parseReference(getJObject(json, "owner")));
9491    if (json.has("contact")) {
9492      JsonArray array = json.getAsJsonArray("contact");
9493      for (int i = 0; i < array.size(); i++) {
9494        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
9495      }
9496    };
9497    if (json.has("url"))
9498      res.setUrlElement(parseUri(json.get("url").getAsString()));
9499    if (json.has("_url"))
9500      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
9501    if (json.has("onlineInformation"))
9502      res.setOnlineInformationElement(parseUri(json.get("onlineInformation").getAsString()));
9503    if (json.has("_onlineInformation"))
9504      parseElementProperties(getJObject(json, "_onlineInformation"), res.getOnlineInformationElement());
9505    if (json.has("note")) {
9506      JsonArray array = json.getAsJsonArray("note");
9507      for (int i = 0; i < array.size(); i++) {
9508        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9509      }
9510    };
9511    if (json.has("quantity"))
9512      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
9513    if (json.has("parentDevice"))
9514      res.setParentDevice(parseReference(getJObject(json, "parentDevice")));
9515    if (json.has("material")) {
9516      JsonArray array = json.getAsJsonArray("material");
9517      for (int i = 0; i < array.size(); i++) {
9518        res.getMaterial().add(parseDeviceDefinitionDeviceDefinitionMaterialComponent(array.get(i).getAsJsonObject(), res));
9519      }
9520    };
9521  }
9522
9523  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9524    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
9525    parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(json, owner, res);
9526    return res;
9527  }
9528
9529  protected void parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res) throws IOException, FHIRFormatError {
9530    parseBackboneElementProperties(json, res);
9531    if (json.has("deviceIdentifier"))
9532      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
9533    if (json.has("_deviceIdentifier"))
9534      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
9535    if (json.has("issuer"))
9536      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
9537    if (json.has("_issuer"))
9538      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
9539    if (json.has("jurisdiction"))
9540      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
9541    if (json.has("_jurisdiction"))
9542      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
9543  }
9544
9545  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9546    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
9547    parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(json, owner, res);
9548    return res;
9549  }
9550
9551  protected void parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionDeviceNameComponent res) throws IOException, FHIRFormatError {
9552    parseBackboneElementProperties(json, res);
9553    if (json.has("name"))
9554      res.setNameElement(parseString(json.get("name").getAsString()));
9555    if (json.has("_name"))
9556      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9557    if (json.has("type"))
9558      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceDefinition.DeviceNameType.NULL, new DeviceDefinition.DeviceNameTypeEnumFactory()));
9559    if (json.has("_type"))
9560      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
9561  }
9562
9563  protected DeviceDefinition.DeviceDefinitionSpecializationComponent parseDeviceDefinitionDeviceDefinitionSpecializationComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9564    DeviceDefinition.DeviceDefinitionSpecializationComponent res = new DeviceDefinition.DeviceDefinitionSpecializationComponent();
9565    parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(json, owner, res);
9566    return res;
9567  }
9568
9569  protected void parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionSpecializationComponent res) throws IOException, FHIRFormatError {
9570    parseBackboneElementProperties(json, res);
9571    if (json.has("systemType"))
9572      res.setSystemTypeElement(parseString(json.get("systemType").getAsString()));
9573    if (json.has("_systemType"))
9574      parseElementProperties(getJObject(json, "_systemType"), res.getSystemTypeElement());
9575    if (json.has("version"))
9576      res.setVersionElement(parseString(json.get("version").getAsString()));
9577    if (json.has("_version"))
9578      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
9579  }
9580
9581  protected DeviceDefinition.DeviceDefinitionCapabilityComponent parseDeviceDefinitionDeviceDefinitionCapabilityComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9582    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
9583    parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(json, owner, res);
9584    return res;
9585  }
9586
9587  protected void parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionCapabilityComponent res) throws IOException, FHIRFormatError {
9588    parseBackboneElementProperties(json, res);
9589    if (json.has("type"))
9590      res.setType(parseCodeableConcept(getJObject(json, "type")));
9591    if (json.has("description")) {
9592      JsonArray array = json.getAsJsonArray("description");
9593      for (int i = 0; i < array.size(); i++) {
9594        res.getDescription().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9595      }
9596    };
9597  }
9598
9599  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionDeviceDefinitionPropertyComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9600    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
9601    parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(json, owner, res);
9602    return res;
9603  }
9604
9605  protected void parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
9606    parseBackboneElementProperties(json, res);
9607    if (json.has("type"))
9608      res.setType(parseCodeableConcept(getJObject(json, "type")));
9609    if (json.has("valueQuantity")) {
9610      JsonArray array = json.getAsJsonArray("valueQuantity");
9611      for (int i = 0; i < array.size(); i++) {
9612        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
9613      }
9614    };
9615    if (json.has("valueCode")) {
9616      JsonArray array = json.getAsJsonArray("valueCode");
9617      for (int i = 0; i < array.size(); i++) {
9618        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9619      }
9620    };
9621  }
9622
9623  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionDeviceDefinitionMaterialComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9624    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
9625    parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(json, owner, res);
9626    return res;
9627  }
9628
9629  protected void parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionMaterialComponent res) throws IOException, FHIRFormatError {
9630    parseBackboneElementProperties(json, res);
9631    if (json.has("substance"))
9632      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
9633    if (json.has("alternate"))
9634      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
9635    if (json.has("_alternate"))
9636      parseElementProperties(getJObject(json, "_alternate"), res.getAlternateElement());
9637    if (json.has("allergenicIndicator"))
9638      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
9639    if (json.has("_allergenicIndicator"))
9640      parseElementProperties(getJObject(json, "_allergenicIndicator"), res.getAllergenicIndicatorElement());
9641  }
9642
9643  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
9644    DeviceMetric res = new DeviceMetric();
9645    parseDeviceMetricProperties(json, res);
9646    return res;
9647  }
9648
9649  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
9650    parseDomainResourceProperties(json, res);
9651    if (json.has("identifier")) {
9652      JsonArray array = json.getAsJsonArray("identifier");
9653      for (int i = 0; i < array.size(); i++) {
9654        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9655      }
9656    };
9657    if (json.has("type"))
9658      res.setType(parseCodeableConcept(getJObject(json, "type")));
9659    if (json.has("unit"))
9660      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
9661    if (json.has("source"))
9662      res.setSource(parseReference(getJObject(json, "source")));
9663    if (json.has("parent"))
9664      res.setParent(parseReference(getJObject(json, "parent")));
9665    if (json.has("operationalStatus"))
9666      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
9667    if (json.has("_operationalStatus"))
9668      parseElementProperties(getJObject(json, "_operationalStatus"), res.getOperationalStatusElement());
9669    if (json.has("color"))
9670      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
9671    if (json.has("_color"))
9672      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
9673    if (json.has("category"))
9674      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
9675    if (json.has("_category"))
9676      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
9677    if (json.has("measurementPeriod"))
9678      res.setMeasurementPeriod(parseTiming(getJObject(json, "measurementPeriod")));
9679    if (json.has("calibration")) {
9680      JsonArray array = json.getAsJsonArray("calibration");
9681      for (int i = 0; i < array.size(); i++) {
9682        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
9683      }
9684    };
9685  }
9686
9687  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
9688    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
9689    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
9690    return res;
9691  }
9692
9693  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
9694    parseBackboneElementProperties(json, res);
9695    if (json.has("type"))
9696      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
9697    if (json.has("_type"))
9698      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
9699    if (json.has("state"))
9700      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
9701    if (json.has("_state"))
9702      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
9703    if (json.has("time"))
9704      res.setTimeElement(parseInstant(json.get("time").getAsString()));
9705    if (json.has("_time"))
9706      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
9707  }
9708
9709  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
9710    DeviceRequest res = new DeviceRequest();
9711    parseDeviceRequestProperties(json, res);
9712    return res;
9713  }
9714
9715  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
9716    parseDomainResourceProperties(json, res);
9717    if (json.has("identifier")) {
9718      JsonArray array = json.getAsJsonArray("identifier");
9719      for (int i = 0; i < array.size(); i++) {
9720        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9721      }
9722    };
9723    if (json.has("instantiatesCanonical")) {
9724      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
9725      for (int i = 0; i < array.size(); i++) {
9726        if (array.get(i).isJsonNull()) {
9727          res.getInstantiatesCanonical().add(new CanonicalType());
9728        } else {
9729          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
9730        }
9731      }
9732    };
9733    if (json.has("_instantiatesCanonical")) {
9734      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
9735      for (int i = 0; i < array.size(); i++) {
9736        if (i == res.getInstantiatesCanonical().size())
9737          res.getInstantiatesCanonical().add(parseCanonical(null));
9738        if (array.get(i) instanceof JsonObject) 
9739          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
9740      }
9741    };
9742    if (json.has("instantiatesUri")) {
9743      JsonArray array = json.getAsJsonArray("instantiatesUri");
9744      for (int i = 0; i < array.size(); i++) {
9745        if (array.get(i).isJsonNull()) {
9746          res.getInstantiatesUri().add(new UriType());
9747        } else {
9748          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
9749        }
9750      }
9751    };
9752    if (json.has("_instantiatesUri")) {
9753      JsonArray array = json.getAsJsonArray("_instantiatesUri");
9754      for (int i = 0; i < array.size(); i++) {
9755        if (i == res.getInstantiatesUri().size())
9756          res.getInstantiatesUri().add(parseUri(null));
9757        if (array.get(i) instanceof JsonObject) 
9758          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
9759      }
9760    };
9761    if (json.has("basedOn")) {
9762      JsonArray array = json.getAsJsonArray("basedOn");
9763      for (int i = 0; i < array.size(); i++) {
9764        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9765      }
9766    };
9767    if (json.has("priorRequest")) {
9768      JsonArray array = json.getAsJsonArray("priorRequest");
9769      for (int i = 0; i < array.size(); i++) {
9770        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
9771      }
9772    };
9773    if (json.has("groupIdentifier"))
9774      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
9775    if (json.has("status"))
9776      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
9777    if (json.has("_status"))
9778      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9779    if (json.has("intent"))
9780      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), DeviceRequest.RequestIntent.NULL, new DeviceRequest.RequestIntentEnumFactory()));
9781    if (json.has("_intent"))
9782      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
9783    if (json.has("priority"))
9784      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
9785    if (json.has("_priority"))
9786      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
9787    Type code = parseType("code", json);
9788    if (code != null)
9789      res.setCode(code);
9790    if (json.has("parameter")) {
9791      JsonArray array = json.getAsJsonArray("parameter");
9792      for (int i = 0; i < array.size(); i++) {
9793        res.getParameter().add(parseDeviceRequestDeviceRequestParameterComponent(array.get(i).getAsJsonObject(), res));
9794      }
9795    };
9796    if (json.has("subject"))
9797      res.setSubject(parseReference(getJObject(json, "subject")));
9798    if (json.has("encounter"))
9799      res.setEncounter(parseReference(getJObject(json, "encounter")));
9800    Type occurrence = parseType("occurrence", json);
9801    if (occurrence != null)
9802      res.setOccurrence(occurrence);
9803    if (json.has("authoredOn"))
9804      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
9805    if (json.has("_authoredOn"))
9806      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
9807    if (json.has("requester"))
9808      res.setRequester(parseReference(getJObject(json, "requester")));
9809    if (json.has("performerType"))
9810      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
9811    if (json.has("performer"))
9812      res.setPerformer(parseReference(getJObject(json, "performer")));
9813    if (json.has("reasonCode")) {
9814      JsonArray array = json.getAsJsonArray("reasonCode");
9815      for (int i = 0; i < array.size(); i++) {
9816        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9817      }
9818    };
9819    if (json.has("reasonReference")) {
9820      JsonArray array = json.getAsJsonArray("reasonReference");
9821      for (int i = 0; i < array.size(); i++) {
9822        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9823      }
9824    };
9825    if (json.has("insurance")) {
9826      JsonArray array = json.getAsJsonArray("insurance");
9827      for (int i = 0; i < array.size(); i++) {
9828        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
9829      }
9830    };
9831    if (json.has("supportingInfo")) {
9832      JsonArray array = json.getAsJsonArray("supportingInfo");
9833      for (int i = 0; i < array.size(); i++) {
9834        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
9835      }
9836    };
9837    if (json.has("note")) {
9838      JsonArray array = json.getAsJsonArray("note");
9839      for (int i = 0; i < array.size(); i++) {
9840        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9841      }
9842    };
9843    if (json.has("relevantHistory")) {
9844      JsonArray array = json.getAsJsonArray("relevantHistory");
9845      for (int i = 0; i < array.size(); i++) {
9846        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
9847      }
9848    };
9849  }
9850
9851  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestDeviceRequestParameterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
9852    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
9853    parseDeviceRequestDeviceRequestParameterComponentProperties(json, owner, res);
9854    return res;
9855  }
9856
9857  protected void parseDeviceRequestDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
9858    parseBackboneElementProperties(json, res);
9859    if (json.has("code"))
9860      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9861    Type value = parseType("value", json);
9862    if (value != null)
9863      res.setValue(value);
9864  }
9865
9866  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
9867    DeviceUseStatement res = new DeviceUseStatement();
9868    parseDeviceUseStatementProperties(json, res);
9869    return res;
9870  }
9871
9872  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
9873    parseDomainResourceProperties(json, res);
9874    if (json.has("identifier")) {
9875      JsonArray array = json.getAsJsonArray("identifier");
9876      for (int i = 0; i < array.size(); i++) {
9877        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9878      }
9879    };
9880    if (json.has("basedOn")) {
9881      JsonArray array = json.getAsJsonArray("basedOn");
9882      for (int i = 0; i < array.size(); i++) {
9883        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9884      }
9885    };
9886    if (json.has("status"))
9887      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
9888    if (json.has("_status"))
9889      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9890    if (json.has("subject"))
9891      res.setSubject(parseReference(getJObject(json, "subject")));
9892    if (json.has("derivedFrom")) {
9893      JsonArray array = json.getAsJsonArray("derivedFrom");
9894      for (int i = 0; i < array.size(); i++) {
9895        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
9896      }
9897    };
9898    Type timing = parseType("timing", json);
9899    if (timing != null)
9900      res.setTiming(timing);
9901    if (json.has("recordedOn"))
9902      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
9903    if (json.has("_recordedOn"))
9904      parseElementProperties(getJObject(json, "_recordedOn"), res.getRecordedOnElement());
9905    if (json.has("source"))
9906      res.setSource(parseReference(getJObject(json, "source")));
9907    if (json.has("device"))
9908      res.setDevice(parseReference(getJObject(json, "device")));
9909    if (json.has("reasonCode")) {
9910      JsonArray array = json.getAsJsonArray("reasonCode");
9911      for (int i = 0; i < array.size(); i++) {
9912        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9913      }
9914    };
9915    if (json.has("reasonReference")) {
9916      JsonArray array = json.getAsJsonArray("reasonReference");
9917      for (int i = 0; i < array.size(); i++) {
9918        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9919      }
9920    };
9921    if (json.has("bodySite"))
9922      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
9923    if (json.has("note")) {
9924      JsonArray array = json.getAsJsonArray("note");
9925      for (int i = 0; i < array.size(); i++) {
9926        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9927      }
9928    };
9929  }
9930
9931  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
9932    DiagnosticReport res = new DiagnosticReport();
9933    parseDiagnosticReportProperties(json, res);
9934    return res;
9935  }
9936
9937  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
9938    parseDomainResourceProperties(json, res);
9939    if (json.has("identifier")) {
9940      JsonArray array = json.getAsJsonArray("identifier");
9941      for (int i = 0; i < array.size(); i++) {
9942        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9943      }
9944    };
9945    if (json.has("basedOn")) {
9946      JsonArray array = json.getAsJsonArray("basedOn");
9947      for (int i = 0; i < array.size(); i++) {
9948        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9949      }
9950    };
9951    if (json.has("status"))
9952      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
9953    if (json.has("_status"))
9954      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9955    if (json.has("category")) {
9956      JsonArray array = json.getAsJsonArray("category");
9957      for (int i = 0; i < array.size(); i++) {
9958        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9959      }
9960    };
9961    if (json.has("code"))
9962      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9963    if (json.has("subject"))
9964      res.setSubject(parseReference(getJObject(json, "subject")));
9965    if (json.has("encounter"))
9966      res.setEncounter(parseReference(getJObject(json, "encounter")));
9967    Type effective = parseType("effective", json);
9968    if (effective != null)
9969      res.setEffective(effective);
9970    if (json.has("issued"))
9971      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
9972    if (json.has("_issued"))
9973      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
9974    if (json.has("performer")) {
9975      JsonArray array = json.getAsJsonArray("performer");
9976      for (int i = 0; i < array.size(); i++) {
9977        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
9978      }
9979    };
9980    if (json.has("resultsInterpreter")) {
9981      JsonArray array = json.getAsJsonArray("resultsInterpreter");
9982      for (int i = 0; i < array.size(); i++) {
9983        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
9984      }
9985    };
9986    if (json.has("specimen")) {
9987      JsonArray array = json.getAsJsonArray("specimen");
9988      for (int i = 0; i < array.size(); i++) {
9989        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
9990      }
9991    };
9992    if (json.has("result")) {
9993      JsonArray array = json.getAsJsonArray("result");
9994      for (int i = 0; i < array.size(); i++) {
9995        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
9996      }
9997    };
9998    if (json.has("imagingStudy")) {
9999      JsonArray array = json.getAsJsonArray("imagingStudy");
10000      for (int i = 0; i < array.size(); i++) {
10001        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
10002      }
10003    };
10004    if (json.has("media")) {
10005      JsonArray array = json.getAsJsonArray("media");
10006      for (int i = 0; i < array.size(); i++) {
10007        res.getMedia().add(parseDiagnosticReportDiagnosticReportMediaComponent(array.get(i).getAsJsonObject(), res));
10008      }
10009    };
10010    if (json.has("conclusion"))
10011      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
10012    if (json.has("_conclusion"))
10013      parseElementProperties(getJObject(json, "_conclusion"), res.getConclusionElement());
10014    if (json.has("conclusionCode")) {
10015      JsonArray array = json.getAsJsonArray("conclusionCode");
10016      for (int i = 0; i < array.size(); i++) {
10017        res.getConclusionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10018      }
10019    };
10020    if (json.has("presentedForm")) {
10021      JsonArray array = json.getAsJsonArray("presentedForm");
10022      for (int i = 0; i < array.size(); i++) {
10023        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
10024      }
10025    };
10026  }
10027
10028  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportDiagnosticReportMediaComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
10029    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
10030    parseDiagnosticReportDiagnosticReportMediaComponentProperties(json, owner, res);
10031    return res;
10032  }
10033
10034  protected void parseDiagnosticReportDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
10035    parseBackboneElementProperties(json, res);
10036    if (json.has("comment"))
10037      res.setCommentElement(parseString(json.get("comment").getAsString()));
10038    if (json.has("_comment"))
10039      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
10040    if (json.has("link"))
10041      res.setLink(parseReference(getJObject(json, "link")));
10042  }
10043
10044  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
10045    DocumentManifest res = new DocumentManifest();
10046    parseDocumentManifestProperties(json, res);
10047    return res;
10048  }
10049
10050  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
10051    parseDomainResourceProperties(json, res);
10052    if (json.has("masterIdentifier"))
10053      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
10054    if (json.has("identifier")) {
10055      JsonArray array = json.getAsJsonArray("identifier");
10056      for (int i = 0; i < array.size(); i++) {
10057        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10058      }
10059    };
10060    if (json.has("status"))
10061      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
10062    if (json.has("_status"))
10063      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10064    if (json.has("type"))
10065      res.setType(parseCodeableConcept(getJObject(json, "type")));
10066    if (json.has("subject"))
10067      res.setSubject(parseReference(getJObject(json, "subject")));
10068    if (json.has("created"))
10069      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10070    if (json.has("_created"))
10071      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
10072    if (json.has("author")) {
10073      JsonArray array = json.getAsJsonArray("author");
10074      for (int i = 0; i < array.size(); i++) {
10075        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
10076      }
10077    };
10078    if (json.has("recipient")) {
10079      JsonArray array = json.getAsJsonArray("recipient");
10080      for (int i = 0; i < array.size(); i++) {
10081        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
10082      }
10083    };
10084    if (json.has("source"))
10085      res.setSourceElement(parseUri(json.get("source").getAsString()));
10086    if (json.has("_source"))
10087      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
10088    if (json.has("description"))
10089      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10090    if (json.has("_description"))
10091      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10092    if (json.has("content")) {
10093      JsonArray array = json.getAsJsonArray("content");
10094      for (int i = 0; i < array.size(); i++) {
10095        res.getContent().add(parseReference(array.get(i).getAsJsonObject()));
10096      }
10097    };
10098    if (json.has("related")) {
10099      JsonArray array = json.getAsJsonArray("related");
10100      for (int i = 0; i < array.size(); i++) {
10101        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
10102      }
10103    };
10104  }
10105
10106  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
10107    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
10108    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
10109    return res;
10110  }
10111
10112  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
10113    parseBackboneElementProperties(json, res);
10114    if (json.has("identifier"))
10115      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
10116    if (json.has("ref"))
10117      res.setRef(parseReference(getJObject(json, "ref")));
10118  }
10119
10120  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
10121    DocumentReference res = new DocumentReference();
10122    parseDocumentReferenceProperties(json, res);
10123    return res;
10124  }
10125
10126  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
10127    parseDomainResourceProperties(json, res);
10128    if (json.has("masterIdentifier"))
10129      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
10130    if (json.has("identifier")) {
10131      JsonArray array = json.getAsJsonArray("identifier");
10132      for (int i = 0; i < array.size(); i++) {
10133        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10134      }
10135    };
10136    if (json.has("status"))
10137      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
10138    if (json.has("_status"))
10139      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10140    if (json.has("docStatus"))
10141      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
10142    if (json.has("_docStatus"))
10143      parseElementProperties(getJObject(json, "_docStatus"), res.getDocStatusElement());
10144    if (json.has("type"))
10145      res.setType(parseCodeableConcept(getJObject(json, "type")));
10146    if (json.has("category")) {
10147      JsonArray array = json.getAsJsonArray("category");
10148      for (int i = 0; i < array.size(); i++) {
10149        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10150      }
10151    };
10152    if (json.has("subject"))
10153      res.setSubject(parseReference(getJObject(json, "subject")));
10154    if (json.has("date"))
10155      res.setDateElement(parseInstant(json.get("date").getAsString()));
10156    if (json.has("_date"))
10157      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
10158    if (json.has("author")) {
10159      JsonArray array = json.getAsJsonArray("author");
10160      for (int i = 0; i < array.size(); i++) {
10161        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
10162      }
10163    };
10164    if (json.has("authenticator"))
10165      res.setAuthenticator(parseReference(getJObject(json, "authenticator")));
10166    if (json.has("custodian"))
10167      res.setCustodian(parseReference(getJObject(json, "custodian")));
10168    if (json.has("relatesTo")) {
10169      JsonArray array = json.getAsJsonArray("relatesTo");
10170      for (int i = 0; i < array.size(); i++) {
10171        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
10172      }
10173    };
10174    if (json.has("description"))
10175      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10176    if (json.has("_description"))
10177      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10178    if (json.has("securityLabel")) {
10179      JsonArray array = json.getAsJsonArray("securityLabel");
10180      for (int i = 0; i < array.size(); i++) {
10181        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10182      }
10183    };
10184    if (json.has("content")) {
10185      JsonArray array = json.getAsJsonArray("content");
10186      for (int i = 0; i < array.size(); i++) {
10187        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
10188      }
10189    };
10190    if (json.has("context"))
10191      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(getJObject(json, "context"), res));
10192  }
10193
10194  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
10195    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
10196    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
10197    return res;
10198  }
10199
10200  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
10201    parseBackboneElementProperties(json, res);
10202    if (json.has("code"))
10203      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
10204    if (json.has("_code"))
10205      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
10206    if (json.has("target"))
10207      res.setTarget(parseReference(getJObject(json, "target")));
10208  }
10209
10210  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
10211    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
10212    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
10213    return res;
10214  }
10215
10216  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
10217    parseBackboneElementProperties(json, res);
10218    if (json.has("attachment"))
10219      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
10220    if (json.has("format"))
10221      res.setFormat(parseCoding(getJObject(json, "format")));
10222  }
10223
10224  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
10225    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
10226    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
10227    return res;
10228  }
10229
10230  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
10231    parseBackboneElementProperties(json, res);
10232    if (json.has("encounter")) {
10233      JsonArray array = json.getAsJsonArray("encounter");
10234      for (int i = 0; i < array.size(); i++) {
10235        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
10236      }
10237    };
10238    if (json.has("event")) {
10239      JsonArray array = json.getAsJsonArray("event");
10240      for (int i = 0; i < array.size(); i++) {
10241        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10242      }
10243    };
10244    if (json.has("period"))
10245      res.setPeriod(parsePeriod(getJObject(json, "period")));
10246    if (json.has("facilityType"))
10247      res.setFacilityType(parseCodeableConcept(getJObject(json, "facilityType")));
10248    if (json.has("practiceSetting"))
10249      res.setPracticeSetting(parseCodeableConcept(getJObject(json, "practiceSetting")));
10250    if (json.has("sourcePatientInfo"))
10251      res.setSourcePatientInfo(parseReference(getJObject(json, "sourcePatientInfo")));
10252    if (json.has("related")) {
10253      JsonArray array = json.getAsJsonArray("related");
10254      for (int i = 0; i < array.size(); i++) {
10255        res.getRelated().add(parseReference(array.get(i).getAsJsonObject()));
10256      }
10257    };
10258  }
10259
10260  protected EffectEvidenceSynthesis parseEffectEvidenceSynthesis(JsonObject json) throws IOException, FHIRFormatError {
10261    EffectEvidenceSynthesis res = new EffectEvidenceSynthesis();
10262    parseEffectEvidenceSynthesisProperties(json, res);
10263    return res;
10264  }
10265
10266  protected void parseEffectEvidenceSynthesisProperties(JsonObject json, EffectEvidenceSynthesis res) throws IOException, FHIRFormatError {
10267    parseDomainResourceProperties(json, res);
10268    if (json.has("url"))
10269      res.setUrlElement(parseUri(json.get("url").getAsString()));
10270    if (json.has("_url"))
10271      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
10272    if (json.has("identifier")) {
10273      JsonArray array = json.getAsJsonArray("identifier");
10274      for (int i = 0; i < array.size(); i++) {
10275        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10276      }
10277    };
10278    if (json.has("version"))
10279      res.setVersionElement(parseString(json.get("version").getAsString()));
10280    if (json.has("_version"))
10281      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
10282    if (json.has("name"))
10283      res.setNameElement(parseString(json.get("name").getAsString()));
10284    if (json.has("_name"))
10285      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10286    if (json.has("title"))
10287      res.setTitleElement(parseString(json.get("title").getAsString()));
10288    if (json.has("_title"))
10289      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
10290    if (json.has("status"))
10291      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10292    if (json.has("_status"))
10293      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10294    if (json.has("date"))
10295      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10296    if (json.has("_date"))
10297      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
10298    if (json.has("publisher"))
10299      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10300    if (json.has("_publisher"))
10301      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
10302    if (json.has("contact")) {
10303      JsonArray array = json.getAsJsonArray("contact");
10304      for (int i = 0; i < array.size(); i++) {
10305        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10306      }
10307    };
10308    if (json.has("description"))
10309      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10310    if (json.has("_description"))
10311      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10312    if (json.has("note")) {
10313      JsonArray array = json.getAsJsonArray("note");
10314      for (int i = 0; i < array.size(); i++) {
10315        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10316      }
10317    };
10318    if (json.has("useContext")) {
10319      JsonArray array = json.getAsJsonArray("useContext");
10320      for (int i = 0; i < array.size(); i++) {
10321        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10322      }
10323    };
10324    if (json.has("jurisdiction")) {
10325      JsonArray array = json.getAsJsonArray("jurisdiction");
10326      for (int i = 0; i < array.size(); i++) {
10327        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10328      }
10329    };
10330    if (json.has("copyright"))
10331      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10332    if (json.has("_copyright"))
10333      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
10334    if (json.has("approvalDate"))
10335      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10336    if (json.has("_approvalDate"))
10337      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
10338    if (json.has("lastReviewDate"))
10339      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10340    if (json.has("_lastReviewDate"))
10341      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
10342    if (json.has("effectivePeriod"))
10343      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
10344    if (json.has("topic")) {
10345      JsonArray array = json.getAsJsonArray("topic");
10346      for (int i = 0; i < array.size(); i++) {
10347        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10348      }
10349    };
10350    if (json.has("author")) {
10351      JsonArray array = json.getAsJsonArray("author");
10352      for (int i = 0; i < array.size(); i++) {
10353        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10354      }
10355    };
10356    if (json.has("editor")) {
10357      JsonArray array = json.getAsJsonArray("editor");
10358      for (int i = 0; i < array.size(); i++) {
10359        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10360      }
10361    };
10362    if (json.has("reviewer")) {
10363      JsonArray array = json.getAsJsonArray("reviewer");
10364      for (int i = 0; i < array.size(); i++) {
10365        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10366      }
10367    };
10368    if (json.has("endorser")) {
10369      JsonArray array = json.getAsJsonArray("endorser");
10370      for (int i = 0; i < array.size(); i++) {
10371        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10372      }
10373    };
10374    if (json.has("relatedArtifact")) {
10375      JsonArray array = json.getAsJsonArray("relatedArtifact");
10376      for (int i = 0; i < array.size(); i++) {
10377        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
10378      }
10379    };
10380    if (json.has("synthesisType"))
10381      res.setSynthesisType(parseCodeableConcept(getJObject(json, "synthesisType")));
10382    if (json.has("studyType"))
10383      res.setStudyType(parseCodeableConcept(getJObject(json, "studyType")));
10384    if (json.has("population"))
10385      res.setPopulation(parseReference(getJObject(json, "population")));
10386    if (json.has("exposure"))
10387      res.setExposure(parseReference(getJObject(json, "exposure")));
10388    if (json.has("exposureAlternative"))
10389      res.setExposureAlternative(parseReference(getJObject(json, "exposureAlternative")));
10390    if (json.has("outcome"))
10391      res.setOutcome(parseReference(getJObject(json, "outcome")));
10392    if (json.has("sampleSize"))
10393      res.setSampleSize(parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(getJObject(json, "sampleSize"), res));
10394    if (json.has("resultsByExposure")) {
10395      JsonArray array = json.getAsJsonArray("resultsByExposure");
10396      for (int i = 0; i < array.size(); i++) {
10397        res.getResultsByExposure().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(array.get(i).getAsJsonObject(), res));
10398      }
10399    };
10400    if (json.has("effectEstimate")) {
10401      JsonArray array = json.getAsJsonArray("effectEstimate");
10402      for (int i = 0; i < array.size(); i++) {
10403        res.getEffectEstimate().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(array.get(i).getAsJsonObject(), res));
10404      }
10405    };
10406    if (json.has("certainty")) {
10407      JsonArray array = json.getAsJsonArray("certainty");
10408      for (int i = 0; i < array.size(); i++) {
10409        res.getCertainty().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(array.get(i).getAsJsonObject(), res));
10410      }
10411    };
10412  }
10413
10414  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10415    EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent();
10416    parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentProperties(json, owner, res);
10417    return res;
10418  }
10419
10420  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res) throws IOException, FHIRFormatError {
10421    parseBackboneElementProperties(json, res);
10422    if (json.has("description"))
10423      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10424    if (json.has("_description"))
10425      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10426    if (json.has("numberOfStudies"))
10427      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
10428    if (json.has("_numberOfStudies"))
10429      parseElementProperties(getJObject(json, "_numberOfStudies"), res.getNumberOfStudiesElement());
10430    if (json.has("numberOfParticipants"))
10431      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
10432    if (json.has("_numberOfParticipants"))
10433      parseElementProperties(getJObject(json, "_numberOfParticipants"), res.getNumberOfParticipantsElement());
10434  }
10435
10436  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10437    EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent();
10438    parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentProperties(json, owner, res);
10439    return res;
10440  }
10441
10442  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res) throws IOException, FHIRFormatError {
10443    parseBackboneElementProperties(json, res);
10444    if (json.has("description"))
10445      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10446    if (json.has("_description"))
10447      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10448    if (json.has("exposureState"))
10449      res.setExposureStateElement(parseEnumeration(json.get("exposureState").getAsString(), EffectEvidenceSynthesis.ExposureState.NULL, new EffectEvidenceSynthesis.ExposureStateEnumFactory()));
10450    if (json.has("_exposureState"))
10451      parseElementProperties(getJObject(json, "_exposureState"), res.getExposureStateElement());
10452    if (json.has("variantState"))
10453      res.setVariantState(parseCodeableConcept(getJObject(json, "variantState")));
10454    if (json.has("riskEvidenceSynthesis"))
10455      res.setRiskEvidenceSynthesis(parseReference(getJObject(json, "riskEvidenceSynthesis")));
10456  }
10457
10458  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10459    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent();
10460    parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentProperties(json, owner, res);
10461    return res;
10462  }
10463
10464  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res) throws IOException, FHIRFormatError {
10465    parseBackboneElementProperties(json, res);
10466    if (json.has("description"))
10467      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10468    if (json.has("_description"))
10469      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10470    if (json.has("type"))
10471      res.setType(parseCodeableConcept(getJObject(json, "type")));
10472    if (json.has("variantState"))
10473      res.setVariantState(parseCodeableConcept(getJObject(json, "variantState")));
10474    if (json.has("value"))
10475      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
10476    if (json.has("_value"))
10477      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
10478    if (json.has("unitOfMeasure"))
10479      res.setUnitOfMeasure(parseCodeableConcept(getJObject(json, "unitOfMeasure")));
10480    if (json.has("precisionEstimate")) {
10481      JsonArray array = json.getAsJsonArray("precisionEstimate");
10482      for (int i = 0; i < array.size(); i++) {
10483        res.getPrecisionEstimate().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(array.get(i).getAsJsonObject(), owner));
10484      }
10485    };
10486  }
10487
10488  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10489    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent();
10490    parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentProperties(json, owner, res);
10491    return res;
10492  }
10493
10494  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res) throws IOException, FHIRFormatError {
10495    parseBackboneElementProperties(json, res);
10496    if (json.has("type"))
10497      res.setType(parseCodeableConcept(getJObject(json, "type")));
10498    if (json.has("level"))
10499      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
10500    if (json.has("_level"))
10501      parseElementProperties(getJObject(json, "_level"), res.getLevelElement());
10502    if (json.has("from"))
10503      res.setFromElement(parseDecimal(json.get("from").getAsBigDecimal()));
10504    if (json.has("_from"))
10505      parseElementProperties(getJObject(json, "_from"), res.getFromElement());
10506    if (json.has("to"))
10507      res.setToElement(parseDecimal(json.get("to").getAsBigDecimal()));
10508    if (json.has("_to"))
10509      parseElementProperties(getJObject(json, "_to"), res.getToElement());
10510  }
10511
10512  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10513    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent();
10514    parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentProperties(json, owner, res);
10515    return res;
10516  }
10517
10518  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res) throws IOException, FHIRFormatError {
10519    parseBackboneElementProperties(json, res);
10520    if (json.has("rating")) {
10521      JsonArray array = json.getAsJsonArray("rating");
10522      for (int i = 0; i < array.size(); i++) {
10523        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10524      }
10525    };
10526    if (json.has("note")) {
10527      JsonArray array = json.getAsJsonArray("note");
10528      for (int i = 0; i < array.size(); i++) {
10529        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10530      }
10531    };
10532    if (json.has("certaintySubcomponent")) {
10533      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
10534      for (int i = 0; i < array.size(); i++) {
10535        res.getCertaintySubcomponent().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(array.get(i).getAsJsonObject(), owner));
10536      }
10537    };
10538  }
10539
10540  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10541    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
10542    parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(json, owner, res);
10543    return res;
10544  }
10545
10546  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res) throws IOException, FHIRFormatError {
10547    parseBackboneElementProperties(json, res);
10548    if (json.has("type"))
10549      res.setType(parseCodeableConcept(getJObject(json, "type")));
10550    if (json.has("rating")) {
10551      JsonArray array = json.getAsJsonArray("rating");
10552      for (int i = 0; i < array.size(); i++) {
10553        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10554      }
10555    };
10556    if (json.has("note")) {
10557      JsonArray array = json.getAsJsonArray("note");
10558      for (int i = 0; i < array.size(); i++) {
10559        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10560      }
10561    };
10562  }
10563
10564  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
10565    Encounter res = new Encounter();
10566    parseEncounterProperties(json, res);
10567    return res;
10568  }
10569
10570  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
10571    parseDomainResourceProperties(json, res);
10572    if (json.has("identifier")) {
10573      JsonArray array = json.getAsJsonArray("identifier");
10574      for (int i = 0; i < array.size(); i++) {
10575        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10576      }
10577    };
10578    if (json.has("status"))
10579      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
10580    if (json.has("_status"))
10581      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10582    if (json.has("statusHistory")) {
10583      JsonArray array = json.getAsJsonArray("statusHistory");
10584      for (int i = 0; i < array.size(); i++) {
10585        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
10586      }
10587    };
10588    if (json.has("class"))
10589      res.setClass_(parseCoding(getJObject(json, "class")));
10590    if (json.has("classHistory")) {
10591      JsonArray array = json.getAsJsonArray("classHistory");
10592      for (int i = 0; i < array.size(); i++) {
10593        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
10594      }
10595    };
10596    if (json.has("type")) {
10597      JsonArray array = json.getAsJsonArray("type");
10598      for (int i = 0; i < array.size(); i++) {
10599        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10600      }
10601    };
10602    if (json.has("serviceType"))
10603      res.setServiceType(parseCodeableConcept(getJObject(json, "serviceType")));
10604    if (json.has("priority"))
10605      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
10606    if (json.has("subject"))
10607      res.setSubject(parseReference(getJObject(json, "subject")));
10608    if (json.has("episodeOfCare")) {
10609      JsonArray array = json.getAsJsonArray("episodeOfCare");
10610      for (int i = 0; i < array.size(); i++) {
10611        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
10612      }
10613    };
10614    if (json.has("basedOn")) {
10615      JsonArray array = json.getAsJsonArray("basedOn");
10616      for (int i = 0; i < array.size(); i++) {
10617        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10618      }
10619    };
10620    if (json.has("participant")) {
10621      JsonArray array = json.getAsJsonArray("participant");
10622      for (int i = 0; i < array.size(); i++) {
10623        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
10624      }
10625    };
10626    if (json.has("appointment")) {
10627      JsonArray array = json.getAsJsonArray("appointment");
10628      for (int i = 0; i < array.size(); i++) {
10629        res.getAppointment().add(parseReference(array.get(i).getAsJsonObject()));
10630      }
10631    };
10632    if (json.has("period"))
10633      res.setPeriod(parsePeriod(getJObject(json, "period")));
10634    if (json.has("length"))
10635      res.setLength(parseDuration(getJObject(json, "length")));
10636    if (json.has("reasonCode")) {
10637      JsonArray array = json.getAsJsonArray("reasonCode");
10638      for (int i = 0; i < array.size(); i++) {
10639        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10640      }
10641    };
10642    if (json.has("reasonReference")) {
10643      JsonArray array = json.getAsJsonArray("reasonReference");
10644      for (int i = 0; i < array.size(); i++) {
10645        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10646      }
10647    };
10648    if (json.has("diagnosis")) {
10649      JsonArray array = json.getAsJsonArray("diagnosis");
10650      for (int i = 0; i < array.size(); i++) {
10651        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
10652      }
10653    };
10654    if (json.has("account")) {
10655      JsonArray array = json.getAsJsonArray("account");
10656      for (int i = 0; i < array.size(); i++) {
10657        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
10658      }
10659    };
10660    if (json.has("hospitalization"))
10661      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(getJObject(json, "hospitalization"), res));
10662    if (json.has("location")) {
10663      JsonArray array = json.getAsJsonArray("location");
10664      for (int i = 0; i < array.size(); i++) {
10665        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
10666      }
10667    };
10668    if (json.has("serviceProvider"))
10669      res.setServiceProvider(parseReference(getJObject(json, "serviceProvider")));
10670    if (json.has("partOf"))
10671      res.setPartOf(parseReference(getJObject(json, "partOf")));
10672  }
10673
10674  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10675    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
10676    parseEncounterStatusHistoryComponentProperties(json, owner, res);
10677    return res;
10678  }
10679
10680  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
10681    parseBackboneElementProperties(json, res);
10682    if (json.has("status"))
10683      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
10684    if (json.has("_status"))
10685      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10686    if (json.has("period"))
10687      res.setPeriod(parsePeriod(getJObject(json, "period")));
10688  }
10689
10690  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10691    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
10692    parseEncounterClassHistoryComponentProperties(json, owner, res);
10693    return res;
10694  }
10695
10696  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
10697    parseBackboneElementProperties(json, res);
10698    if (json.has("class"))
10699      res.setClass_(parseCoding(getJObject(json, "class")));
10700    if (json.has("period"))
10701      res.setPeriod(parsePeriod(getJObject(json, "period")));
10702  }
10703
10704  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10705    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
10706    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
10707    return res;
10708  }
10709
10710  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
10711    parseBackboneElementProperties(json, res);
10712    if (json.has("type")) {
10713      JsonArray array = json.getAsJsonArray("type");
10714      for (int i = 0; i < array.size(); i++) {
10715        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10716      }
10717    };
10718    if (json.has("period"))
10719      res.setPeriod(parsePeriod(getJObject(json, "period")));
10720    if (json.has("individual"))
10721      res.setIndividual(parseReference(getJObject(json, "individual")));
10722  }
10723
10724  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10725    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
10726    parseEncounterDiagnosisComponentProperties(json, owner, res);
10727    return res;
10728  }
10729
10730  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
10731    parseBackboneElementProperties(json, res);
10732    if (json.has("condition"))
10733      res.setCondition(parseReference(getJObject(json, "condition")));
10734    if (json.has("use"))
10735      res.setUse(parseCodeableConcept(getJObject(json, "use")));
10736    if (json.has("rank"))
10737      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
10738    if (json.has("_rank"))
10739      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
10740  }
10741
10742  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10743    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
10744    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
10745    return res;
10746  }
10747
10748  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
10749    parseBackboneElementProperties(json, res);
10750    if (json.has("preAdmissionIdentifier"))
10751      res.setPreAdmissionIdentifier(parseIdentifier(getJObject(json, "preAdmissionIdentifier")));
10752    if (json.has("origin"))
10753      res.setOrigin(parseReference(getJObject(json, "origin")));
10754    if (json.has("admitSource"))
10755      res.setAdmitSource(parseCodeableConcept(getJObject(json, "admitSource")));
10756    if (json.has("reAdmission"))
10757      res.setReAdmission(parseCodeableConcept(getJObject(json, "reAdmission")));
10758    if (json.has("dietPreference")) {
10759      JsonArray array = json.getAsJsonArray("dietPreference");
10760      for (int i = 0; i < array.size(); i++) {
10761        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10762      }
10763    };
10764    if (json.has("specialCourtesy")) {
10765      JsonArray array = json.getAsJsonArray("specialCourtesy");
10766      for (int i = 0; i < array.size(); i++) {
10767        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10768      }
10769    };
10770    if (json.has("specialArrangement")) {
10771      JsonArray array = json.getAsJsonArray("specialArrangement");
10772      for (int i = 0; i < array.size(); i++) {
10773        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10774      }
10775    };
10776    if (json.has("destination"))
10777      res.setDestination(parseReference(getJObject(json, "destination")));
10778    if (json.has("dischargeDisposition"))
10779      res.setDischargeDisposition(parseCodeableConcept(getJObject(json, "dischargeDisposition")));
10780  }
10781
10782  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10783    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
10784    parseEncounterEncounterLocationComponentProperties(json, owner, res);
10785    return res;
10786  }
10787
10788  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
10789    parseBackboneElementProperties(json, res);
10790    if (json.has("location"))
10791      res.setLocation(parseReference(getJObject(json, "location")));
10792    if (json.has("status"))
10793      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
10794    if (json.has("_status"))
10795      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10796    if (json.has("physicalType"))
10797      res.setPhysicalType(parseCodeableConcept(getJObject(json, "physicalType")));
10798    if (json.has("period"))
10799      res.setPeriod(parsePeriod(getJObject(json, "period")));
10800  }
10801
10802  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
10803    Endpoint res = new Endpoint();
10804    parseEndpointProperties(json, res);
10805    return res;
10806  }
10807
10808  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
10809    parseDomainResourceProperties(json, res);
10810    if (json.has("identifier")) {
10811      JsonArray array = json.getAsJsonArray("identifier");
10812      for (int i = 0; i < array.size(); i++) {
10813        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10814      }
10815    };
10816    if (json.has("status"))
10817      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
10818    if (json.has("_status"))
10819      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10820    if (json.has("connectionType"))
10821      res.setConnectionType(parseCoding(getJObject(json, "connectionType")));
10822    if (json.has("name"))
10823      res.setNameElement(parseString(json.get("name").getAsString()));
10824    if (json.has("_name"))
10825      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10826    if (json.has("managingOrganization"))
10827      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
10828    if (json.has("contact")) {
10829      JsonArray array = json.getAsJsonArray("contact");
10830      for (int i = 0; i < array.size(); i++) {
10831        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10832      }
10833    };
10834    if (json.has("period"))
10835      res.setPeriod(parsePeriod(getJObject(json, "period")));
10836    if (json.has("payloadType")) {
10837      JsonArray array = json.getAsJsonArray("payloadType");
10838      for (int i = 0; i < array.size(); i++) {
10839        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10840      }
10841    };
10842    if (json.has("payloadMimeType")) {
10843      JsonArray array = json.getAsJsonArray("payloadMimeType");
10844      for (int i = 0; i < array.size(); i++) {
10845        if (array.get(i).isJsonNull()) {
10846          res.getPayloadMimeType().add(new CodeType());
10847        } else {
10848          res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
10849        }
10850      }
10851    };
10852    if (json.has("_payloadMimeType")) {
10853      JsonArray array = json.getAsJsonArray("_payloadMimeType");
10854      for (int i = 0; i < array.size(); i++) {
10855        if (i == res.getPayloadMimeType().size())
10856          res.getPayloadMimeType().add(parseCode(null));
10857        if (array.get(i) instanceof JsonObject) 
10858          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
10859      }
10860    };
10861    if (json.has("address"))
10862      res.setAddressElement(parseUrl(json.get("address").getAsString()));
10863    if (json.has("_address"))
10864      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
10865    if (json.has("header")) {
10866      JsonArray array = json.getAsJsonArray("header");
10867      for (int i = 0; i < array.size(); i++) {
10868        if (array.get(i).isJsonNull()) {
10869          res.getHeader().add(new StringType());
10870        } else {
10871          res.getHeader().add(parseString(array.get(i).getAsString()));
10872        }
10873      }
10874    };
10875    if (json.has("_header")) {
10876      JsonArray array = json.getAsJsonArray("_header");
10877      for (int i = 0; i < array.size(); i++) {
10878        if (i == res.getHeader().size())
10879          res.getHeader().add(parseString(null));
10880        if (array.get(i) instanceof JsonObject) 
10881          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
10882      }
10883    };
10884  }
10885
10886  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
10887    EnrollmentRequest res = new EnrollmentRequest();
10888    parseEnrollmentRequestProperties(json, res);
10889    return res;
10890  }
10891
10892  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
10893    parseDomainResourceProperties(json, res);
10894    if (json.has("identifier")) {
10895      JsonArray array = json.getAsJsonArray("identifier");
10896      for (int i = 0; i < array.size(); i++) {
10897        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10898      }
10899    };
10900    if (json.has("status"))
10901      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
10902    if (json.has("_status"))
10903      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10904    if (json.has("created"))
10905      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10906    if (json.has("_created"))
10907      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
10908    if (json.has("insurer"))
10909      res.setInsurer(parseReference(getJObject(json, "insurer")));
10910    if (json.has("provider"))
10911      res.setProvider(parseReference(getJObject(json, "provider")));
10912    if (json.has("candidate"))
10913      res.setCandidate(parseReference(getJObject(json, "candidate")));
10914    if (json.has("coverage"))
10915      res.setCoverage(parseReference(getJObject(json, "coverage")));
10916  }
10917
10918  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
10919    EnrollmentResponse res = new EnrollmentResponse();
10920    parseEnrollmentResponseProperties(json, res);
10921    return res;
10922  }
10923
10924  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
10925    parseDomainResourceProperties(json, res);
10926    if (json.has("identifier")) {
10927      JsonArray array = json.getAsJsonArray("identifier");
10928      for (int i = 0; i < array.size(); i++) {
10929        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10930      }
10931    };
10932    if (json.has("status"))
10933      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
10934    if (json.has("_status"))
10935      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10936    if (json.has("request"))
10937      res.setRequest(parseReference(getJObject(json, "request")));
10938    if (json.has("outcome"))
10939      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
10940    if (json.has("_outcome"))
10941      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
10942    if (json.has("disposition"))
10943      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
10944    if (json.has("_disposition"))
10945      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
10946    if (json.has("created"))
10947      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10948    if (json.has("_created"))
10949      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
10950    if (json.has("organization"))
10951      res.setOrganization(parseReference(getJObject(json, "organization")));
10952    if (json.has("requestProvider"))
10953      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
10954  }
10955
10956  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
10957    EpisodeOfCare res = new EpisodeOfCare();
10958    parseEpisodeOfCareProperties(json, res);
10959    return res;
10960  }
10961
10962  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
10963    parseDomainResourceProperties(json, res);
10964    if (json.has("identifier")) {
10965      JsonArray array = json.getAsJsonArray("identifier");
10966      for (int i = 0; i < array.size(); i++) {
10967        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10968      }
10969    };
10970    if (json.has("status"))
10971      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
10972    if (json.has("_status"))
10973      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10974    if (json.has("statusHistory")) {
10975      JsonArray array = json.getAsJsonArray("statusHistory");
10976      for (int i = 0; i < array.size(); i++) {
10977        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
10978      }
10979    };
10980    if (json.has("type")) {
10981      JsonArray array = json.getAsJsonArray("type");
10982      for (int i = 0; i < array.size(); i++) {
10983        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10984      }
10985    };
10986    if (json.has("diagnosis")) {
10987      JsonArray array = json.getAsJsonArray("diagnosis");
10988      for (int i = 0; i < array.size(); i++) {
10989        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
10990      }
10991    };
10992    if (json.has("patient"))
10993      res.setPatient(parseReference(getJObject(json, "patient")));
10994    if (json.has("managingOrganization"))
10995      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
10996    if (json.has("period"))
10997      res.setPeriod(parsePeriod(getJObject(json, "period")));
10998    if (json.has("referralRequest")) {
10999      JsonArray array = json.getAsJsonArray("referralRequest");
11000      for (int i = 0; i < array.size(); i++) {
11001        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
11002      }
11003    };
11004    if (json.has("careManager"))
11005      res.setCareManager(parseReference(getJObject(json, "careManager")));
11006    if (json.has("team")) {
11007      JsonArray array = json.getAsJsonArray("team");
11008      for (int i = 0; i < array.size(); i++) {
11009        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
11010      }
11011    };
11012    if (json.has("account")) {
11013      JsonArray array = json.getAsJsonArray("account");
11014      for (int i = 0; i < array.size(); i++) {
11015        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
11016      }
11017    };
11018  }
11019
11020  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
11021    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
11022    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
11023    return res;
11024  }
11025
11026  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
11027    parseBackboneElementProperties(json, res);
11028    if (json.has("status"))
11029      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
11030    if (json.has("_status"))
11031      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11032    if (json.has("period"))
11033      res.setPeriod(parsePeriod(getJObject(json, "period")));
11034  }
11035
11036  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
11037    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
11038    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
11039    return res;
11040  }
11041
11042  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
11043    parseBackboneElementProperties(json, res);
11044    if (json.has("condition"))
11045      res.setCondition(parseReference(getJObject(json, "condition")));
11046    if (json.has("role"))
11047      res.setRole(parseCodeableConcept(getJObject(json, "role")));
11048    if (json.has("rank"))
11049      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
11050    if (json.has("_rank"))
11051      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
11052  }
11053
11054  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
11055    EventDefinition res = new EventDefinition();
11056    parseEventDefinitionProperties(json, res);
11057    return res;
11058  }
11059
11060  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res) throws IOException, FHIRFormatError {
11061    parseDomainResourceProperties(json, res);
11062    if (json.has("url"))
11063      res.setUrlElement(parseUri(json.get("url").getAsString()));
11064    if (json.has("_url"))
11065      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11066    if (json.has("identifier")) {
11067      JsonArray array = json.getAsJsonArray("identifier");
11068      for (int i = 0; i < array.size(); i++) {
11069        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11070      }
11071    };
11072    if (json.has("version"))
11073      res.setVersionElement(parseString(json.get("version").getAsString()));
11074    if (json.has("_version"))
11075      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11076    if (json.has("name"))
11077      res.setNameElement(parseString(json.get("name").getAsString()));
11078    if (json.has("_name"))
11079      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11080    if (json.has("title"))
11081      res.setTitleElement(parseString(json.get("title").getAsString()));
11082    if (json.has("_title"))
11083      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11084    if (json.has("subtitle"))
11085      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
11086    if (json.has("_subtitle"))
11087      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
11088    if (json.has("status"))
11089      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11090    if (json.has("_status"))
11091      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11092    if (json.has("experimental"))
11093      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11094    if (json.has("_experimental"))
11095      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
11096    Type subject = parseType("subject", json);
11097    if (subject != null)
11098      res.setSubject(subject);
11099    if (json.has("date"))
11100      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11101    if (json.has("_date"))
11102      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11103    if (json.has("publisher"))
11104      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11105    if (json.has("_publisher"))
11106      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11107    if (json.has("contact")) {
11108      JsonArray array = json.getAsJsonArray("contact");
11109      for (int i = 0; i < array.size(); i++) {
11110        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11111      }
11112    };
11113    if (json.has("description"))
11114      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11115    if (json.has("_description"))
11116      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11117    if (json.has("useContext")) {
11118      JsonArray array = json.getAsJsonArray("useContext");
11119      for (int i = 0; i < array.size(); i++) {
11120        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11121      }
11122    };
11123    if (json.has("jurisdiction")) {
11124      JsonArray array = json.getAsJsonArray("jurisdiction");
11125      for (int i = 0; i < array.size(); i++) {
11126        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11127      }
11128    };
11129    if (json.has("purpose"))
11130      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11131    if (json.has("_purpose"))
11132      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
11133    if (json.has("usage"))
11134      res.setUsageElement(parseString(json.get("usage").getAsString()));
11135    if (json.has("_usage"))
11136      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
11137    if (json.has("copyright"))
11138      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11139    if (json.has("_copyright"))
11140      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11141    if (json.has("approvalDate"))
11142      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11143    if (json.has("_approvalDate"))
11144      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
11145    if (json.has("lastReviewDate"))
11146      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11147    if (json.has("_lastReviewDate"))
11148      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
11149    if (json.has("effectivePeriod"))
11150      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
11151    if (json.has("topic")) {
11152      JsonArray array = json.getAsJsonArray("topic");
11153      for (int i = 0; i < array.size(); i++) {
11154        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11155      }
11156    };
11157    if (json.has("author")) {
11158      JsonArray array = json.getAsJsonArray("author");
11159      for (int i = 0; i < array.size(); i++) {
11160        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11161      }
11162    };
11163    if (json.has("editor")) {
11164      JsonArray array = json.getAsJsonArray("editor");
11165      for (int i = 0; i < array.size(); i++) {
11166        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11167      }
11168    };
11169    if (json.has("reviewer")) {
11170      JsonArray array = json.getAsJsonArray("reviewer");
11171      for (int i = 0; i < array.size(); i++) {
11172        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
11173      }
11174    };
11175    if (json.has("endorser")) {
11176      JsonArray array = json.getAsJsonArray("endorser");
11177      for (int i = 0; i < array.size(); i++) {
11178        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
11179      }
11180    };
11181    if (json.has("relatedArtifact")) {
11182      JsonArray array = json.getAsJsonArray("relatedArtifact");
11183      for (int i = 0; i < array.size(); i++) {
11184        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11185      }
11186    };
11187    if (json.has("trigger")) {
11188      JsonArray array = json.getAsJsonArray("trigger");
11189      for (int i = 0; i < array.size(); i++) {
11190        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
11191      }
11192    };
11193  }
11194
11195  protected Evidence parseEvidence(JsonObject json) throws IOException, FHIRFormatError {
11196    Evidence res = new Evidence();
11197    parseEvidenceProperties(json, res);
11198    return res;
11199  }
11200
11201  protected void parseEvidenceProperties(JsonObject json, Evidence res) throws IOException, FHIRFormatError {
11202    parseDomainResourceProperties(json, res);
11203    if (json.has("url"))
11204      res.setUrlElement(parseUri(json.get("url").getAsString()));
11205    if (json.has("_url"))
11206      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11207    if (json.has("identifier")) {
11208      JsonArray array = json.getAsJsonArray("identifier");
11209      for (int i = 0; i < array.size(); i++) {
11210        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11211      }
11212    };
11213    if (json.has("version"))
11214      res.setVersionElement(parseString(json.get("version").getAsString()));
11215    if (json.has("_version"))
11216      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11217    if (json.has("name"))
11218      res.setNameElement(parseString(json.get("name").getAsString()));
11219    if (json.has("_name"))
11220      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11221    if (json.has("title"))
11222      res.setTitleElement(parseString(json.get("title").getAsString()));
11223    if (json.has("_title"))
11224      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11225    if (json.has("shortTitle"))
11226      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
11227    if (json.has("_shortTitle"))
11228      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
11229    if (json.has("subtitle"))
11230      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
11231    if (json.has("_subtitle"))
11232      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
11233    if (json.has("status"))
11234      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11235    if (json.has("_status"))
11236      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11237    if (json.has("date"))
11238      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11239    if (json.has("_date"))
11240      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11241    if (json.has("publisher"))
11242      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11243    if (json.has("_publisher"))
11244      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11245    if (json.has("contact")) {
11246      JsonArray array = json.getAsJsonArray("contact");
11247      for (int i = 0; i < array.size(); i++) {
11248        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11249      }
11250    };
11251    if (json.has("description"))
11252      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11253    if (json.has("_description"))
11254      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11255    if (json.has("note")) {
11256      JsonArray array = json.getAsJsonArray("note");
11257      for (int i = 0; i < array.size(); i++) {
11258        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11259      }
11260    };
11261    if (json.has("useContext")) {
11262      JsonArray array = json.getAsJsonArray("useContext");
11263      for (int i = 0; i < array.size(); i++) {
11264        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11265      }
11266    };
11267    if (json.has("jurisdiction")) {
11268      JsonArray array = json.getAsJsonArray("jurisdiction");
11269      for (int i = 0; i < array.size(); i++) {
11270        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11271      }
11272    };
11273    if (json.has("copyright"))
11274      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11275    if (json.has("_copyright"))
11276      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11277    if (json.has("approvalDate"))
11278      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11279    if (json.has("_approvalDate"))
11280      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
11281    if (json.has("lastReviewDate"))
11282      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11283    if (json.has("_lastReviewDate"))
11284      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
11285    if (json.has("effectivePeriod"))
11286      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
11287    if (json.has("topic")) {
11288      JsonArray array = json.getAsJsonArray("topic");
11289      for (int i = 0; i < array.size(); i++) {
11290        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11291      }
11292    };
11293    if (json.has("author")) {
11294      JsonArray array = json.getAsJsonArray("author");
11295      for (int i = 0; i < array.size(); i++) {
11296        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11297      }
11298    };
11299    if (json.has("editor")) {
11300      JsonArray array = json.getAsJsonArray("editor");
11301      for (int i = 0; i < array.size(); i++) {
11302        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11303      }
11304    };
11305    if (json.has("reviewer")) {
11306      JsonArray array = json.getAsJsonArray("reviewer");
11307      for (int i = 0; i < array.size(); i++) {
11308        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
11309      }
11310    };
11311    if (json.has("endorser")) {
11312      JsonArray array = json.getAsJsonArray("endorser");
11313      for (int i = 0; i < array.size(); i++) {
11314        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
11315      }
11316    };
11317    if (json.has("relatedArtifact")) {
11318      JsonArray array = json.getAsJsonArray("relatedArtifact");
11319      for (int i = 0; i < array.size(); i++) {
11320        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11321      }
11322    };
11323    if (json.has("exposureBackground"))
11324      res.setExposureBackground(parseReference(getJObject(json, "exposureBackground")));
11325    if (json.has("exposureVariant")) {
11326      JsonArray array = json.getAsJsonArray("exposureVariant");
11327      for (int i = 0; i < array.size(); i++) {
11328        res.getExposureVariant().add(parseReference(array.get(i).getAsJsonObject()));
11329      }
11330    };
11331    if (json.has("outcome")) {
11332      JsonArray array = json.getAsJsonArray("outcome");
11333      for (int i = 0; i < array.size(); i++) {
11334        res.getOutcome().add(parseReference(array.get(i).getAsJsonObject()));
11335      }
11336    };
11337  }
11338
11339  protected EvidenceVariable parseEvidenceVariable(JsonObject json) throws IOException, FHIRFormatError {
11340    EvidenceVariable res = new EvidenceVariable();
11341    parseEvidenceVariableProperties(json, res);
11342    return res;
11343  }
11344
11345  protected void parseEvidenceVariableProperties(JsonObject json, EvidenceVariable res) throws IOException, FHIRFormatError {
11346    parseDomainResourceProperties(json, res);
11347    if (json.has("url"))
11348      res.setUrlElement(parseUri(json.get("url").getAsString()));
11349    if (json.has("_url"))
11350      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11351    if (json.has("identifier")) {
11352      JsonArray array = json.getAsJsonArray("identifier");
11353      for (int i = 0; i < array.size(); i++) {
11354        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11355      }
11356    };
11357    if (json.has("version"))
11358      res.setVersionElement(parseString(json.get("version").getAsString()));
11359    if (json.has("_version"))
11360      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11361    if (json.has("name"))
11362      res.setNameElement(parseString(json.get("name").getAsString()));
11363    if (json.has("_name"))
11364      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11365    if (json.has("title"))
11366      res.setTitleElement(parseString(json.get("title").getAsString()));
11367    if (json.has("_title"))
11368      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11369    if (json.has("shortTitle"))
11370      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
11371    if (json.has("_shortTitle"))
11372      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
11373    if (json.has("subtitle"))
11374      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
11375    if (json.has("_subtitle"))
11376      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
11377    if (json.has("status"))
11378      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11379    if (json.has("_status"))
11380      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11381    if (json.has("date"))
11382      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11383    if (json.has("_date"))
11384      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11385    if (json.has("publisher"))
11386      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11387    if (json.has("_publisher"))
11388      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11389    if (json.has("contact")) {
11390      JsonArray array = json.getAsJsonArray("contact");
11391      for (int i = 0; i < array.size(); i++) {
11392        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11393      }
11394    };
11395    if (json.has("description"))
11396      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11397    if (json.has("_description"))
11398      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11399    if (json.has("note")) {
11400      JsonArray array = json.getAsJsonArray("note");
11401      for (int i = 0; i < array.size(); i++) {
11402        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11403      }
11404    };
11405    if (json.has("useContext")) {
11406      JsonArray array = json.getAsJsonArray("useContext");
11407      for (int i = 0; i < array.size(); i++) {
11408        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11409      }
11410    };
11411    if (json.has("jurisdiction")) {
11412      JsonArray array = json.getAsJsonArray("jurisdiction");
11413      for (int i = 0; i < array.size(); i++) {
11414        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11415      }
11416    };
11417    if (json.has("copyright"))
11418      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11419    if (json.has("_copyright"))
11420      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11421    if (json.has("approvalDate"))
11422      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11423    if (json.has("_approvalDate"))
11424      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
11425    if (json.has("lastReviewDate"))
11426      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11427    if (json.has("_lastReviewDate"))
11428      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
11429    if (json.has("effectivePeriod"))
11430      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
11431    if (json.has("topic")) {
11432      JsonArray array = json.getAsJsonArray("topic");
11433      for (int i = 0; i < array.size(); i++) {
11434        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11435      }
11436    };
11437    if (json.has("author")) {
11438      JsonArray array = json.getAsJsonArray("author");
11439      for (int i = 0; i < array.size(); i++) {
11440        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11441      }
11442    };
11443    if (json.has("editor")) {
11444      JsonArray array = json.getAsJsonArray("editor");
11445      for (int i = 0; i < array.size(); i++) {
11446        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11447      }
11448    };
11449    if (json.has("reviewer")) {
11450      JsonArray array = json.getAsJsonArray("reviewer");
11451      for (int i = 0; i < array.size(); i++) {
11452        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
11453      }
11454    };
11455    if (json.has("endorser")) {
11456      JsonArray array = json.getAsJsonArray("endorser");
11457      for (int i = 0; i < array.size(); i++) {
11458        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
11459      }
11460    };
11461    if (json.has("relatedArtifact")) {
11462      JsonArray array = json.getAsJsonArray("relatedArtifact");
11463      for (int i = 0; i < array.size(); i++) {
11464        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11465      }
11466    };
11467    if (json.has("type"))
11468      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), EvidenceVariable.EvidenceVariableType.NULL, new EvidenceVariable.EvidenceVariableTypeEnumFactory()));
11469    if (json.has("_type"))
11470      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
11471    if (json.has("characteristic")) {
11472      JsonArray array = json.getAsJsonArray("characteristic");
11473      for (int i = 0; i < array.size(); i++) {
11474        res.getCharacteristic().add(parseEvidenceVariableEvidenceVariableCharacteristicComponent(array.get(i).getAsJsonObject(), res));
11475      }
11476    };
11477  }
11478
11479  protected EvidenceVariable.EvidenceVariableCharacteristicComponent parseEvidenceVariableEvidenceVariableCharacteristicComponent(JsonObject json, EvidenceVariable owner) throws IOException, FHIRFormatError {
11480    EvidenceVariable.EvidenceVariableCharacteristicComponent res = new EvidenceVariable.EvidenceVariableCharacteristicComponent();
11481    parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(json, owner, res);
11482    return res;
11483  }
11484
11485  protected void parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(JsonObject json, EvidenceVariable owner, EvidenceVariable.EvidenceVariableCharacteristicComponent res) throws IOException, FHIRFormatError {
11486    parseBackboneElementProperties(json, res);
11487    if (json.has("description"))
11488      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11489    if (json.has("_description"))
11490      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11491    Type definition = parseType("definition", json);
11492    if (definition != null)
11493      res.setDefinition(definition);
11494    if (json.has("usageContext")) {
11495      JsonArray array = json.getAsJsonArray("usageContext");
11496      for (int i = 0; i < array.size(); i++) {
11497        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11498      }
11499    };
11500    if (json.has("exclude"))
11501      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
11502    if (json.has("_exclude"))
11503      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
11504    Type participantEffective = parseType("participantEffective", json);
11505    if (participantEffective != null)
11506      res.setParticipantEffective(participantEffective);
11507    if (json.has("timeFromStart"))
11508      res.setTimeFromStart(parseDuration(getJObject(json, "timeFromStart")));
11509    if (json.has("groupMeasure"))
11510      res.setGroupMeasureElement(parseEnumeration(json.get("groupMeasure").getAsString(), EvidenceVariable.GroupMeasure.NULL, new EvidenceVariable.GroupMeasureEnumFactory()));
11511    if (json.has("_groupMeasure"))
11512      parseElementProperties(getJObject(json, "_groupMeasure"), res.getGroupMeasureElement());
11513  }
11514
11515  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
11516    ExampleScenario res = new ExampleScenario();
11517    parseExampleScenarioProperties(json, res);
11518    return res;
11519  }
11520
11521  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res) throws IOException, FHIRFormatError {
11522    parseDomainResourceProperties(json, res);
11523    if (json.has("url"))
11524      res.setUrlElement(parseUri(json.get("url").getAsString()));
11525    if (json.has("_url"))
11526      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11527    if (json.has("identifier")) {
11528      JsonArray array = json.getAsJsonArray("identifier");
11529      for (int i = 0; i < array.size(); i++) {
11530        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11531      }
11532    };
11533    if (json.has("version"))
11534      res.setVersionElement(parseString(json.get("version").getAsString()));
11535    if (json.has("_version"))
11536      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11537    if (json.has("name"))
11538      res.setNameElement(parseString(json.get("name").getAsString()));
11539    if (json.has("_name"))
11540      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11541    if (json.has("status"))
11542      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11543    if (json.has("_status"))
11544      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11545    if (json.has("experimental"))
11546      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11547    if (json.has("_experimental"))
11548      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
11549    if (json.has("date"))
11550      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11551    if (json.has("_date"))
11552      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11553    if (json.has("publisher"))
11554      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11555    if (json.has("_publisher"))
11556      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11557    if (json.has("contact")) {
11558      JsonArray array = json.getAsJsonArray("contact");
11559      for (int i = 0; i < array.size(); i++) {
11560        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11561      }
11562    };
11563    if (json.has("useContext")) {
11564      JsonArray array = json.getAsJsonArray("useContext");
11565      for (int i = 0; i < array.size(); i++) {
11566        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11567      }
11568    };
11569    if (json.has("jurisdiction")) {
11570      JsonArray array = json.getAsJsonArray("jurisdiction");
11571      for (int i = 0; i < array.size(); i++) {
11572        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11573      }
11574    };
11575    if (json.has("copyright"))
11576      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11577    if (json.has("_copyright"))
11578      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11579    if (json.has("purpose"))
11580      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11581    if (json.has("_purpose"))
11582      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
11583    if (json.has("actor")) {
11584      JsonArray array = json.getAsJsonArray("actor");
11585      for (int i = 0; i < array.size(); i++) {
11586        res.getActor().add(parseExampleScenarioExampleScenarioActorComponent(array.get(i).getAsJsonObject(), res));
11587      }
11588    };
11589    if (json.has("instance")) {
11590      JsonArray array = json.getAsJsonArray("instance");
11591      for (int i = 0; i < array.size(); i++) {
11592        res.getInstance().add(parseExampleScenarioExampleScenarioInstanceComponent(array.get(i).getAsJsonObject(), res));
11593      }
11594    };
11595    if (json.has("process")) {
11596      JsonArray array = json.getAsJsonArray("process");
11597      for (int i = 0; i < array.size(); i++) {
11598        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), res));
11599      }
11600    };
11601    if (json.has("workflow")) {
11602      JsonArray array = json.getAsJsonArray("workflow");
11603      for (int i = 0; i < array.size(); i++) {
11604        if (array.get(i).isJsonNull()) {
11605          res.getWorkflow().add(new CanonicalType());
11606        } else {
11607          res.getWorkflow().add(parseCanonical(array.get(i).getAsString()));
11608        }
11609      }
11610    };
11611    if (json.has("_workflow")) {
11612      JsonArray array = json.getAsJsonArray("_workflow");
11613      for (int i = 0; i < array.size(); i++) {
11614        if (i == res.getWorkflow().size())
11615          res.getWorkflow().add(parseCanonical(null));
11616        if (array.get(i) instanceof JsonObject) 
11617          parseElementProperties(array.get(i).getAsJsonObject(), res.getWorkflow().get(i));
11618      }
11619    };
11620  }
11621
11622  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioExampleScenarioActorComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11623    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
11624    parseExampleScenarioExampleScenarioActorComponentProperties(json, owner, res);
11625    return res;
11626  }
11627
11628  protected void parseExampleScenarioExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
11629    parseBackboneElementProperties(json, res);
11630    if (json.has("actorId"))
11631      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
11632    if (json.has("_actorId"))
11633      parseElementProperties(getJObject(json, "_actorId"), res.getActorIdElement());
11634    if (json.has("type"))
11635      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ExampleScenario.ExampleScenarioActorType.NULL, new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
11636    if (json.has("_type"))
11637      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
11638    if (json.has("name"))
11639      res.setNameElement(parseString(json.get("name").getAsString()));
11640    if (json.has("_name"))
11641      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11642    if (json.has("description"))
11643      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11644    if (json.has("_description"))
11645      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11646  }
11647
11648  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioExampleScenarioInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11649    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
11650    parseExampleScenarioExampleScenarioInstanceComponentProperties(json, owner, res);
11651    return res;
11652  }
11653
11654  protected void parseExampleScenarioExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
11655    parseBackboneElementProperties(json, res);
11656    if (json.has("resourceId"))
11657      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
11658    if (json.has("_resourceId"))
11659      parseElementProperties(getJObject(json, "_resourceId"), res.getResourceIdElement());
11660    if (json.has("resourceType"))
11661      res.setResourceTypeElement(parseEnumeration(json.get("resourceType").getAsString(), ExampleScenario.FHIRResourceType.NULL, new ExampleScenario.FHIRResourceTypeEnumFactory()));
11662    if (json.has("_resourceType"))
11663      parseElementProperties(getJObject(json, "_resourceType"), res.getResourceTypeElement());
11664    if (json.has("name"))
11665      res.setNameElement(parseString(json.get("name").getAsString()));
11666    if (json.has("_name"))
11667      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11668    if (json.has("description"))
11669      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11670    if (json.has("_description"))
11671      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11672    if (json.has("version")) {
11673      JsonArray array = json.getAsJsonArray("version");
11674      for (int i = 0; i < array.size(); i++) {
11675        res.getVersion().add(parseExampleScenarioExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject(), owner));
11676      }
11677    };
11678    if (json.has("containedInstance")) {
11679      JsonArray array = json.getAsJsonArray("containedInstance");
11680      for (int i = 0; i < array.size(); i++) {
11681        res.getContainedInstance().add(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(array.get(i).getAsJsonObject(), owner));
11682      }
11683    };
11684  }
11685
11686  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioExampleScenarioInstanceVersionComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11687    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
11688    parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(json, owner, res);
11689    return res;
11690  }
11691
11692  protected void parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceVersionComponent res) throws IOException, FHIRFormatError {
11693    parseBackboneElementProperties(json, res);
11694    if (json.has("versionId"))
11695      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
11696    if (json.has("_versionId"))
11697      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
11698    if (json.has("description"))
11699      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11700    if (json.has("_description"))
11701      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11702  }
11703
11704  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11705    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
11706    parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(json, owner, res);
11707    return res;
11708  }
11709
11710  protected void parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res) throws IOException, FHIRFormatError {
11711    parseBackboneElementProperties(json, res);
11712    if (json.has("resourceId"))
11713      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
11714    if (json.has("_resourceId"))
11715      parseElementProperties(getJObject(json, "_resourceId"), res.getResourceIdElement());
11716    if (json.has("versionId"))
11717      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
11718    if (json.has("_versionId"))
11719      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
11720  }
11721
11722  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioExampleScenarioProcessComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11723    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
11724    parseExampleScenarioExampleScenarioProcessComponentProperties(json, owner, res);
11725    return res;
11726  }
11727
11728  protected void parseExampleScenarioExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
11729    parseBackboneElementProperties(json, res);
11730    if (json.has("title"))
11731      res.setTitleElement(parseString(json.get("title").getAsString()));
11732    if (json.has("_title"))
11733      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11734    if (json.has("description"))
11735      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11736    if (json.has("_description"))
11737      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11738    if (json.has("preConditions"))
11739      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
11740    if (json.has("_preConditions"))
11741      parseElementProperties(getJObject(json, "_preConditions"), res.getPreConditionsElement());
11742    if (json.has("postConditions"))
11743      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
11744    if (json.has("_postConditions"))
11745      parseElementProperties(getJObject(json, "_postConditions"), res.getPostConditionsElement());
11746    if (json.has("step")) {
11747      JsonArray array = json.getAsJsonArray("step");
11748      for (int i = 0; i < array.size(); i++) {
11749        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
11750      }
11751    };
11752  }
11753
11754  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioExampleScenarioProcessStepComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11755    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
11756    parseExampleScenarioExampleScenarioProcessStepComponentProperties(json, owner, res);
11757    return res;
11758  }
11759
11760  protected void parseExampleScenarioExampleScenarioProcessStepComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepComponent res) throws IOException, FHIRFormatError {
11761    parseBackboneElementProperties(json, res);
11762    if (json.has("process")) {
11763      JsonArray array = json.getAsJsonArray("process");
11764      for (int i = 0; i < array.size(); i++) {
11765        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), owner));
11766      }
11767    };
11768    if (json.has("pause"))
11769      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
11770    if (json.has("_pause"))
11771      parseElementProperties(getJObject(json, "_pause"), res.getPauseElement());
11772    if (json.has("operation"))
11773      res.setOperation(parseExampleScenarioExampleScenarioProcessStepOperationComponent(getJObject(json, "operation"), owner));
11774    if (json.has("alternative")) {
11775      JsonArray array = json.getAsJsonArray("alternative");
11776      for (int i = 0; i < array.size(); i++) {
11777        res.getAlternative().add(parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(array.get(i).getAsJsonObject(), owner));
11778      }
11779    };
11780  }
11781
11782  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioExampleScenarioProcessStepOperationComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11783    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
11784    parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(json, owner, res);
11785    return res;
11786  }
11787
11788  protected void parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepOperationComponent res) throws IOException, FHIRFormatError {
11789    parseBackboneElementProperties(json, res);
11790    if (json.has("number"))
11791      res.setNumberElement(parseString(json.get("number").getAsString()));
11792    if (json.has("_number"))
11793      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
11794    if (json.has("type"))
11795      res.setTypeElement(parseString(json.get("type").getAsString()));
11796    if (json.has("_type"))
11797      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
11798    if (json.has("name"))
11799      res.setNameElement(parseString(json.get("name").getAsString()));
11800    if (json.has("_name"))
11801      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11802    if (json.has("initiator"))
11803      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
11804    if (json.has("_initiator"))
11805      parseElementProperties(getJObject(json, "_initiator"), res.getInitiatorElement());
11806    if (json.has("receiver"))
11807      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
11808    if (json.has("_receiver"))
11809      parseElementProperties(getJObject(json, "_receiver"), res.getReceiverElement());
11810    if (json.has("description"))
11811      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11812    if (json.has("_description"))
11813      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11814    if (json.has("initiatorActive"))
11815      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
11816    if (json.has("_initiatorActive"))
11817      parseElementProperties(getJObject(json, "_initiatorActive"), res.getInitiatorActiveElement());
11818    if (json.has("receiverActive"))
11819      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
11820    if (json.has("_receiverActive"))
11821      parseElementProperties(getJObject(json, "_receiverActive"), res.getReceiverActiveElement());
11822    if (json.has("request"))
11823      res.setRequest(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(getJObject(json, "request"), owner));
11824    if (json.has("response"))
11825      res.setResponse(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(getJObject(json, "response"), owner));
11826  }
11827
11828  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11829    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
11830    parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(json, owner, res);
11831    return res;
11832  }
11833
11834  protected void parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res) throws IOException, FHIRFormatError {
11835    parseBackboneElementProperties(json, res);
11836    if (json.has("title"))
11837      res.setTitleElement(parseString(json.get("title").getAsString()));
11838    if (json.has("_title"))
11839      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11840    if (json.has("description"))
11841      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11842    if (json.has("_description"))
11843      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11844    if (json.has("step")) {
11845      JsonArray array = json.getAsJsonArray("step");
11846      for (int i = 0; i < array.size(); i++) {
11847        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
11848      }
11849    };
11850  }
11851
11852  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
11853    ExplanationOfBenefit res = new ExplanationOfBenefit();
11854    parseExplanationOfBenefitProperties(json, res);
11855    return res;
11856  }
11857
11858  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
11859    parseDomainResourceProperties(json, res);
11860    if (json.has("identifier")) {
11861      JsonArray array = json.getAsJsonArray("identifier");
11862      for (int i = 0; i < array.size(); i++) {
11863        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11864      }
11865    };
11866    if (json.has("status"))
11867      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
11868    if (json.has("_status"))
11869      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11870    if (json.has("type"))
11871      res.setType(parseCodeableConcept(getJObject(json, "type")));
11872    if (json.has("subType"))
11873      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
11874    if (json.has("use"))
11875      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ExplanationOfBenefit.Use.NULL, new ExplanationOfBenefit.UseEnumFactory()));
11876    if (json.has("_use"))
11877      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
11878    if (json.has("patient"))
11879      res.setPatient(parseReference(getJObject(json, "patient")));
11880    if (json.has("billablePeriod"))
11881      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
11882    if (json.has("created"))
11883      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11884    if (json.has("_created"))
11885      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
11886    if (json.has("enterer"))
11887      res.setEnterer(parseReference(getJObject(json, "enterer")));
11888    if (json.has("insurer"))
11889      res.setInsurer(parseReference(getJObject(json, "insurer")));
11890    if (json.has("provider"))
11891      res.setProvider(parseReference(getJObject(json, "provider")));
11892    if (json.has("priority"))
11893      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
11894    if (json.has("fundsReserveRequested"))
11895      res.setFundsReserveRequested(parseCodeableConcept(getJObject(json, "fundsReserveRequested")));
11896    if (json.has("fundsReserve"))
11897      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
11898    if (json.has("related")) {
11899      JsonArray array = json.getAsJsonArray("related");
11900      for (int i = 0; i < array.size(); i++) {
11901        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
11902      }
11903    };
11904    if (json.has("prescription"))
11905      res.setPrescription(parseReference(getJObject(json, "prescription")));
11906    if (json.has("originalPrescription"))
11907      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
11908    if (json.has("payee"))
11909      res.setPayee(parseExplanationOfBenefitPayeeComponent(getJObject(json, "payee"), res));
11910    if (json.has("referral"))
11911      res.setReferral(parseReference(getJObject(json, "referral")));
11912    if (json.has("facility"))
11913      res.setFacility(parseReference(getJObject(json, "facility")));
11914    if (json.has("claim"))
11915      res.setClaim(parseReference(getJObject(json, "claim")));
11916    if (json.has("claimResponse"))
11917      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
11918    if (json.has("outcome"))
11919      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ExplanationOfBenefit.RemittanceOutcome.NULL, new ExplanationOfBenefit.RemittanceOutcomeEnumFactory()));
11920    if (json.has("_outcome"))
11921      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
11922    if (json.has("disposition"))
11923      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
11924    if (json.has("_disposition"))
11925      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
11926    if (json.has("preAuthRef")) {
11927      JsonArray array = json.getAsJsonArray("preAuthRef");
11928      for (int i = 0; i < array.size(); i++) {
11929        if (array.get(i).isJsonNull()) {
11930          res.getPreAuthRef().add(new StringType());
11931        } else {
11932          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
11933        }
11934      }
11935    };
11936    if (json.has("_preAuthRef")) {
11937      JsonArray array = json.getAsJsonArray("_preAuthRef");
11938      for (int i = 0; i < array.size(); i++) {
11939        if (i == res.getPreAuthRef().size())
11940          res.getPreAuthRef().add(parseString(null));
11941        if (array.get(i) instanceof JsonObject) 
11942          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
11943      }
11944    };
11945    if (json.has("preAuthRefPeriod")) {
11946      JsonArray array = json.getAsJsonArray("preAuthRefPeriod");
11947      for (int i = 0; i < array.size(); i++) {
11948        res.getPreAuthRefPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
11949      }
11950    };
11951    if (json.has("careTeam")) {
11952      JsonArray array = json.getAsJsonArray("careTeam");
11953      for (int i = 0; i < array.size(); i++) {
11954        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
11955      }
11956    };
11957    if (json.has("supportingInfo")) {
11958      JsonArray array = json.getAsJsonArray("supportingInfo");
11959      for (int i = 0; i < array.size(); i++) {
11960        res.getSupportingInfo().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
11961      }
11962    };
11963    if (json.has("diagnosis")) {
11964      JsonArray array = json.getAsJsonArray("diagnosis");
11965      for (int i = 0; i < array.size(); i++) {
11966        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
11967      }
11968    };
11969    if (json.has("procedure")) {
11970      JsonArray array = json.getAsJsonArray("procedure");
11971      for (int i = 0; i < array.size(); i++) {
11972        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
11973      }
11974    };
11975    if (json.has("precedence"))
11976      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
11977    if (json.has("_precedence"))
11978      parseElementProperties(getJObject(json, "_precedence"), res.getPrecedenceElement());
11979    if (json.has("insurance")) {
11980      JsonArray array = json.getAsJsonArray("insurance");
11981      for (int i = 0; i < array.size(); i++) {
11982        res.getInsurance().add(parseExplanationOfBenefitInsuranceComponent(array.get(i).getAsJsonObject(), res));
11983      }
11984    };
11985    if (json.has("accident"))
11986      res.setAccident(parseExplanationOfBenefitAccidentComponent(getJObject(json, "accident"), res));
11987    if (json.has("item")) {
11988      JsonArray array = json.getAsJsonArray("item");
11989      for (int i = 0; i < array.size(); i++) {
11990        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
11991      }
11992    };
11993    if (json.has("addItem")) {
11994      JsonArray array = json.getAsJsonArray("addItem");
11995      for (int i = 0; i < array.size(); i++) {
11996        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
11997      }
11998    };
11999    if (json.has("adjudication")) {
12000      JsonArray array = json.getAsJsonArray("adjudication");
12001      for (int i = 0; i < array.size(); i++) {
12002        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), res));
12003      }
12004    };
12005    if (json.has("total")) {
12006      JsonArray array = json.getAsJsonArray("total");
12007      for (int i = 0; i < array.size(); i++) {
12008        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject(), res));
12009      }
12010    };
12011    if (json.has("payment"))
12012      res.setPayment(parseExplanationOfBenefitPaymentComponent(getJObject(json, "payment"), res));
12013    if (json.has("formCode"))
12014      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
12015    if (json.has("form"))
12016      res.setForm(parseAttachment(getJObject(json, "form")));
12017    if (json.has("processNote")) {
12018      JsonArray array = json.getAsJsonArray("processNote");
12019      for (int i = 0; i < array.size(); i++) {
12020        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
12021      }
12022    };
12023    if (json.has("benefitPeriod"))
12024      res.setBenefitPeriod(parsePeriod(getJObject(json, "benefitPeriod")));
12025    if (json.has("benefitBalance")) {
12026      JsonArray array = json.getAsJsonArray("benefitBalance");
12027      for (int i = 0; i < array.size(); i++) {
12028        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
12029      }
12030    };
12031  }
12032
12033  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12034    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
12035    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
12036    return res;
12037  }
12038
12039  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
12040    parseBackboneElementProperties(json, res);
12041    if (json.has("claim"))
12042      res.setClaim(parseReference(getJObject(json, "claim")));
12043    if (json.has("relationship"))
12044      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
12045    if (json.has("reference"))
12046      res.setReference(parseIdentifier(getJObject(json, "reference")));
12047  }
12048
12049  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12050    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
12051    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
12052    return res;
12053  }
12054
12055  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
12056    parseBackboneElementProperties(json, res);
12057    if (json.has("type"))
12058      res.setType(parseCodeableConcept(getJObject(json, "type")));
12059    if (json.has("party"))
12060      res.setParty(parseReference(getJObject(json, "party")));
12061  }
12062
12063  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12064    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
12065    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
12066    return res;
12067  }
12068
12069  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
12070    parseBackboneElementProperties(json, res);
12071    if (json.has("sequence"))
12072      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12073    if (json.has("_sequence"))
12074      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
12075    if (json.has("provider"))
12076      res.setProvider(parseReference(getJObject(json, "provider")));
12077    if (json.has("responsible"))
12078      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
12079    if (json.has("_responsible"))
12080      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
12081    if (json.has("role"))
12082      res.setRole(parseCodeableConcept(getJObject(json, "role")));
12083    if (json.has("qualification"))
12084      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
12085  }
12086
12087  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12088    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
12089    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
12090    return res;
12091  }
12092
12093  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
12094    parseBackboneElementProperties(json, res);
12095    if (json.has("sequence"))
12096      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12097    if (json.has("_sequence"))
12098      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
12099    if (json.has("category"))
12100      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12101    if (json.has("code"))
12102      res.setCode(parseCodeableConcept(getJObject(json, "code")));
12103    Type timing = parseType("timing", json);
12104    if (timing != null)
12105      res.setTiming(timing);
12106    Type value = parseType("value", json);
12107    if (value != null)
12108      res.setValue(value);
12109    if (json.has("reason"))
12110      res.setReason(parseCoding(getJObject(json, "reason")));
12111  }
12112
12113  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12114    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
12115    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
12116    return res;
12117  }
12118
12119  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
12120    parseBackboneElementProperties(json, res);
12121    if (json.has("sequence"))
12122      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12123    if (json.has("_sequence"))
12124      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
12125    Type diagnosis = parseType("diagnosis", json);
12126    if (diagnosis != null)
12127      res.setDiagnosis(diagnosis);
12128    if (json.has("type")) {
12129      JsonArray array = json.getAsJsonArray("type");
12130      for (int i = 0; i < array.size(); i++) {
12131        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12132      }
12133    };
12134    if (json.has("onAdmission"))
12135      res.setOnAdmission(parseCodeableConcept(getJObject(json, "onAdmission")));
12136    if (json.has("packageCode"))
12137      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
12138  }
12139
12140  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12141    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
12142    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
12143    return res;
12144  }
12145
12146  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
12147    parseBackboneElementProperties(json, res);
12148    if (json.has("sequence"))
12149      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12150    if (json.has("_sequence"))
12151      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
12152    if (json.has("type")) {
12153      JsonArray array = json.getAsJsonArray("type");
12154      for (int i = 0; i < array.size(); i++) {
12155        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12156      }
12157    };
12158    if (json.has("date"))
12159      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12160    if (json.has("_date"))
12161      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12162    Type procedure = parseType("procedure", json);
12163    if (procedure != null)
12164      res.setProcedure(procedure);
12165    if (json.has("udi")) {
12166      JsonArray array = json.getAsJsonArray("udi");
12167      for (int i = 0; i < array.size(); i++) {
12168        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12169      }
12170    };
12171  }
12172
12173  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12174    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
12175    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
12176    return res;
12177  }
12178
12179  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
12180    parseBackboneElementProperties(json, res);
12181    if (json.has("focal"))
12182      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
12183    if (json.has("_focal"))
12184      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
12185    if (json.has("coverage"))
12186      res.setCoverage(parseReference(getJObject(json, "coverage")));
12187    if (json.has("preAuthRef")) {
12188      JsonArray array = json.getAsJsonArray("preAuthRef");
12189      for (int i = 0; i < array.size(); i++) {
12190        if (array.get(i).isJsonNull()) {
12191          res.getPreAuthRef().add(new StringType());
12192        } else {
12193          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
12194        }
12195      }
12196    };
12197    if (json.has("_preAuthRef")) {
12198      JsonArray array = json.getAsJsonArray("_preAuthRef");
12199      for (int i = 0; i < array.size(); i++) {
12200        if (i == res.getPreAuthRef().size())
12201          res.getPreAuthRef().add(parseString(null));
12202        if (array.get(i) instanceof JsonObject) 
12203          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
12204      }
12205    };
12206  }
12207
12208  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12209    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
12210    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
12211    return res;
12212  }
12213
12214  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
12215    parseBackboneElementProperties(json, res);
12216    if (json.has("date"))
12217      res.setDateElement(parseDate(json.get("date").getAsString()));
12218    if (json.has("_date"))
12219      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12220    if (json.has("type"))
12221      res.setType(parseCodeableConcept(getJObject(json, "type")));
12222    Type location = parseType("location", json);
12223    if (location != null)
12224      res.setLocation(location);
12225  }
12226
12227  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12228    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
12229    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
12230    return res;
12231  }
12232
12233  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
12234    parseBackboneElementProperties(json, res);
12235    if (json.has("sequence"))
12236      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12237    if (json.has("_sequence"))
12238      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
12239    if (json.has("careTeamSequence")) {
12240      JsonArray array = json.getAsJsonArray("careTeamSequence");
12241      for (int i = 0; i < array.size(); i++) {
12242        if (array.get(i).isJsonNull()) {
12243          res.getCareTeamSequence().add(new PositiveIntType());
12244        } else {
12245          res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
12246        }
12247      }
12248    };
12249    if (json.has("_careTeamSequence")) {
12250      JsonArray array = json.getAsJsonArray("_careTeamSequence");
12251      for (int i = 0; i < array.size(); i++) {
12252        if (i == res.getCareTeamSequence().size())
12253          res.getCareTeamSequence().add(parsePositiveInt(null));
12254        if (array.get(i) instanceof JsonObject) 
12255          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
12256      }
12257    };
12258    if (json.has("diagnosisSequence")) {
12259      JsonArray array = json.getAsJsonArray("diagnosisSequence");
12260      for (int i = 0; i < array.size(); i++) {
12261        if (array.get(i).isJsonNull()) {
12262          res.getDiagnosisSequence().add(new PositiveIntType());
12263        } else {
12264          res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
12265        }
12266      }
12267    };
12268    if (json.has("_diagnosisSequence")) {
12269      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
12270      for (int i = 0; i < array.size(); i++) {
12271        if (i == res.getDiagnosisSequence().size())
12272          res.getDiagnosisSequence().add(parsePositiveInt(null));
12273        if (array.get(i) instanceof JsonObject) 
12274          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
12275      }
12276    };
12277    if (json.has("procedureSequence")) {
12278      JsonArray array = json.getAsJsonArray("procedureSequence");
12279      for (int i = 0; i < array.size(); i++) {
12280        if (array.get(i).isJsonNull()) {
12281          res.getProcedureSequence().add(new PositiveIntType());
12282        } else {
12283          res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
12284        }
12285      }
12286    };
12287    if (json.has("_procedureSequence")) {
12288      JsonArray array = json.getAsJsonArray("_procedureSequence");
12289      for (int i = 0; i < array.size(); i++) {
12290        if (i == res.getProcedureSequence().size())
12291          res.getProcedureSequence().add(parsePositiveInt(null));
12292        if (array.get(i) instanceof JsonObject) 
12293          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
12294      }
12295    };
12296    if (json.has("informationSequence")) {
12297      JsonArray array = json.getAsJsonArray("informationSequence");
12298      for (int i = 0; i < array.size(); i++) {
12299        if (array.get(i).isJsonNull()) {
12300          res.getInformationSequence().add(new PositiveIntType());
12301        } else {
12302          res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
12303        }
12304      }
12305    };
12306    if (json.has("_informationSequence")) {
12307      JsonArray array = json.getAsJsonArray("_informationSequence");
12308      for (int i = 0; i < array.size(); i++) {
12309        if (i == res.getInformationSequence().size())
12310          res.getInformationSequence().add(parsePositiveInt(null));
12311        if (array.get(i) instanceof JsonObject) 
12312          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
12313      }
12314    };
12315    if (json.has("revenue"))
12316      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
12317    if (json.has("category"))
12318      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12319    if (json.has("productOrService"))
12320      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12321    if (json.has("modifier")) {
12322      JsonArray array = json.getAsJsonArray("modifier");
12323      for (int i = 0; i < array.size(); i++) {
12324        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12325      }
12326    };
12327    if (json.has("programCode")) {
12328      JsonArray array = json.getAsJsonArray("programCode");
12329      for (int i = 0; i < array.size(); i++) {
12330        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12331      }
12332    };
12333    Type serviced = parseType("serviced", json);
12334    if (serviced != null)
12335      res.setServiced(serviced);
12336    Type location = parseType("location", json);
12337    if (location != null)
12338      res.setLocation(location);
12339    if (json.has("quantity"))
12340      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12341    if (json.has("unitPrice"))
12342      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12343    if (json.has("factor"))
12344      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12345    if (json.has("_factor"))
12346      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12347    if (json.has("net"))
12348      res.setNet(parseMoney(getJObject(json, "net")));
12349    if (json.has("udi")) {
12350      JsonArray array = json.getAsJsonArray("udi");
12351      for (int i = 0; i < array.size(); i++) {
12352        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12353      }
12354    };
12355    if (json.has("bodySite"))
12356      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
12357    if (json.has("subSite")) {
12358      JsonArray array = json.getAsJsonArray("subSite");
12359      for (int i = 0; i < array.size(); i++) {
12360        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12361      }
12362    };
12363    if (json.has("encounter")) {
12364      JsonArray array = json.getAsJsonArray("encounter");
12365      for (int i = 0; i < array.size(); i++) {
12366        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
12367      }
12368    };
12369    if (json.has("noteNumber")) {
12370      JsonArray array = json.getAsJsonArray("noteNumber");
12371      for (int i = 0; i < array.size(); i++) {
12372        if (array.get(i).isJsonNull()) {
12373          res.getNoteNumber().add(new PositiveIntType());
12374        } else {
12375          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12376        }
12377      }
12378    };
12379    if (json.has("_noteNumber")) {
12380      JsonArray array = json.getAsJsonArray("_noteNumber");
12381      for (int i = 0; i < array.size(); i++) {
12382        if (i == res.getNoteNumber().size())
12383          res.getNoteNumber().add(parsePositiveInt(null));
12384        if (array.get(i) instanceof JsonObject) 
12385          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12386      }
12387    };
12388    if (json.has("adjudication")) {
12389      JsonArray array = json.getAsJsonArray("adjudication");
12390      for (int i = 0; i < array.size(); i++) {
12391        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12392      }
12393    };
12394    if (json.has("detail")) {
12395      JsonArray array = json.getAsJsonArray("detail");
12396      for (int i = 0; i < array.size(); i++) {
12397        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
12398      }
12399    };
12400  }
12401
12402  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12403    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
12404    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
12405    return res;
12406  }
12407
12408  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
12409    parseBackboneElementProperties(json, res);
12410    if (json.has("category"))
12411      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12412    if (json.has("reason"))
12413      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
12414    if (json.has("amount"))
12415      res.setAmount(parseMoney(getJObject(json, "amount")));
12416    if (json.has("value"))
12417      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
12418    if (json.has("_value"))
12419      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
12420  }
12421
12422  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12423    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
12424    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
12425    return res;
12426  }
12427
12428  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
12429    parseBackboneElementProperties(json, res);
12430    if (json.has("sequence"))
12431      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12432    if (json.has("_sequence"))
12433      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
12434    if (json.has("revenue"))
12435      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
12436    if (json.has("category"))
12437      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12438    if (json.has("productOrService"))
12439      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12440    if (json.has("modifier")) {
12441      JsonArray array = json.getAsJsonArray("modifier");
12442      for (int i = 0; i < array.size(); i++) {
12443        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12444      }
12445    };
12446    if (json.has("programCode")) {
12447      JsonArray array = json.getAsJsonArray("programCode");
12448      for (int i = 0; i < array.size(); i++) {
12449        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12450      }
12451    };
12452    if (json.has("quantity"))
12453      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12454    if (json.has("unitPrice"))
12455      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12456    if (json.has("factor"))
12457      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12458    if (json.has("_factor"))
12459      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12460    if (json.has("net"))
12461      res.setNet(parseMoney(getJObject(json, "net")));
12462    if (json.has("udi")) {
12463      JsonArray array = json.getAsJsonArray("udi");
12464      for (int i = 0; i < array.size(); i++) {
12465        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12466      }
12467    };
12468    if (json.has("noteNumber")) {
12469      JsonArray array = json.getAsJsonArray("noteNumber");
12470      for (int i = 0; i < array.size(); i++) {
12471        if (array.get(i).isJsonNull()) {
12472          res.getNoteNumber().add(new PositiveIntType());
12473        } else {
12474          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12475        }
12476      }
12477    };
12478    if (json.has("_noteNumber")) {
12479      JsonArray array = json.getAsJsonArray("_noteNumber");
12480      for (int i = 0; i < array.size(); i++) {
12481        if (i == res.getNoteNumber().size())
12482          res.getNoteNumber().add(parsePositiveInt(null));
12483        if (array.get(i) instanceof JsonObject) 
12484          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12485      }
12486    };
12487    if (json.has("adjudication")) {
12488      JsonArray array = json.getAsJsonArray("adjudication");
12489      for (int i = 0; i < array.size(); i++) {
12490        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12491      }
12492    };
12493    if (json.has("subDetail")) {
12494      JsonArray array = json.getAsJsonArray("subDetail");
12495      for (int i = 0; i < array.size(); i++) {
12496        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
12497      }
12498    };
12499  }
12500
12501  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12502    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
12503    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
12504    return res;
12505  }
12506
12507  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
12508    parseBackboneElementProperties(json, res);
12509    if (json.has("sequence"))
12510      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12511    if (json.has("_sequence"))
12512      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
12513    if (json.has("revenue"))
12514      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
12515    if (json.has("category"))
12516      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12517    if (json.has("productOrService"))
12518      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12519    if (json.has("modifier")) {
12520      JsonArray array = json.getAsJsonArray("modifier");
12521      for (int i = 0; i < array.size(); i++) {
12522        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12523      }
12524    };
12525    if (json.has("programCode")) {
12526      JsonArray array = json.getAsJsonArray("programCode");
12527      for (int i = 0; i < array.size(); i++) {
12528        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12529      }
12530    };
12531    if (json.has("quantity"))
12532      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12533    if (json.has("unitPrice"))
12534      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12535    if (json.has("factor"))
12536      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12537    if (json.has("_factor"))
12538      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12539    if (json.has("net"))
12540      res.setNet(parseMoney(getJObject(json, "net")));
12541    if (json.has("udi")) {
12542      JsonArray array = json.getAsJsonArray("udi");
12543      for (int i = 0; i < array.size(); i++) {
12544        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12545      }
12546    };
12547    if (json.has("noteNumber")) {
12548      JsonArray array = json.getAsJsonArray("noteNumber");
12549      for (int i = 0; i < array.size(); i++) {
12550        if (array.get(i).isJsonNull()) {
12551          res.getNoteNumber().add(new PositiveIntType());
12552        } else {
12553          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12554        }
12555      }
12556    };
12557    if (json.has("_noteNumber")) {
12558      JsonArray array = json.getAsJsonArray("_noteNumber");
12559      for (int i = 0; i < array.size(); i++) {
12560        if (i == res.getNoteNumber().size())
12561          res.getNoteNumber().add(parsePositiveInt(null));
12562        if (array.get(i) instanceof JsonObject) 
12563          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12564      }
12565    };
12566    if (json.has("adjudication")) {
12567      JsonArray array = json.getAsJsonArray("adjudication");
12568      for (int i = 0; i < array.size(); i++) {
12569        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12570      }
12571    };
12572  }
12573
12574  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12575    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
12576    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
12577    return res;
12578  }
12579
12580  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
12581    parseBackboneElementProperties(json, res);
12582    if (json.has("itemSequence")) {
12583      JsonArray array = json.getAsJsonArray("itemSequence");
12584      for (int i = 0; i < array.size(); i++) {
12585        if (array.get(i).isJsonNull()) {
12586          res.getItemSequence().add(new PositiveIntType());
12587        } else {
12588          res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
12589        }
12590      }
12591    };
12592    if (json.has("_itemSequence")) {
12593      JsonArray array = json.getAsJsonArray("_itemSequence");
12594      for (int i = 0; i < array.size(); i++) {
12595        if (i == res.getItemSequence().size())
12596          res.getItemSequence().add(parsePositiveInt(null));
12597        if (array.get(i) instanceof JsonObject) 
12598          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
12599      }
12600    };
12601    if (json.has("detailSequence")) {
12602      JsonArray array = json.getAsJsonArray("detailSequence");
12603      for (int i = 0; i < array.size(); i++) {
12604        if (array.get(i).isJsonNull()) {
12605          res.getDetailSequence().add(new PositiveIntType());
12606        } else {
12607          res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
12608        }
12609      }
12610    };
12611    if (json.has("_detailSequence")) {
12612      JsonArray array = json.getAsJsonArray("_detailSequence");
12613      for (int i = 0; i < array.size(); i++) {
12614        if (i == res.getDetailSequence().size())
12615          res.getDetailSequence().add(parsePositiveInt(null));
12616        if (array.get(i) instanceof JsonObject) 
12617          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
12618      }
12619    };
12620    if (json.has("subDetailSequence")) {
12621      JsonArray array = json.getAsJsonArray("subDetailSequence");
12622      for (int i = 0; i < array.size(); i++) {
12623        if (array.get(i).isJsonNull()) {
12624          res.getSubDetailSequence().add(new PositiveIntType());
12625        } else {
12626          res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
12627        }
12628      }
12629    };
12630    if (json.has("_subDetailSequence")) {
12631      JsonArray array = json.getAsJsonArray("_subDetailSequence");
12632      for (int i = 0; i < array.size(); i++) {
12633        if (i == res.getSubDetailSequence().size())
12634          res.getSubDetailSequence().add(parsePositiveInt(null));
12635        if (array.get(i) instanceof JsonObject) 
12636          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
12637      }
12638    };
12639    if (json.has("provider")) {
12640      JsonArray array = json.getAsJsonArray("provider");
12641      for (int i = 0; i < array.size(); i++) {
12642        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
12643      }
12644    };
12645    if (json.has("productOrService"))
12646      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12647    if (json.has("modifier")) {
12648      JsonArray array = json.getAsJsonArray("modifier");
12649      for (int i = 0; i < array.size(); i++) {
12650        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12651      }
12652    };
12653    if (json.has("programCode")) {
12654      JsonArray array = json.getAsJsonArray("programCode");
12655      for (int i = 0; i < array.size(); i++) {
12656        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12657      }
12658    };
12659    Type serviced = parseType("serviced", json);
12660    if (serviced != null)
12661      res.setServiced(serviced);
12662    Type location = parseType("location", json);
12663    if (location != null)
12664      res.setLocation(location);
12665    if (json.has("quantity"))
12666      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12667    if (json.has("unitPrice"))
12668      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12669    if (json.has("factor"))
12670      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12671    if (json.has("_factor"))
12672      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12673    if (json.has("net"))
12674      res.setNet(parseMoney(getJObject(json, "net")));
12675    if (json.has("bodySite"))
12676      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
12677    if (json.has("subSite")) {
12678      JsonArray array = json.getAsJsonArray("subSite");
12679      for (int i = 0; i < array.size(); i++) {
12680        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12681      }
12682    };
12683    if (json.has("noteNumber")) {
12684      JsonArray array = json.getAsJsonArray("noteNumber");
12685      for (int i = 0; i < array.size(); i++) {
12686        if (array.get(i).isJsonNull()) {
12687          res.getNoteNumber().add(new PositiveIntType());
12688        } else {
12689          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12690        }
12691      }
12692    };
12693    if (json.has("_noteNumber")) {
12694      JsonArray array = json.getAsJsonArray("_noteNumber");
12695      for (int i = 0; i < array.size(); i++) {
12696        if (i == res.getNoteNumber().size())
12697          res.getNoteNumber().add(parsePositiveInt(null));
12698        if (array.get(i) instanceof JsonObject) 
12699          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12700      }
12701    };
12702    if (json.has("adjudication")) {
12703      JsonArray array = json.getAsJsonArray("adjudication");
12704      for (int i = 0; i < array.size(); i++) {
12705        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12706      }
12707    };
12708    if (json.has("detail")) {
12709      JsonArray array = json.getAsJsonArray("detail");
12710      for (int i = 0; i < array.size(); i++) {
12711        res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
12712      }
12713    };
12714  }
12715
12716  protected ExplanationOfBenefit.AddedItemDetailComponent parseExplanationOfBenefitAddedItemDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12717    ExplanationOfBenefit.AddedItemDetailComponent res = new ExplanationOfBenefit.AddedItemDetailComponent();
12718    parseExplanationOfBenefitAddedItemDetailComponentProperties(json, owner, res);
12719    return res;
12720  }
12721
12722  protected void parseExplanationOfBenefitAddedItemDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
12723    parseBackboneElementProperties(json, res);
12724    if (json.has("productOrService"))
12725      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12726    if (json.has("modifier")) {
12727      JsonArray array = json.getAsJsonArray("modifier");
12728      for (int i = 0; i < array.size(); i++) {
12729        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12730      }
12731    };
12732    if (json.has("quantity"))
12733      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12734    if (json.has("unitPrice"))
12735      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12736    if (json.has("factor"))
12737      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12738    if (json.has("_factor"))
12739      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12740    if (json.has("net"))
12741      res.setNet(parseMoney(getJObject(json, "net")));
12742    if (json.has("noteNumber")) {
12743      JsonArray array = json.getAsJsonArray("noteNumber");
12744      for (int i = 0; i < array.size(); i++) {
12745        if (array.get(i).isJsonNull()) {
12746          res.getNoteNumber().add(new PositiveIntType());
12747        } else {
12748          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12749        }
12750      }
12751    };
12752    if (json.has("_noteNumber")) {
12753      JsonArray array = json.getAsJsonArray("_noteNumber");
12754      for (int i = 0; i < array.size(); i++) {
12755        if (i == res.getNoteNumber().size())
12756          res.getNoteNumber().add(parsePositiveInt(null));
12757        if (array.get(i) instanceof JsonObject) 
12758          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12759      }
12760    };
12761    if (json.has("adjudication")) {
12762      JsonArray array = json.getAsJsonArray("adjudication");
12763      for (int i = 0; i < array.size(); i++) {
12764        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12765      }
12766    };
12767    if (json.has("subDetail")) {
12768      JsonArray array = json.getAsJsonArray("subDetail");
12769      for (int i = 0; i < array.size(); i++) {
12770        res.getSubDetail().add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(array.get(i).getAsJsonObject(), owner));
12771      }
12772    };
12773  }
12774
12775  protected ExplanationOfBenefit.AddedItemDetailSubDetailComponent parseExplanationOfBenefitAddedItemDetailSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12776    ExplanationOfBenefit.AddedItemDetailSubDetailComponent res = new ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
12777    parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(json, owner, res);
12778    return res;
12779  }
12780
12781  protected void parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res) throws IOException, FHIRFormatError {
12782    parseBackboneElementProperties(json, res);
12783    if (json.has("productOrService"))
12784      res.setProductOrService(parseCodeableConcept(getJObject(json, "productOrService")));
12785    if (json.has("modifier")) {
12786      JsonArray array = json.getAsJsonArray("modifier");
12787      for (int i = 0; i < array.size(); i++) {
12788        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12789      }
12790    };
12791    if (json.has("quantity"))
12792      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
12793    if (json.has("unitPrice"))
12794      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
12795    if (json.has("factor"))
12796      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12797    if (json.has("_factor"))
12798      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
12799    if (json.has("net"))
12800      res.setNet(parseMoney(getJObject(json, "net")));
12801    if (json.has("noteNumber")) {
12802      JsonArray array = json.getAsJsonArray("noteNumber");
12803      for (int i = 0; i < array.size(); i++) {
12804        if (array.get(i).isJsonNull()) {
12805          res.getNoteNumber().add(new PositiveIntType());
12806        } else {
12807          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12808        }
12809      }
12810    };
12811    if (json.has("_noteNumber")) {
12812      JsonArray array = json.getAsJsonArray("_noteNumber");
12813      for (int i = 0; i < array.size(); i++) {
12814        if (i == res.getNoteNumber().size())
12815          res.getNoteNumber().add(parsePositiveInt(null));
12816        if (array.get(i) instanceof JsonObject) 
12817          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12818      }
12819    };
12820    if (json.has("adjudication")) {
12821      JsonArray array = json.getAsJsonArray("adjudication");
12822      for (int i = 0; i < array.size(); i++) {
12823        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12824      }
12825    };
12826  }
12827
12828  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12829    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
12830    parseExplanationOfBenefitTotalComponentProperties(json, owner, res);
12831    return res;
12832  }
12833
12834  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
12835    parseBackboneElementProperties(json, res);
12836    if (json.has("category"))
12837      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12838    if (json.has("amount"))
12839      res.setAmount(parseMoney(getJObject(json, "amount")));
12840  }
12841
12842  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12843    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
12844    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
12845    return res;
12846  }
12847
12848  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
12849    parseBackboneElementProperties(json, res);
12850    if (json.has("type"))
12851      res.setType(parseCodeableConcept(getJObject(json, "type")));
12852    if (json.has("adjustment"))
12853      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
12854    if (json.has("adjustmentReason"))
12855      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
12856    if (json.has("date"))
12857      res.setDateElement(parseDate(json.get("date").getAsString()));
12858    if (json.has("_date"))
12859      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12860    if (json.has("amount"))
12861      res.setAmount(parseMoney(getJObject(json, "amount")));
12862    if (json.has("identifier"))
12863      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
12864  }
12865
12866  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12867    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
12868    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
12869    return res;
12870  }
12871
12872  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
12873    parseBackboneElementProperties(json, res);
12874    if (json.has("number"))
12875      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
12876    if (json.has("_number"))
12877      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
12878    if (json.has("type"))
12879      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
12880    if (json.has("_type"))
12881      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
12882    if (json.has("text"))
12883      res.setTextElement(parseString(json.get("text").getAsString()));
12884    if (json.has("_text"))
12885      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
12886    if (json.has("language"))
12887      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
12888  }
12889
12890  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12891    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
12892    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
12893    return res;
12894  }
12895
12896  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
12897    parseBackboneElementProperties(json, res);
12898    if (json.has("category"))
12899      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12900    if (json.has("excluded"))
12901      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
12902    if (json.has("_excluded"))
12903      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
12904    if (json.has("name"))
12905      res.setNameElement(parseString(json.get("name").getAsString()));
12906    if (json.has("_name"))
12907      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12908    if (json.has("description"))
12909      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12910    if (json.has("_description"))
12911      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12912    if (json.has("network"))
12913      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
12914    if (json.has("unit"))
12915      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
12916    if (json.has("term"))
12917      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
12918    if (json.has("financial")) {
12919      JsonArray array = json.getAsJsonArray("financial");
12920      for (int i = 0; i < array.size(); i++) {
12921        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
12922      }
12923    };
12924  }
12925
12926  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12927    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
12928    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
12929    return res;
12930  }
12931
12932  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
12933    parseBackboneElementProperties(json, res);
12934    if (json.has("type"))
12935      res.setType(parseCodeableConcept(getJObject(json, "type")));
12936    Type allowed = parseType("allowed", json);
12937    if (allowed != null)
12938      res.setAllowed(allowed);
12939    Type used = parseType("used", json);
12940    if (used != null)
12941      res.setUsed(used);
12942  }
12943
12944  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
12945    FamilyMemberHistory res = new FamilyMemberHistory();
12946    parseFamilyMemberHistoryProperties(json, res);
12947    return res;
12948  }
12949
12950  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
12951    parseDomainResourceProperties(json, res);
12952    if (json.has("identifier")) {
12953      JsonArray array = json.getAsJsonArray("identifier");
12954      for (int i = 0; i < array.size(); i++) {
12955        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12956      }
12957    };
12958    if (json.has("instantiatesCanonical")) {
12959      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
12960      for (int i = 0; i < array.size(); i++) {
12961        if (array.get(i).isJsonNull()) {
12962          res.getInstantiatesCanonical().add(new CanonicalType());
12963        } else {
12964          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
12965        }
12966      }
12967    };
12968    if (json.has("_instantiatesCanonical")) {
12969      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
12970      for (int i = 0; i < array.size(); i++) {
12971        if (i == res.getInstantiatesCanonical().size())
12972          res.getInstantiatesCanonical().add(parseCanonical(null));
12973        if (array.get(i) instanceof JsonObject) 
12974          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
12975      }
12976    };
12977    if (json.has("instantiatesUri")) {
12978      JsonArray array = json.getAsJsonArray("instantiatesUri");
12979      for (int i = 0; i < array.size(); i++) {
12980        if (array.get(i).isJsonNull()) {
12981          res.getInstantiatesUri().add(new UriType());
12982        } else {
12983          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
12984        }
12985      }
12986    };
12987    if (json.has("_instantiatesUri")) {
12988      JsonArray array = json.getAsJsonArray("_instantiatesUri");
12989      for (int i = 0; i < array.size(); i++) {
12990        if (i == res.getInstantiatesUri().size())
12991          res.getInstantiatesUri().add(parseUri(null));
12992        if (array.get(i) instanceof JsonObject) 
12993          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
12994      }
12995    };
12996    if (json.has("status"))
12997      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
12998    if (json.has("_status"))
12999      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13000    if (json.has("dataAbsentReason"))
13001      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
13002    if (json.has("patient"))
13003      res.setPatient(parseReference(getJObject(json, "patient")));
13004    if (json.has("date"))
13005      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13006    if (json.has("_date"))
13007      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13008    if (json.has("name"))
13009      res.setNameElement(parseString(json.get("name").getAsString()));
13010    if (json.has("_name"))
13011      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13012    if (json.has("relationship"))
13013      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
13014    if (json.has("sex"))
13015      res.setSex(parseCodeableConcept(getJObject(json, "sex")));
13016    Type born = parseType("born", json);
13017    if (born != null)
13018      res.setBorn(born);
13019    Type age = parseType("age", json);
13020    if (age != null)
13021      res.setAge(age);
13022    if (json.has("estimatedAge"))
13023      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
13024    if (json.has("_estimatedAge"))
13025      parseElementProperties(getJObject(json, "_estimatedAge"), res.getEstimatedAgeElement());
13026    Type deceased = parseType("deceased", json);
13027    if (deceased != null)
13028      res.setDeceased(deceased);
13029    if (json.has("reasonCode")) {
13030      JsonArray array = json.getAsJsonArray("reasonCode");
13031      for (int i = 0; i < array.size(); i++) {
13032        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13033      }
13034    };
13035    if (json.has("reasonReference")) {
13036      JsonArray array = json.getAsJsonArray("reasonReference");
13037      for (int i = 0; i < array.size(); i++) {
13038        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13039      }
13040    };
13041    if (json.has("note")) {
13042      JsonArray array = json.getAsJsonArray("note");
13043      for (int i = 0; i < array.size(); i++) {
13044        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13045      }
13046    };
13047    if (json.has("condition")) {
13048      JsonArray array = json.getAsJsonArray("condition");
13049      for (int i = 0; i < array.size(); i++) {
13050        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
13051      }
13052    };
13053  }
13054
13055  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
13056    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
13057    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
13058    return res;
13059  }
13060
13061  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
13062    parseBackboneElementProperties(json, res);
13063    if (json.has("code"))
13064      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13065    if (json.has("outcome"))
13066      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
13067    if (json.has("contributedToDeath"))
13068      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
13069    if (json.has("_contributedToDeath"))
13070      parseElementProperties(getJObject(json, "_contributedToDeath"), res.getContributedToDeathElement());
13071    Type onset = parseType("onset", json);
13072    if (onset != null)
13073      res.setOnset(onset);
13074    if (json.has("note")) {
13075      JsonArray array = json.getAsJsonArray("note");
13076      for (int i = 0; i < array.size(); i++) {
13077        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13078      }
13079    };
13080  }
13081
13082  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
13083    Flag res = new Flag();
13084    parseFlagProperties(json, res);
13085    return res;
13086  }
13087
13088  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
13089    parseDomainResourceProperties(json, res);
13090    if (json.has("identifier")) {
13091      JsonArray array = json.getAsJsonArray("identifier");
13092      for (int i = 0; i < array.size(); i++) {
13093        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13094      }
13095    };
13096    if (json.has("status"))
13097      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
13098    if (json.has("_status"))
13099      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13100    if (json.has("category")) {
13101      JsonArray array = json.getAsJsonArray("category");
13102      for (int i = 0; i < array.size(); i++) {
13103        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13104      }
13105    };
13106    if (json.has("code"))
13107      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13108    if (json.has("subject"))
13109      res.setSubject(parseReference(getJObject(json, "subject")));
13110    if (json.has("period"))
13111      res.setPeriod(parsePeriod(getJObject(json, "period")));
13112    if (json.has("encounter"))
13113      res.setEncounter(parseReference(getJObject(json, "encounter")));
13114    if (json.has("author"))
13115      res.setAuthor(parseReference(getJObject(json, "author")));
13116  }
13117
13118  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
13119    Goal res = new Goal();
13120    parseGoalProperties(json, res);
13121    return res;
13122  }
13123
13124  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
13125    parseDomainResourceProperties(json, res);
13126    if (json.has("identifier")) {
13127      JsonArray array = json.getAsJsonArray("identifier");
13128      for (int i = 0; i < array.size(); i++) {
13129        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13130      }
13131    };
13132    if (json.has("lifecycleStatus"))
13133      res.setLifecycleStatusElement(parseEnumeration(json.get("lifecycleStatus").getAsString(), Goal.GoalLifecycleStatus.NULL, new Goal.GoalLifecycleStatusEnumFactory()));
13134    if (json.has("_lifecycleStatus"))
13135      parseElementProperties(getJObject(json, "_lifecycleStatus"), res.getLifecycleStatusElement());
13136    if (json.has("achievementStatus"))
13137      res.setAchievementStatus(parseCodeableConcept(getJObject(json, "achievementStatus")));
13138    if (json.has("category")) {
13139      JsonArray array = json.getAsJsonArray("category");
13140      for (int i = 0; i < array.size(); i++) {
13141        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13142      }
13143    };
13144    if (json.has("priority"))
13145      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
13146    if (json.has("description"))
13147      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
13148    if (json.has("subject"))
13149      res.setSubject(parseReference(getJObject(json, "subject")));
13150    Type start = parseType("start", json);
13151    if (start != null)
13152      res.setStart(start);
13153    if (json.has("target")) {
13154      JsonArray array = json.getAsJsonArray("target");
13155      for (int i = 0; i < array.size(); i++) {
13156        res.getTarget().add(parseGoalGoalTargetComponent(array.get(i).getAsJsonObject(), res));
13157      }
13158    };
13159    if (json.has("statusDate"))
13160      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
13161    if (json.has("_statusDate"))
13162      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
13163    if (json.has("statusReason"))
13164      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
13165    if (json.has("_statusReason"))
13166      parseElementProperties(getJObject(json, "_statusReason"), res.getStatusReasonElement());
13167    if (json.has("expressedBy"))
13168      res.setExpressedBy(parseReference(getJObject(json, "expressedBy")));
13169    if (json.has("addresses")) {
13170      JsonArray array = json.getAsJsonArray("addresses");
13171      for (int i = 0; i < array.size(); i++) {
13172        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
13173      }
13174    };
13175    if (json.has("note")) {
13176      JsonArray array = json.getAsJsonArray("note");
13177      for (int i = 0; i < array.size(); i++) {
13178        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13179      }
13180    };
13181    if (json.has("outcomeCode")) {
13182      JsonArray array = json.getAsJsonArray("outcomeCode");
13183      for (int i = 0; i < array.size(); i++) {
13184        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13185      }
13186    };
13187    if (json.has("outcomeReference")) {
13188      JsonArray array = json.getAsJsonArray("outcomeReference");
13189      for (int i = 0; i < array.size(); i++) {
13190        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
13191      }
13192    };
13193  }
13194
13195  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
13196    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
13197    parseGoalGoalTargetComponentProperties(json, owner, res);
13198    return res;
13199  }
13200
13201  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
13202    parseBackboneElementProperties(json, res);
13203    if (json.has("measure"))
13204      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
13205    Type detail = parseType("detail", json);
13206    if (detail != null)
13207      res.setDetail(detail);
13208    Type due = parseType("due", json);
13209    if (due != null)
13210      res.setDue(due);
13211  }
13212
13213  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
13214    GraphDefinition res = new GraphDefinition();
13215    parseGraphDefinitionProperties(json, res);
13216    return res;
13217  }
13218
13219  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
13220    parseDomainResourceProperties(json, res);
13221    if (json.has("url"))
13222      res.setUrlElement(parseUri(json.get("url").getAsString()));
13223    if (json.has("_url"))
13224      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
13225    if (json.has("version"))
13226      res.setVersionElement(parseString(json.get("version").getAsString()));
13227    if (json.has("_version"))
13228      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
13229    if (json.has("name"))
13230      res.setNameElement(parseString(json.get("name").getAsString()));
13231    if (json.has("_name"))
13232      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13233    if (json.has("status"))
13234      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13235    if (json.has("_status"))
13236      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13237    if (json.has("experimental"))
13238      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13239    if (json.has("_experimental"))
13240      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
13241    if (json.has("date"))
13242      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13243    if (json.has("_date"))
13244      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13245    if (json.has("publisher"))
13246      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13247    if (json.has("_publisher"))
13248      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
13249    if (json.has("contact")) {
13250      JsonArray array = json.getAsJsonArray("contact");
13251      for (int i = 0; i < array.size(); i++) {
13252        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
13253      }
13254    };
13255    if (json.has("description"))
13256      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13257    if (json.has("_description"))
13258      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13259    if (json.has("useContext")) {
13260      JsonArray array = json.getAsJsonArray("useContext");
13261      for (int i = 0; i < array.size(); i++) {
13262        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
13263      }
13264    };
13265    if (json.has("jurisdiction")) {
13266      JsonArray array = json.getAsJsonArray("jurisdiction");
13267      for (int i = 0; i < array.size(); i++) {
13268        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13269      }
13270    };
13271    if (json.has("purpose"))
13272      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
13273    if (json.has("_purpose"))
13274      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
13275    if (json.has("start"))
13276      res.setStartElement(parseCode(json.get("start").getAsString()));
13277    if (json.has("_start"))
13278      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
13279    if (json.has("profile"))
13280      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
13281    if (json.has("_profile"))
13282      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
13283    if (json.has("link")) {
13284      JsonArray array = json.getAsJsonArray("link");
13285      for (int i = 0; i < array.size(); i++) {
13286        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
13287      }
13288    };
13289  }
13290
13291  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
13292    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
13293    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
13294    return res;
13295  }
13296
13297  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
13298    parseBackboneElementProperties(json, res);
13299    if (json.has("path"))
13300      res.setPathElement(parseString(json.get("path").getAsString()));
13301    if (json.has("_path"))
13302      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
13303    if (json.has("sliceName"))
13304      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
13305    if (json.has("_sliceName"))
13306      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
13307    if (json.has("min"))
13308      res.setMinElement(parseInteger(json.get("min").getAsLong()));
13309    if (json.has("_min"))
13310      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
13311    if (json.has("max"))
13312      res.setMaxElement(parseString(json.get("max").getAsString()));
13313    if (json.has("_max"))
13314      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
13315    if (json.has("description"))
13316      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13317    if (json.has("_description"))
13318      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13319    if (json.has("target")) {
13320      JsonArray array = json.getAsJsonArray("target");
13321      for (int i = 0; i < array.size(); i++) {
13322        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
13323      }
13324    };
13325  }
13326
13327  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
13328    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
13329    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
13330    return res;
13331  }
13332
13333  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
13334    parseBackboneElementProperties(json, res);
13335    if (json.has("type"))
13336      res.setTypeElement(parseCode(json.get("type").getAsString()));
13337    if (json.has("_type"))
13338      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
13339    if (json.has("params"))
13340      res.setParamsElement(parseString(json.get("params").getAsString()));
13341    if (json.has("_params"))
13342      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
13343    if (json.has("profile"))
13344      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
13345    if (json.has("_profile"))
13346      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
13347    if (json.has("compartment")) {
13348      JsonArray array = json.getAsJsonArray("compartment");
13349      for (int i = 0; i < array.size(); i++) {
13350        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
13351      }
13352    };
13353    if (json.has("link")) {
13354      JsonArray array = json.getAsJsonArray("link");
13355      for (int i = 0; i < array.size(); i++) {
13356        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
13357      }
13358    };
13359  }
13360
13361  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
13362    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
13363    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
13364    return res;
13365  }
13366
13367  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
13368    parseBackboneElementProperties(json, res);
13369    if (json.has("use"))
13370      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL, new GraphDefinition.GraphCompartmentUseEnumFactory()));
13371    if (json.has("_use"))
13372      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
13373    if (json.has("code"))
13374      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
13375    if (json.has("_code"))
13376      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
13377    if (json.has("rule"))
13378      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
13379    if (json.has("_rule"))
13380      parseElementProperties(getJObject(json, "_rule"), res.getRuleElement());
13381    if (json.has("expression"))
13382      res.setExpressionElement(parseString(json.get("expression").getAsString()));
13383    if (json.has("_expression"))
13384      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
13385    if (json.has("description"))
13386      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13387    if (json.has("_description"))
13388      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13389  }
13390
13391  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
13392    Group res = new Group();
13393    parseGroupProperties(json, res);
13394    return res;
13395  }
13396
13397  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
13398    parseDomainResourceProperties(json, res);
13399    if (json.has("identifier")) {
13400      JsonArray array = json.getAsJsonArray("identifier");
13401      for (int i = 0; i < array.size(); i++) {
13402        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13403      }
13404    };
13405    if (json.has("active"))
13406      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13407    if (json.has("_active"))
13408      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
13409    if (json.has("type"))
13410      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
13411    if (json.has("_type"))
13412      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
13413    if (json.has("actual"))
13414      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
13415    if (json.has("_actual"))
13416      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
13417    if (json.has("code"))
13418      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13419    if (json.has("name"))
13420      res.setNameElement(parseString(json.get("name").getAsString()));
13421    if (json.has("_name"))
13422      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13423    if (json.has("quantity"))
13424      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
13425    if (json.has("_quantity"))
13426      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
13427    if (json.has("managingEntity"))
13428      res.setManagingEntity(parseReference(getJObject(json, "managingEntity")));
13429    if (json.has("characteristic")) {
13430      JsonArray array = json.getAsJsonArray("characteristic");
13431      for (int i = 0; i < array.size(); i++) {
13432        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
13433      }
13434    };
13435    if (json.has("member")) {
13436      JsonArray array = json.getAsJsonArray("member");
13437      for (int i = 0; i < array.size(); i++) {
13438        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
13439      }
13440    };
13441  }
13442
13443  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
13444    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
13445    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
13446    return res;
13447  }
13448
13449  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
13450    parseBackboneElementProperties(json, res);
13451    if (json.has("code"))
13452      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13453    Type value = parseType("value", json);
13454    if (value != null)
13455      res.setValue(value);
13456    if (json.has("exclude"))
13457      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
13458    if (json.has("_exclude"))
13459      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
13460    if (json.has("period"))
13461      res.setPeriod(parsePeriod(getJObject(json, "period")));
13462  }
13463
13464  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
13465    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
13466    parseGroupGroupMemberComponentProperties(json, owner, res);
13467    return res;
13468  }
13469
13470  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
13471    parseBackboneElementProperties(json, res);
13472    if (json.has("entity"))
13473      res.setEntity(parseReference(getJObject(json, "entity")));
13474    if (json.has("period"))
13475      res.setPeriod(parsePeriod(getJObject(json, "period")));
13476    if (json.has("inactive"))
13477      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
13478    if (json.has("_inactive"))
13479      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
13480  }
13481
13482  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
13483    GuidanceResponse res = new GuidanceResponse();
13484    parseGuidanceResponseProperties(json, res);
13485    return res;
13486  }
13487
13488  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
13489    parseDomainResourceProperties(json, res);
13490    if (json.has("requestIdentifier"))
13491      res.setRequestIdentifier(parseIdentifier(getJObject(json, "requestIdentifier")));
13492    if (json.has("identifier")) {
13493      JsonArray array = json.getAsJsonArray("identifier");
13494      for (int i = 0; i < array.size(); i++) {
13495        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13496      }
13497    };
13498    Type module = parseType("module", json);
13499    if (module != null)
13500      res.setModule(module);
13501    if (json.has("status"))
13502      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
13503    if (json.has("_status"))
13504      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13505    if (json.has("subject"))
13506      res.setSubject(parseReference(getJObject(json, "subject")));
13507    if (json.has("encounter"))
13508      res.setEncounter(parseReference(getJObject(json, "encounter")));
13509    if (json.has("occurrenceDateTime"))
13510      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
13511    if (json.has("_occurrenceDateTime"))
13512      parseElementProperties(getJObject(json, "_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
13513    if (json.has("performer"))
13514      res.setPerformer(parseReference(getJObject(json, "performer")));
13515    if (json.has("reasonCode")) {
13516      JsonArray array = json.getAsJsonArray("reasonCode");
13517      for (int i = 0; i < array.size(); i++) {
13518        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13519      }
13520    };
13521    if (json.has("reasonReference")) {
13522      JsonArray array = json.getAsJsonArray("reasonReference");
13523      for (int i = 0; i < array.size(); i++) {
13524        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13525      }
13526    };
13527    if (json.has("note")) {
13528      JsonArray array = json.getAsJsonArray("note");
13529      for (int i = 0; i < array.size(); i++) {
13530        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13531      }
13532    };
13533    if (json.has("evaluationMessage")) {
13534      JsonArray array = json.getAsJsonArray("evaluationMessage");
13535      for (int i = 0; i < array.size(); i++) {
13536        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
13537      }
13538    };
13539    if (json.has("outputParameters"))
13540      res.setOutputParameters(parseReference(getJObject(json, "outputParameters")));
13541    if (json.has("result"))
13542      res.setResult(parseReference(getJObject(json, "result")));
13543    if (json.has("dataRequirement")) {
13544      JsonArray array = json.getAsJsonArray("dataRequirement");
13545      for (int i = 0; i < array.size(); i++) {
13546        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
13547      }
13548    };
13549  }
13550
13551  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
13552    HealthcareService res = new HealthcareService();
13553    parseHealthcareServiceProperties(json, res);
13554    return res;
13555  }
13556
13557  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
13558    parseDomainResourceProperties(json, res);
13559    if (json.has("identifier")) {
13560      JsonArray array = json.getAsJsonArray("identifier");
13561      for (int i = 0; i < array.size(); i++) {
13562        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13563      }
13564    };
13565    if (json.has("active"))
13566      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13567    if (json.has("_active"))
13568      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
13569    if (json.has("providedBy"))
13570      res.setProvidedBy(parseReference(getJObject(json, "providedBy")));
13571    if (json.has("category")) {
13572      JsonArray array = json.getAsJsonArray("category");
13573      for (int i = 0; i < array.size(); i++) {
13574        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13575      }
13576    };
13577    if (json.has("type")) {
13578      JsonArray array = json.getAsJsonArray("type");
13579      for (int i = 0; i < array.size(); i++) {
13580        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13581      }
13582    };
13583    if (json.has("specialty")) {
13584      JsonArray array = json.getAsJsonArray("specialty");
13585      for (int i = 0; i < array.size(); i++) {
13586        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13587      }
13588    };
13589    if (json.has("location")) {
13590      JsonArray array = json.getAsJsonArray("location");
13591      for (int i = 0; i < array.size(); i++) {
13592        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
13593      }
13594    };
13595    if (json.has("name"))
13596      res.setNameElement(parseString(json.get("name").getAsString()));
13597    if (json.has("_name"))
13598      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13599    if (json.has("comment"))
13600      res.setCommentElement(parseString(json.get("comment").getAsString()));
13601    if (json.has("_comment"))
13602      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
13603    if (json.has("extraDetails"))
13604      res.setExtraDetailsElement(parseMarkdown(json.get("extraDetails").getAsString()));
13605    if (json.has("_extraDetails"))
13606      parseElementProperties(getJObject(json, "_extraDetails"), res.getExtraDetailsElement());
13607    if (json.has("photo"))
13608      res.setPhoto(parseAttachment(getJObject(json, "photo")));
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("coverageArea")) {
13616      JsonArray array = json.getAsJsonArray("coverageArea");
13617      for (int i = 0; i < array.size(); i++) {
13618        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
13619      }
13620    };
13621    if (json.has("serviceProvisionCode")) {
13622      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
13623      for (int i = 0; i < array.size(); i++) {
13624        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13625      }
13626    };
13627    if (json.has("eligibility")) {
13628      JsonArray array = json.getAsJsonArray("eligibility");
13629      for (int i = 0; i < array.size(); i++) {
13630        res.getEligibility().add(parseHealthcareServiceHealthcareServiceEligibilityComponent(array.get(i).getAsJsonObject(), res));
13631      }
13632    };
13633    if (json.has("program")) {
13634      JsonArray array = json.getAsJsonArray("program");
13635      for (int i = 0; i < array.size(); i++) {
13636        res.getProgram().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13637      }
13638    };
13639    if (json.has("characteristic")) {
13640      JsonArray array = json.getAsJsonArray("characteristic");
13641      for (int i = 0; i < array.size(); i++) {
13642        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13643      }
13644    };
13645    if (json.has("communication")) {
13646      JsonArray array = json.getAsJsonArray("communication");
13647      for (int i = 0; i < array.size(); i++) {
13648        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13649      }
13650    };
13651    if (json.has("referralMethod")) {
13652      JsonArray array = json.getAsJsonArray("referralMethod");
13653      for (int i = 0; i < array.size(); i++) {
13654        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13655      }
13656    };
13657    if (json.has("appointmentRequired"))
13658      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
13659    if (json.has("_appointmentRequired"))
13660      parseElementProperties(getJObject(json, "_appointmentRequired"), res.getAppointmentRequiredElement());
13661    if (json.has("availableTime")) {
13662      JsonArray array = json.getAsJsonArray("availableTime");
13663      for (int i = 0; i < array.size(); i++) {
13664        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
13665      }
13666    };
13667    if (json.has("notAvailable")) {
13668      JsonArray array = json.getAsJsonArray("notAvailable");
13669      for (int i = 0; i < array.size(); i++) {
13670        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
13671      }
13672    };
13673    if (json.has("availabilityExceptions"))
13674      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
13675    if (json.has("_availabilityExceptions"))
13676      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
13677    if (json.has("endpoint")) {
13678      JsonArray array = json.getAsJsonArray("endpoint");
13679      for (int i = 0; i < array.size(); i++) {
13680        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13681      }
13682    };
13683  }
13684
13685  protected HealthcareService.HealthcareServiceEligibilityComponent parseHealthcareServiceHealthcareServiceEligibilityComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13686    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
13687    parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(json, owner, res);
13688    return res;
13689  }
13690
13691  protected void parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceEligibilityComponent res) throws IOException, FHIRFormatError {
13692    parseBackboneElementProperties(json, res);
13693    if (json.has("code"))
13694      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13695    if (json.has("comment"))
13696      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
13697    if (json.has("_comment"))
13698      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
13699  }
13700
13701  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13702    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
13703    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
13704    return res;
13705  }
13706
13707  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
13708    parseBackboneElementProperties(json, res);
13709    if (json.has("daysOfWeek")) {
13710      JsonArray array = json.getAsJsonArray("daysOfWeek");
13711      for (int i = 0; i < array.size(); i++) {
13712        if (array.get(i).isJsonNull()) {
13713          res.getDaysOfWeek().add(new Enumeration<HealthcareService.DaysOfWeek>());
13714        } else {
13715          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
13716        }
13717      }
13718    };
13719    if (json.has("_daysOfWeek")) {
13720      JsonArray array = json.getAsJsonArray("_daysOfWeek");
13721      for (int i = 0; i < array.size(); i++) {
13722        if (i == res.getDaysOfWeek().size())
13723          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
13724        if (array.get(i) instanceof JsonObject) 
13725          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
13726      }
13727    };
13728    if (json.has("allDay"))
13729      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
13730    if (json.has("_allDay"))
13731      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
13732    if (json.has("availableStartTime"))
13733      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
13734    if (json.has("_availableStartTime"))
13735      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
13736    if (json.has("availableEndTime"))
13737      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
13738    if (json.has("_availableEndTime"))
13739      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
13740  }
13741
13742  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13743    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
13744    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
13745    return res;
13746  }
13747
13748  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
13749    parseBackboneElementProperties(json, res);
13750    if (json.has("description"))
13751      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13752    if (json.has("_description"))
13753      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13754    if (json.has("during"))
13755      res.setDuring(parsePeriod(getJObject(json, "during")));
13756  }
13757
13758  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
13759    ImagingStudy res = new ImagingStudy();
13760    parseImagingStudyProperties(json, res);
13761    return res;
13762  }
13763
13764  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
13765    parseDomainResourceProperties(json, res);
13766    if (json.has("identifier")) {
13767      JsonArray array = json.getAsJsonArray("identifier");
13768      for (int i = 0; i < array.size(); i++) {
13769        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13770      }
13771    };
13772    if (json.has("status"))
13773      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL, new ImagingStudy.ImagingStudyStatusEnumFactory()));
13774    if (json.has("_status"))
13775      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13776    if (json.has("modality")) {
13777      JsonArray array = json.getAsJsonArray("modality");
13778      for (int i = 0; i < array.size(); i++) {
13779        res.getModality().add(parseCoding(array.get(i).getAsJsonObject()));
13780      }
13781    };
13782    if (json.has("subject"))
13783      res.setSubject(parseReference(getJObject(json, "subject")));
13784    if (json.has("encounter"))
13785      res.setEncounter(parseReference(getJObject(json, "encounter")));
13786    if (json.has("started"))
13787      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
13788    if (json.has("_started"))
13789      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
13790    if (json.has("basedOn")) {
13791      JsonArray array = json.getAsJsonArray("basedOn");
13792      for (int i = 0; i < array.size(); i++) {
13793        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13794      }
13795    };
13796    if (json.has("referrer"))
13797      res.setReferrer(parseReference(getJObject(json, "referrer")));
13798    if (json.has("interpreter")) {
13799      JsonArray array = json.getAsJsonArray("interpreter");
13800      for (int i = 0; i < array.size(); i++) {
13801        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
13802      }
13803    };
13804    if (json.has("endpoint")) {
13805      JsonArray array = json.getAsJsonArray("endpoint");
13806      for (int i = 0; i < array.size(); i++) {
13807        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13808      }
13809    };
13810    if (json.has("numberOfSeries"))
13811      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
13812    if (json.has("_numberOfSeries"))
13813      parseElementProperties(getJObject(json, "_numberOfSeries"), res.getNumberOfSeriesElement());
13814    if (json.has("numberOfInstances"))
13815      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
13816    if (json.has("_numberOfInstances"))
13817      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
13818    if (json.has("procedureReference"))
13819      res.setProcedureReference(parseReference(getJObject(json, "procedureReference")));
13820    if (json.has("procedureCode")) {
13821      JsonArray array = json.getAsJsonArray("procedureCode");
13822      for (int i = 0; i < array.size(); i++) {
13823        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13824      }
13825    };
13826    if (json.has("location"))
13827      res.setLocation(parseReference(getJObject(json, "location")));
13828    if (json.has("reasonCode")) {
13829      JsonArray array = json.getAsJsonArray("reasonCode");
13830      for (int i = 0; i < array.size(); i++) {
13831        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13832      }
13833    };
13834    if (json.has("reasonReference")) {
13835      JsonArray array = json.getAsJsonArray("reasonReference");
13836      for (int i = 0; i < array.size(); i++) {
13837        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13838      }
13839    };
13840    if (json.has("note")) {
13841      JsonArray array = json.getAsJsonArray("note");
13842      for (int i = 0; i < array.size(); i++) {
13843        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13844      }
13845    };
13846    if (json.has("description"))
13847      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13848    if (json.has("_description"))
13849      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13850    if (json.has("series")) {
13851      JsonArray array = json.getAsJsonArray("series");
13852      for (int i = 0; i < array.size(); i++) {
13853        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
13854      }
13855    };
13856  }
13857
13858  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13859    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
13860    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
13861    return res;
13862  }
13863
13864  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
13865    parseBackboneElementProperties(json, res);
13866    if (json.has("uid"))
13867      res.setUidElement(parseId(json.get("uid").getAsString()));
13868    if (json.has("_uid"))
13869      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
13870    if (json.has("number"))
13871      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
13872    if (json.has("_number"))
13873      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
13874    if (json.has("modality"))
13875      res.setModality(parseCoding(getJObject(json, "modality")));
13876    if (json.has("description"))
13877      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13878    if (json.has("_description"))
13879      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13880    if (json.has("numberOfInstances"))
13881      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
13882    if (json.has("_numberOfInstances"))
13883      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
13884    if (json.has("endpoint")) {
13885      JsonArray array = json.getAsJsonArray("endpoint");
13886      for (int i = 0; i < array.size(); i++) {
13887        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13888      }
13889    };
13890    if (json.has("bodySite"))
13891      res.setBodySite(parseCoding(getJObject(json, "bodySite")));
13892    if (json.has("laterality"))
13893      res.setLaterality(parseCoding(getJObject(json, "laterality")));
13894    if (json.has("specimen")) {
13895      JsonArray array = json.getAsJsonArray("specimen");
13896      for (int i = 0; i < array.size(); i++) {
13897        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
13898      }
13899    };
13900    if (json.has("started"))
13901      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
13902    if (json.has("_started"))
13903      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
13904    if (json.has("performer")) {
13905      JsonArray array = json.getAsJsonArray("performer");
13906      for (int i = 0; i < array.size(); i++) {
13907        res.getPerformer().add(parseImagingStudyImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject(), owner));
13908      }
13909    };
13910    if (json.has("instance")) {
13911      JsonArray array = json.getAsJsonArray("instance");
13912      for (int i = 0; i < array.size(); i++) {
13913        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
13914      }
13915    };
13916  }
13917
13918  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudyImagingStudySeriesPerformerComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13919    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
13920    parseImagingStudyImagingStudySeriesPerformerComponentProperties(json, owner, res);
13921    return res;
13922  }
13923
13924  protected void parseImagingStudyImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
13925    parseBackboneElementProperties(json, res);
13926    if (json.has("function"))
13927      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
13928    if (json.has("actor"))
13929      res.setActor(parseReference(getJObject(json, "actor")));
13930  }
13931
13932  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13933    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
13934    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
13935    return res;
13936  }
13937
13938  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
13939    parseBackboneElementProperties(json, res);
13940    if (json.has("uid"))
13941      res.setUidElement(parseId(json.get("uid").getAsString()));
13942    if (json.has("_uid"))
13943      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
13944    if (json.has("sopClass"))
13945      res.setSopClass(parseCoding(getJObject(json, "sopClass")));
13946    if (json.has("number"))
13947      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
13948    if (json.has("_number"))
13949      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
13950    if (json.has("title"))
13951      res.setTitleElement(parseString(json.get("title").getAsString()));
13952    if (json.has("_title"))
13953      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
13954  }
13955
13956  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
13957    Immunization res = new Immunization();
13958    parseImmunizationProperties(json, res);
13959    return res;
13960  }
13961
13962  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
13963    parseDomainResourceProperties(json, res);
13964    if (json.has("identifier")) {
13965      JsonArray array = json.getAsJsonArray("identifier");
13966      for (int i = 0; i < array.size(); i++) {
13967        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13968      }
13969    };
13970    if (json.has("status"))
13971      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
13972    if (json.has("_status"))
13973      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13974    if (json.has("statusReason"))
13975      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
13976    if (json.has("vaccineCode"))
13977      res.setVaccineCode(parseCodeableConcept(getJObject(json, "vaccineCode")));
13978    if (json.has("patient"))
13979      res.setPatient(parseReference(getJObject(json, "patient")));
13980    if (json.has("encounter"))
13981      res.setEncounter(parseReference(getJObject(json, "encounter")));
13982    Type occurrence = parseType("occurrence", json);
13983    if (occurrence != null)
13984      res.setOccurrence(occurrence);
13985    if (json.has("recorded"))
13986      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
13987    if (json.has("_recorded"))
13988      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
13989    if (json.has("primarySource"))
13990      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
13991    if (json.has("_primarySource"))
13992      parseElementProperties(getJObject(json, "_primarySource"), res.getPrimarySourceElement());
13993    if (json.has("reportOrigin"))
13994      res.setReportOrigin(parseCodeableConcept(getJObject(json, "reportOrigin")));
13995    if (json.has("location"))
13996      res.setLocation(parseReference(getJObject(json, "location")));
13997    if (json.has("manufacturer"))
13998      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
13999    if (json.has("lotNumber"))
14000      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
14001    if (json.has("_lotNumber"))
14002      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
14003    if (json.has("expirationDate"))
14004      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
14005    if (json.has("_expirationDate"))
14006      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
14007    if (json.has("site"))
14008      res.setSite(parseCodeableConcept(getJObject(json, "site")));
14009    if (json.has("route"))
14010      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
14011    if (json.has("doseQuantity"))
14012      res.setDoseQuantity(parseQuantity(getJObject(json, "doseQuantity")));
14013    if (json.has("performer")) {
14014      JsonArray array = json.getAsJsonArray("performer");
14015      for (int i = 0; i < array.size(); i++) {
14016        res.getPerformer().add(parseImmunizationImmunizationPerformerComponent(array.get(i).getAsJsonObject(), res));
14017      }
14018    };
14019    if (json.has("note")) {
14020      JsonArray array = json.getAsJsonArray("note");
14021      for (int i = 0; i < array.size(); i++) {
14022        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14023      }
14024    };
14025    if (json.has("reasonCode")) {
14026      JsonArray array = json.getAsJsonArray("reasonCode");
14027      for (int i = 0; i < array.size(); i++) {
14028        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14029      }
14030    };
14031    if (json.has("reasonReference")) {
14032      JsonArray array = json.getAsJsonArray("reasonReference");
14033      for (int i = 0; i < array.size(); i++) {
14034        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14035      }
14036    };
14037    if (json.has("isSubpotent"))
14038      res.setIsSubpotentElement(parseBoolean(json.get("isSubpotent").getAsBoolean()));
14039    if (json.has("_isSubpotent"))
14040      parseElementProperties(getJObject(json, "_isSubpotent"), res.getIsSubpotentElement());
14041    if (json.has("subpotentReason")) {
14042      JsonArray array = json.getAsJsonArray("subpotentReason");
14043      for (int i = 0; i < array.size(); i++) {
14044        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14045      }
14046    };
14047    if (json.has("education")) {
14048      JsonArray array = json.getAsJsonArray("education");
14049      for (int i = 0; i < array.size(); i++) {
14050        res.getEducation().add(parseImmunizationImmunizationEducationComponent(array.get(i).getAsJsonObject(), res));
14051      }
14052    };
14053    if (json.has("programEligibility")) {
14054      JsonArray array = json.getAsJsonArray("programEligibility");
14055      for (int i = 0; i < array.size(); i++) {
14056        res.getProgramEligibility().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14057      }
14058    };
14059    if (json.has("fundingSource"))
14060      res.setFundingSource(parseCodeableConcept(getJObject(json, "fundingSource")));
14061    if (json.has("reaction")) {
14062      JsonArray array = json.getAsJsonArray("reaction");
14063      for (int i = 0; i < array.size(); i++) {
14064        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
14065      }
14066    };
14067    if (json.has("protocolApplied")) {
14068      JsonArray array = json.getAsJsonArray("protocolApplied");
14069      for (int i = 0; i < array.size(); i++) {
14070        res.getProtocolApplied().add(parseImmunizationImmunizationProtocolAppliedComponent(array.get(i).getAsJsonObject(), res));
14071      }
14072    };
14073  }
14074
14075  protected Immunization.ImmunizationPerformerComponent parseImmunizationImmunizationPerformerComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
14076    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
14077    parseImmunizationImmunizationPerformerComponentProperties(json, owner, res);
14078    return res;
14079  }
14080
14081  protected void parseImmunizationImmunizationPerformerComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
14082    parseBackboneElementProperties(json, res);
14083    if (json.has("function"))
14084      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
14085    if (json.has("actor"))
14086      res.setActor(parseReference(getJObject(json, "actor")));
14087  }
14088
14089  protected Immunization.ImmunizationEducationComponent parseImmunizationImmunizationEducationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
14090    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
14091    parseImmunizationImmunizationEducationComponentProperties(json, owner, res);
14092    return res;
14093  }
14094
14095  protected void parseImmunizationImmunizationEducationComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationEducationComponent res) throws IOException, FHIRFormatError {
14096    parseBackboneElementProperties(json, res);
14097    if (json.has("documentType"))
14098      res.setDocumentTypeElement(parseString(json.get("documentType").getAsString()));
14099    if (json.has("_documentType"))
14100      parseElementProperties(getJObject(json, "_documentType"), res.getDocumentTypeElement());
14101    if (json.has("reference"))
14102      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
14103    if (json.has("_reference"))
14104      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
14105    if (json.has("publicationDate"))
14106      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
14107    if (json.has("_publicationDate"))
14108      parseElementProperties(getJObject(json, "_publicationDate"), res.getPublicationDateElement());
14109    if (json.has("presentationDate"))
14110      res.setPresentationDateElement(parseDateTime(json.get("presentationDate").getAsString()));
14111    if (json.has("_presentationDate"))
14112      parseElementProperties(getJObject(json, "_presentationDate"), res.getPresentationDateElement());
14113  }
14114
14115  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
14116    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
14117    parseImmunizationImmunizationReactionComponentProperties(json, owner, res);
14118    return res;
14119  }
14120
14121  protected void parseImmunizationImmunizationReactionComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
14122    parseBackboneElementProperties(json, res);
14123    if (json.has("date"))
14124      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14125    if (json.has("_date"))
14126      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14127    if (json.has("detail"))
14128      res.setDetail(parseReference(getJObject(json, "detail")));
14129    if (json.has("reported"))
14130      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
14131    if (json.has("_reported"))
14132      parseElementProperties(getJObject(json, "_reported"), res.getReportedElement());
14133  }
14134
14135  protected Immunization.ImmunizationProtocolAppliedComponent parseImmunizationImmunizationProtocolAppliedComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
14136    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
14137    parseImmunizationImmunizationProtocolAppliedComponentProperties(json, owner, res);
14138    return res;
14139  }
14140
14141  protected void parseImmunizationImmunizationProtocolAppliedComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationProtocolAppliedComponent res) throws IOException, FHIRFormatError {
14142    parseBackboneElementProperties(json, res);
14143    if (json.has("series"))
14144      res.setSeriesElement(parseString(json.get("series").getAsString()));
14145    if (json.has("_series"))
14146      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
14147    if (json.has("authority"))
14148      res.setAuthority(parseReference(getJObject(json, "authority")));
14149    if (json.has("targetDisease")) {
14150      JsonArray array = json.getAsJsonArray("targetDisease");
14151      for (int i = 0; i < array.size(); i++) {
14152        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14153      }
14154    };
14155    Type doseNumber = parseType("doseNumber", json);
14156    if (doseNumber != null)
14157      res.setDoseNumber(doseNumber);
14158    Type seriesDoses = parseType("seriesDoses", json);
14159    if (seriesDoses != null)
14160      res.setSeriesDoses(seriesDoses);
14161  }
14162
14163  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
14164    ImmunizationEvaluation res = new ImmunizationEvaluation();
14165    parseImmunizationEvaluationProperties(json, res);
14166    return res;
14167  }
14168
14169  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res) throws IOException, FHIRFormatError {
14170    parseDomainResourceProperties(json, res);
14171    if (json.has("identifier")) {
14172      JsonArray array = json.getAsJsonArray("identifier");
14173      for (int i = 0; i < array.size(); i++) {
14174        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14175      }
14176    };
14177    if (json.has("status"))
14178      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory()));
14179    if (json.has("_status"))
14180      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14181    if (json.has("patient"))
14182      res.setPatient(parseReference(getJObject(json, "patient")));
14183    if (json.has("date"))
14184      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14185    if (json.has("_date"))
14186      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14187    if (json.has("authority"))
14188      res.setAuthority(parseReference(getJObject(json, "authority")));
14189    if (json.has("targetDisease"))
14190      res.setTargetDisease(parseCodeableConcept(getJObject(json, "targetDisease")));
14191    if (json.has("immunizationEvent"))
14192      res.setImmunizationEvent(parseReference(getJObject(json, "immunizationEvent")));
14193    if (json.has("doseStatus"))
14194      res.setDoseStatus(parseCodeableConcept(getJObject(json, "doseStatus")));
14195    if (json.has("doseStatusReason")) {
14196      JsonArray array = json.getAsJsonArray("doseStatusReason");
14197      for (int i = 0; i < array.size(); i++) {
14198        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14199      }
14200    };
14201    if (json.has("description"))
14202      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14203    if (json.has("_description"))
14204      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14205    if (json.has("series"))
14206      res.setSeriesElement(parseString(json.get("series").getAsString()));
14207    if (json.has("_series"))
14208      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
14209    Type doseNumber = parseType("doseNumber", json);
14210    if (doseNumber != null)
14211      res.setDoseNumber(doseNumber);
14212    Type seriesDoses = parseType("seriesDoses", json);
14213    if (seriesDoses != null)
14214      res.setSeriesDoses(seriesDoses);
14215  }
14216
14217  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
14218    ImmunizationRecommendation res = new ImmunizationRecommendation();
14219    parseImmunizationRecommendationProperties(json, res);
14220    return res;
14221  }
14222
14223  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
14224    parseDomainResourceProperties(json, res);
14225    if (json.has("identifier")) {
14226      JsonArray array = json.getAsJsonArray("identifier");
14227      for (int i = 0; i < array.size(); i++) {
14228        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14229      }
14230    };
14231    if (json.has("patient"))
14232      res.setPatient(parseReference(getJObject(json, "patient")));
14233    if (json.has("date"))
14234      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14235    if (json.has("_date"))
14236      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14237    if (json.has("authority"))
14238      res.setAuthority(parseReference(getJObject(json, "authority")));
14239    if (json.has("recommendation")) {
14240      JsonArray array = json.getAsJsonArray("recommendation");
14241      for (int i = 0; i < array.size(); i++) {
14242        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
14243      }
14244    };
14245  }
14246
14247  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
14248    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
14249    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
14250    return res;
14251  }
14252
14253  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
14254    parseBackboneElementProperties(json, res);
14255    if (json.has("vaccineCode")) {
14256      JsonArray array = json.getAsJsonArray("vaccineCode");
14257      for (int i = 0; i < array.size(); i++) {
14258        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14259      }
14260    };
14261    if (json.has("targetDisease"))
14262      res.setTargetDisease(parseCodeableConcept(getJObject(json, "targetDisease")));
14263    if (json.has("contraindicatedVaccineCode")) {
14264      JsonArray array = json.getAsJsonArray("contraindicatedVaccineCode");
14265      for (int i = 0; i < array.size(); i++) {
14266        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14267      }
14268    };
14269    if (json.has("forecastStatus"))
14270      res.setForecastStatus(parseCodeableConcept(getJObject(json, "forecastStatus")));
14271    if (json.has("forecastReason")) {
14272      JsonArray array = json.getAsJsonArray("forecastReason");
14273      for (int i = 0; i < array.size(); i++) {
14274        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14275      }
14276    };
14277    if (json.has("dateCriterion")) {
14278      JsonArray array = json.getAsJsonArray("dateCriterion");
14279      for (int i = 0; i < array.size(); i++) {
14280        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
14281      }
14282    };
14283    if (json.has("description"))
14284      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14285    if (json.has("_description"))
14286      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14287    if (json.has("series"))
14288      res.setSeriesElement(parseString(json.get("series").getAsString()));
14289    if (json.has("_series"))
14290      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
14291    Type doseNumber = parseType("doseNumber", json);
14292    if (doseNumber != null)
14293      res.setDoseNumber(doseNumber);
14294    Type seriesDoses = parseType("seriesDoses", json);
14295    if (seriesDoses != null)
14296      res.setSeriesDoses(seriesDoses);
14297    if (json.has("supportingImmunization")) {
14298      JsonArray array = json.getAsJsonArray("supportingImmunization");
14299      for (int i = 0; i < array.size(); i++) {
14300        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
14301      }
14302    };
14303    if (json.has("supportingPatientInformation")) {
14304      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
14305      for (int i = 0; i < array.size(); i++) {
14306        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
14307      }
14308    };
14309  }
14310
14311  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
14312    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
14313    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner, res);
14314    return res;
14315  }
14316
14317  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
14318    parseBackboneElementProperties(json, res);
14319    if (json.has("code"))
14320      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14321    if (json.has("value"))
14322      res.setValueElement(parseDateTime(json.get("value").getAsString()));
14323    if (json.has("_value"))
14324      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
14325  }
14326
14327  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
14328    ImplementationGuide res = new ImplementationGuide();
14329    parseImplementationGuideProperties(json, res);
14330    return res;
14331  }
14332
14333  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
14334    parseDomainResourceProperties(json, res);
14335    if (json.has("url"))
14336      res.setUrlElement(parseUri(json.get("url").getAsString()));
14337    if (json.has("_url"))
14338      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
14339    if (json.has("version"))
14340      res.setVersionElement(parseString(json.get("version").getAsString()));
14341    if (json.has("_version"))
14342      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
14343    if (json.has("name"))
14344      res.setNameElement(parseString(json.get("name").getAsString()));
14345    if (json.has("_name"))
14346      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14347    if (json.has("title"))
14348      res.setTitleElement(parseString(json.get("title").getAsString()));
14349    if (json.has("_title"))
14350      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14351    if (json.has("status"))
14352      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14353    if (json.has("_status"))
14354      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14355    if (json.has("experimental"))
14356      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14357    if (json.has("_experimental"))
14358      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
14359    if (json.has("date"))
14360      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14361    if (json.has("_date"))
14362      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14363    if (json.has("publisher"))
14364      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14365    if (json.has("_publisher"))
14366      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
14367    if (json.has("contact")) {
14368      JsonArray array = json.getAsJsonArray("contact");
14369      for (int i = 0; i < array.size(); i++) {
14370        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14371      }
14372    };
14373    if (json.has("description"))
14374      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14375    if (json.has("_description"))
14376      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14377    if (json.has("useContext")) {
14378      JsonArray array = json.getAsJsonArray("useContext");
14379      for (int i = 0; i < array.size(); i++) {
14380        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14381      }
14382    };
14383    if (json.has("jurisdiction")) {
14384      JsonArray array = json.getAsJsonArray("jurisdiction");
14385      for (int i = 0; i < array.size(); i++) {
14386        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14387      }
14388    };
14389    if (json.has("copyright"))
14390      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14391    if (json.has("_copyright"))
14392      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
14393    if (json.has("packageId"))
14394      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
14395    if (json.has("_packageId"))
14396      parseElementProperties(getJObject(json, "_packageId"), res.getPackageIdElement());
14397    if (json.has("license"))
14398      res.setLicenseElement(parseEnumeration(json.get("license").getAsString(), ImplementationGuide.SPDXLicense.NULL, new ImplementationGuide.SPDXLicenseEnumFactory()));
14399    if (json.has("_license"))
14400      parseElementProperties(getJObject(json, "_license"), res.getLicenseElement());
14401    if (json.has("fhirVersion")) {
14402      JsonArray array = json.getAsJsonArray("fhirVersion");
14403      for (int i = 0; i < array.size(); i++) {
14404        if (array.get(i).isJsonNull()) {
14405          res.getFhirVersion().add(new Enumeration<Enumerations.FHIRVersion>());
14406        } else {
14407          res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14408        }
14409      }
14410    };
14411    if (json.has("_fhirVersion")) {
14412      JsonArray array = json.getAsJsonArray("_fhirVersion");
14413      for (int i = 0; i < array.size(); i++) {
14414        if (i == res.getFhirVersion().size())
14415          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14416        if (array.get(i) instanceof JsonObject) 
14417          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
14418      }
14419    };
14420    if (json.has("dependsOn")) {
14421      JsonArray array = json.getAsJsonArray("dependsOn");
14422      for (int i = 0; i < array.size(); i++) {
14423        res.getDependsOn().add(parseImplementationGuideImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject(), res));
14424      }
14425    };
14426    if (json.has("global")) {
14427      JsonArray array = json.getAsJsonArray("global");
14428      for (int i = 0; i < array.size(); i++) {
14429        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
14430      }
14431    };
14432    if (json.has("definition"))
14433      res.setDefinition(parseImplementationGuideImplementationGuideDefinitionComponent(getJObject(json, "definition"), res));
14434    if (json.has("manifest"))
14435      res.setManifest(parseImplementationGuideImplementationGuideManifestComponent(getJObject(json, "manifest"), res));
14436  }
14437
14438  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideImplementationGuideDependsOnComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14439    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
14440    parseImplementationGuideImplementationGuideDependsOnComponentProperties(json, owner, res);
14441    return res;
14442  }
14443
14444  protected void parseImplementationGuideImplementationGuideDependsOnComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependsOnComponent res) throws IOException, FHIRFormatError {
14445    parseBackboneElementProperties(json, res);
14446    if (json.has("uri"))
14447      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
14448    if (json.has("_uri"))
14449      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
14450    if (json.has("packageId"))
14451      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
14452    if (json.has("_packageId"))
14453      parseElementProperties(getJObject(json, "_packageId"), res.getPackageIdElement());
14454    if (json.has("version"))
14455      res.setVersionElement(parseString(json.get("version").getAsString()));
14456    if (json.has("_version"))
14457      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
14458  }
14459
14460  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14461    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
14462    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
14463    return res;
14464  }
14465
14466  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
14467    parseBackboneElementProperties(json, res);
14468    if (json.has("type"))
14469      res.setTypeElement(parseCode(json.get("type").getAsString()));
14470    if (json.has("_type"))
14471      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14472    if (json.has("profile"))
14473      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
14474    if (json.has("_profile"))
14475      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
14476  }
14477
14478  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideImplementationGuideDefinitionComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14479    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
14480    parseImplementationGuideImplementationGuideDefinitionComponentProperties(json, owner, res);
14481    return res;
14482  }
14483
14484  protected void parseImplementationGuideImplementationGuideDefinitionComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws IOException, FHIRFormatError {
14485    parseBackboneElementProperties(json, res);
14486    if (json.has("grouping")) {
14487      JsonArray array = json.getAsJsonArray("grouping");
14488      for (int i = 0; i < array.size(); i++) {
14489        res.getGrouping().add(parseImplementationGuideImplementationGuideDefinitionGroupingComponent(array.get(i).getAsJsonObject(), owner));
14490      }
14491    };
14492    if (json.has("resource")) {
14493      JsonArray array = json.getAsJsonArray("resource");
14494      for (int i = 0; i < array.size(); i++) {
14495        res.getResource().add(parseImplementationGuideImplementationGuideDefinitionResourceComponent(array.get(i).getAsJsonObject(), owner));
14496      }
14497    };
14498    if (json.has("page"))
14499      res.setPage(parseImplementationGuideImplementationGuideDefinitionPageComponent(getJObject(json, "page"), owner));
14500    if (json.has("parameter")) {
14501      JsonArray array = json.getAsJsonArray("parameter");
14502      for (int i = 0; i < array.size(); i++) {
14503        res.getParameter().add(parseImplementationGuideImplementationGuideDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
14504      }
14505    };
14506    if (json.has("template")) {
14507      JsonArray array = json.getAsJsonArray("template");
14508      for (int i = 0; i < array.size(); i++) {
14509        res.getTemplate().add(parseImplementationGuideImplementationGuideDefinitionTemplateComponent(array.get(i).getAsJsonObject(), owner));
14510      }
14511    };
14512  }
14513
14514  protected ImplementationGuide.ImplementationGuideDefinitionGroupingComponent parseImplementationGuideImplementationGuideDefinitionGroupingComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14515    ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res = new ImplementationGuide.ImplementationGuideDefinitionGroupingComponent();
14516    parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(json, owner, res);
14517    return res;
14518  }
14519
14520  protected void parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res) throws IOException, FHIRFormatError {
14521    parseBackboneElementProperties(json, res);
14522    if (json.has("name"))
14523      res.setNameElement(parseString(json.get("name").getAsString()));
14524    if (json.has("_name"))
14525      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14526    if (json.has("description"))
14527      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14528    if (json.has("_description"))
14529      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14530  }
14531
14532  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideImplementationGuideDefinitionResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14533    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
14534    parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(json, owner, res);
14535    return res;
14536  }
14537
14538  protected void parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res) throws IOException, FHIRFormatError {
14539    parseBackboneElementProperties(json, res);
14540    if (json.has("reference"))
14541      res.setReference(parseReference(getJObject(json, "reference")));
14542    if (json.has("fhirVersion")) {
14543      JsonArray array = json.getAsJsonArray("fhirVersion");
14544      for (int i = 0; i < array.size(); i++) {
14545        if (array.get(i).isJsonNull()) {
14546          res.getFhirVersion().add(new Enumeration<Enumerations.FHIRVersion>());
14547        } else {
14548          res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14549        }
14550      }
14551    };
14552    if (json.has("_fhirVersion")) {
14553      JsonArray array = json.getAsJsonArray("_fhirVersion");
14554      for (int i = 0; i < array.size(); i++) {
14555        if (i == res.getFhirVersion().size())
14556          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14557        if (array.get(i) instanceof JsonObject) 
14558          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
14559      }
14560    };
14561    if (json.has("name"))
14562      res.setNameElement(parseString(json.get("name").getAsString()));
14563    if (json.has("_name"))
14564      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14565    if (json.has("description"))
14566      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14567    if (json.has("_description"))
14568      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14569    Type example = parseType("example", json);
14570    if (example != null)
14571      res.setExample(example);
14572    if (json.has("groupingId"))
14573      res.setGroupingIdElement(parseId(json.get("groupingId").getAsString()));
14574    if (json.has("_groupingId"))
14575      parseElementProperties(getJObject(json, "_groupingId"), res.getGroupingIdElement());
14576  }
14577
14578  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideImplementationGuideDefinitionPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14579    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
14580    parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(json, owner, res);
14581    return res;
14582  }
14583
14584  protected void parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPageComponent res) throws IOException, FHIRFormatError {
14585    parseBackboneElementProperties(json, res);
14586    Type name = parseType("name", json);
14587    if (name != null)
14588      res.setName(name);
14589    if (json.has("title"))
14590      res.setTitleElement(parseString(json.get("title").getAsString()));
14591    if (json.has("_title"))
14592      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14593    if (json.has("generation"))
14594      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(), ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
14595    if (json.has("_generation"))
14596      parseElementProperties(getJObject(json, "_generation"), res.getGenerationElement());
14597    if (json.has("page")) {
14598      JsonArray array = json.getAsJsonArray("page");
14599      for (int i = 0; i < array.size(); i++) {
14600        res.getPage().add(parseImplementationGuideImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject(), owner));
14601      }
14602    };
14603  }
14604
14605  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideImplementationGuideDefinitionParameterComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14606    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
14607    parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(json, owner, res);
14608    return res;
14609  }
14610
14611  protected void parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
14612    parseBackboneElementProperties(json, res);
14613    if (json.has("code"))
14614      res.setCodeElement(parseString(json.get("code").getAsString()));
14615    if (json.has("_code"))
14616      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
14617    if (json.has("value"))
14618      res.setValueElement(parseString(json.get("value").getAsString()));
14619    if (json.has("_value"))
14620      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
14621  }
14622
14623  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideImplementationGuideDefinitionTemplateComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14624    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
14625    parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(json, owner, res);
14626    return res;
14627  }
14628
14629  protected void parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res) throws IOException, FHIRFormatError {
14630    parseBackboneElementProperties(json, res);
14631    if (json.has("code"))
14632      res.setCodeElement(parseCode(json.get("code").getAsString()));
14633    if (json.has("_code"))
14634      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
14635    if (json.has("source"))
14636      res.setSourceElement(parseString(json.get("source").getAsString()));
14637    if (json.has("_source"))
14638      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
14639    if (json.has("scope"))
14640      res.setScopeElement(parseString(json.get("scope").getAsString()));
14641    if (json.has("_scope"))
14642      parseElementProperties(getJObject(json, "_scope"), res.getScopeElement());
14643  }
14644
14645  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideImplementationGuideManifestComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14646    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
14647    parseImplementationGuideImplementationGuideManifestComponentProperties(json, owner, res);
14648    return res;
14649  }
14650
14651  protected void parseImplementationGuideImplementationGuideManifestComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestComponent res) throws IOException, FHIRFormatError {
14652    parseBackboneElementProperties(json, res);
14653    if (json.has("rendering"))
14654      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
14655    if (json.has("_rendering"))
14656      parseElementProperties(getJObject(json, "_rendering"), res.getRenderingElement());
14657    if (json.has("resource")) {
14658      JsonArray array = json.getAsJsonArray("resource");
14659      for (int i = 0; i < array.size(); i++) {
14660        res.getResource().add(parseImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject(), owner));
14661      }
14662    };
14663    if (json.has("page")) {
14664      JsonArray array = json.getAsJsonArray("page");
14665      for (int i = 0; i < array.size(); i++) {
14666        res.getPage().add(parseImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject(), owner));
14667      }
14668    };
14669    if (json.has("image")) {
14670      JsonArray array = json.getAsJsonArray("image");
14671      for (int i = 0; i < array.size(); i++) {
14672        if (array.get(i).isJsonNull()) {
14673          res.getImage().add(new StringType());
14674        } else {
14675          res.getImage().add(parseString(array.get(i).getAsString()));
14676        }
14677      }
14678    };
14679    if (json.has("_image")) {
14680      JsonArray array = json.getAsJsonArray("_image");
14681      for (int i = 0; i < array.size(); i++) {
14682        if (i == res.getImage().size())
14683          res.getImage().add(parseString(null));
14684        if (array.get(i) instanceof JsonObject) 
14685          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
14686      }
14687    };
14688    if (json.has("other")) {
14689      JsonArray array = json.getAsJsonArray("other");
14690      for (int i = 0; i < array.size(); i++) {
14691        if (array.get(i).isJsonNull()) {
14692          res.getOther().add(new StringType());
14693        } else {
14694          res.getOther().add(parseString(array.get(i).getAsString()));
14695        }
14696      }
14697    };
14698    if (json.has("_other")) {
14699      JsonArray array = json.getAsJsonArray("_other");
14700      for (int i = 0; i < array.size(); i++) {
14701        if (i == res.getOther().size())
14702          res.getOther().add(parseString(null));
14703        if (array.get(i) instanceof JsonObject) 
14704          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
14705      }
14706    };
14707  }
14708
14709  protected ImplementationGuide.ManifestResourceComponent parseImplementationGuideManifestResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14710    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
14711    parseImplementationGuideManifestResourceComponentProperties(json, owner, res);
14712    return res;
14713  }
14714
14715  protected void parseImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestResourceComponent res) throws IOException, FHIRFormatError {
14716    parseBackboneElementProperties(json, res);
14717    if (json.has("reference"))
14718      res.setReference(parseReference(getJObject(json, "reference")));
14719    Type example = parseType("example", json);
14720    if (example != null)
14721      res.setExample(example);
14722    if (json.has("relativePath"))
14723      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
14724    if (json.has("_relativePath"))
14725      parseElementProperties(getJObject(json, "_relativePath"), res.getRelativePathElement());
14726  }
14727
14728  protected ImplementationGuide.ManifestPageComponent parseImplementationGuideManifestPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14729    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
14730    parseImplementationGuideManifestPageComponentProperties(json, owner, res);
14731    return res;
14732  }
14733
14734  protected void parseImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestPageComponent res) throws IOException, FHIRFormatError {
14735    parseBackboneElementProperties(json, res);
14736    if (json.has("name"))
14737      res.setNameElement(parseString(json.get("name").getAsString()));
14738    if (json.has("_name"))
14739      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14740    if (json.has("title"))
14741      res.setTitleElement(parseString(json.get("title").getAsString()));
14742    if (json.has("_title"))
14743      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14744    if (json.has("anchor")) {
14745      JsonArray array = json.getAsJsonArray("anchor");
14746      for (int i = 0; i < array.size(); i++) {
14747        if (array.get(i).isJsonNull()) {
14748          res.getAnchor().add(new StringType());
14749        } else {
14750          res.getAnchor().add(parseString(array.get(i).getAsString()));
14751        }
14752      }
14753    };
14754    if (json.has("_anchor")) {
14755      JsonArray array = json.getAsJsonArray("_anchor");
14756      for (int i = 0; i < array.size(); i++) {
14757        if (i == res.getAnchor().size())
14758          res.getAnchor().add(parseString(null));
14759        if (array.get(i) instanceof JsonObject) 
14760          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
14761      }
14762    };
14763  }
14764
14765  protected InsurancePlan parseInsurancePlan(JsonObject json) throws IOException, FHIRFormatError {
14766    InsurancePlan res = new InsurancePlan();
14767    parseInsurancePlanProperties(json, res);
14768    return res;
14769  }
14770
14771  protected void parseInsurancePlanProperties(JsonObject json, InsurancePlan res) throws IOException, FHIRFormatError {
14772    parseDomainResourceProperties(json, res);
14773    if (json.has("identifier")) {
14774      JsonArray array = json.getAsJsonArray("identifier");
14775      for (int i = 0; i < array.size(); i++) {
14776        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14777      }
14778    };
14779    if (json.has("status"))
14780      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14781    if (json.has("_status"))
14782      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14783    if (json.has("type")) {
14784      JsonArray array = json.getAsJsonArray("type");
14785      for (int i = 0; i < array.size(); i++) {
14786        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14787      }
14788    };
14789    if (json.has("name"))
14790      res.setNameElement(parseString(json.get("name").getAsString()));
14791    if (json.has("_name"))
14792      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14793    if (json.has("alias")) {
14794      JsonArray array = json.getAsJsonArray("alias");
14795      for (int i = 0; i < array.size(); i++) {
14796        if (array.get(i).isJsonNull()) {
14797          res.getAlias().add(new StringType());
14798        } else {
14799          res.getAlias().add(parseString(array.get(i).getAsString()));
14800        }
14801      }
14802    };
14803    if (json.has("_alias")) {
14804      JsonArray array = json.getAsJsonArray("_alias");
14805      for (int i = 0; i < array.size(); i++) {
14806        if (i == res.getAlias().size())
14807          res.getAlias().add(parseString(null));
14808        if (array.get(i) instanceof JsonObject) 
14809          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
14810      }
14811    };
14812    if (json.has("period"))
14813      res.setPeriod(parsePeriod(getJObject(json, "period")));
14814    if (json.has("ownedBy"))
14815      res.setOwnedBy(parseReference(getJObject(json, "ownedBy")));
14816    if (json.has("administeredBy"))
14817      res.setAdministeredBy(parseReference(getJObject(json, "administeredBy")));
14818    if (json.has("coverageArea")) {
14819      JsonArray array = json.getAsJsonArray("coverageArea");
14820      for (int i = 0; i < array.size(); i++) {
14821        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14822      }
14823    };
14824    if (json.has("contact")) {
14825      JsonArray array = json.getAsJsonArray("contact");
14826      for (int i = 0; i < array.size(); i++) {
14827        res.getContact().add(parseInsurancePlanInsurancePlanContactComponent(array.get(i).getAsJsonObject(), res));
14828      }
14829    };
14830    if (json.has("endpoint")) {
14831      JsonArray array = json.getAsJsonArray("endpoint");
14832      for (int i = 0; i < array.size(); i++) {
14833        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14834      }
14835    };
14836    if (json.has("network")) {
14837      JsonArray array = json.getAsJsonArray("network");
14838      for (int i = 0; i < array.size(); i++) {
14839        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14840      }
14841    };
14842    if (json.has("coverage")) {
14843      JsonArray array = json.getAsJsonArray("coverage");
14844      for (int i = 0; i < array.size(); i++) {
14845        res.getCoverage().add(parseInsurancePlanInsurancePlanCoverageComponent(array.get(i).getAsJsonObject(), res));
14846      }
14847    };
14848    if (json.has("plan")) {
14849      JsonArray array = json.getAsJsonArray("plan");
14850      for (int i = 0; i < array.size(); i++) {
14851        res.getPlan().add(parseInsurancePlanInsurancePlanPlanComponent(array.get(i).getAsJsonObject(), res));
14852      }
14853    };
14854  }
14855
14856  protected InsurancePlan.InsurancePlanContactComponent parseInsurancePlanInsurancePlanContactComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14857    InsurancePlan.InsurancePlanContactComponent res = new InsurancePlan.InsurancePlanContactComponent();
14858    parseInsurancePlanInsurancePlanContactComponentProperties(json, owner, res);
14859    return res;
14860  }
14861
14862  protected void parseInsurancePlanInsurancePlanContactComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanContactComponent res) throws IOException, FHIRFormatError {
14863    parseBackboneElementProperties(json, res);
14864    if (json.has("purpose"))
14865      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
14866    if (json.has("name"))
14867      res.setName(parseHumanName(getJObject(json, "name")));
14868    if (json.has("telecom")) {
14869      JsonArray array = json.getAsJsonArray("telecom");
14870      for (int i = 0; i < array.size(); i++) {
14871        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14872      }
14873    };
14874    if (json.has("address"))
14875      res.setAddress(parseAddress(getJObject(json, "address")));
14876  }
14877
14878  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanInsurancePlanCoverageComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14879    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
14880    parseInsurancePlanInsurancePlanCoverageComponentProperties(json, owner, res);
14881    return res;
14882  }
14883
14884  protected void parseInsurancePlanInsurancePlanCoverageComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanCoverageComponent res) throws IOException, FHIRFormatError {
14885    parseBackboneElementProperties(json, res);
14886    if (json.has("type"))
14887      res.setType(parseCodeableConcept(getJObject(json, "type")));
14888    if (json.has("network")) {
14889      JsonArray array = json.getAsJsonArray("network");
14890      for (int i = 0; i < array.size(); i++) {
14891        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14892      }
14893    };
14894    if (json.has("benefit")) {
14895      JsonArray array = json.getAsJsonArray("benefit");
14896      for (int i = 0; i < array.size(); i++) {
14897        res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(array.get(i).getAsJsonObject(), owner));
14898      }
14899    };
14900  }
14901
14902  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14903    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
14904    parseInsurancePlanCoverageBenefitComponentProperties(json, owner, res);
14905    return res;
14906  }
14907
14908  protected void parseInsurancePlanCoverageBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitComponent res) throws IOException, FHIRFormatError {
14909    parseBackboneElementProperties(json, res);
14910    if (json.has("type"))
14911      res.setType(parseCodeableConcept(getJObject(json, "type")));
14912    if (json.has("requirement"))
14913      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
14914    if (json.has("_requirement"))
14915      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
14916    if (json.has("limit")) {
14917      JsonArray array = json.getAsJsonArray("limit");
14918      for (int i = 0; i < array.size(); i++) {
14919        res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject(), owner));
14920      }
14921    };
14922  }
14923
14924  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14925    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
14926    parseInsurancePlanCoverageBenefitLimitComponentProperties(json, owner, res);
14927    return res;
14928  }
14929
14930  protected void parseInsurancePlanCoverageBenefitLimitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
14931    parseBackboneElementProperties(json, res);
14932    if (json.has("value"))
14933      res.setValue(parseQuantity(getJObject(json, "value")));
14934    if (json.has("code"))
14935      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14936  }
14937
14938  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanInsurancePlanPlanComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14939    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
14940    parseInsurancePlanInsurancePlanPlanComponentProperties(json, owner, res);
14941    return res;
14942  }
14943
14944  protected void parseInsurancePlanInsurancePlanPlanComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanComponent res) throws IOException, FHIRFormatError {
14945    parseBackboneElementProperties(json, res);
14946    if (json.has("identifier")) {
14947      JsonArray array = json.getAsJsonArray("identifier");
14948      for (int i = 0; i < array.size(); i++) {
14949        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14950      }
14951    };
14952    if (json.has("type"))
14953      res.setType(parseCodeableConcept(getJObject(json, "type")));
14954    if (json.has("coverageArea")) {
14955      JsonArray array = json.getAsJsonArray("coverageArea");
14956      for (int i = 0; i < array.size(); i++) {
14957        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14958      }
14959    };
14960    if (json.has("network")) {
14961      JsonArray array = json.getAsJsonArray("network");
14962      for (int i = 0; i < array.size(); i++) {
14963        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14964      }
14965    };
14966    if (json.has("generalCost")) {
14967      JsonArray array = json.getAsJsonArray("generalCost");
14968      for (int i = 0; i < array.size(); i++) {
14969        res.getGeneralCost().add(parseInsurancePlanInsurancePlanPlanGeneralCostComponent(array.get(i).getAsJsonObject(), owner));
14970      }
14971    };
14972    if (json.has("specificCost")) {
14973      JsonArray array = json.getAsJsonArray("specificCost");
14974      for (int i = 0; i < array.size(); i++) {
14975        res.getSpecificCost().add(parseInsurancePlanInsurancePlanPlanSpecificCostComponent(array.get(i).getAsJsonObject(), owner));
14976      }
14977    };
14978  }
14979
14980  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanInsurancePlanPlanGeneralCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14981    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
14982    parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(json, owner, res);
14983    return res;
14984  }
14985
14986  protected void parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
14987    parseBackboneElementProperties(json, res);
14988    if (json.has("type"))
14989      res.setType(parseCodeableConcept(getJObject(json, "type")));
14990    if (json.has("groupSize"))
14991      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
14992    if (json.has("_groupSize"))
14993      parseElementProperties(getJObject(json, "_groupSize"), res.getGroupSizeElement());
14994    if (json.has("cost"))
14995      res.setCost(parseMoney(getJObject(json, "cost")));
14996    if (json.has("comment"))
14997      res.setCommentElement(parseString(json.get("comment").getAsString()));
14998    if (json.has("_comment"))
14999      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
15000  }
15001
15002  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanInsurancePlanPlanSpecificCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15003    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
15004    parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(json, owner, res);
15005    return res;
15006  }
15007
15008  protected void parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanSpecificCostComponent res) throws IOException, FHIRFormatError {
15009    parseBackboneElementProperties(json, res);
15010    if (json.has("category"))
15011      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
15012    if (json.has("benefit")) {
15013      JsonArray array = json.getAsJsonArray("benefit");
15014      for (int i = 0; i < array.size(); i++) {
15015        res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(array.get(i).getAsJsonObject(), owner));
15016      }
15017    };
15018  }
15019
15020  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15021    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
15022    parseInsurancePlanPlanBenefitComponentProperties(json, owner, res);
15023    return res;
15024  }
15025
15026  protected void parseInsurancePlanPlanBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitComponent res) throws IOException, FHIRFormatError {
15027    parseBackboneElementProperties(json, res);
15028    if (json.has("type"))
15029      res.setType(parseCodeableConcept(getJObject(json, "type")));
15030    if (json.has("cost")) {
15031      JsonArray array = json.getAsJsonArray("cost");
15032      for (int i = 0; i < array.size(); i++) {
15033        res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(array.get(i).getAsJsonObject(), owner));
15034      }
15035    };
15036  }
15037
15038  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
15039    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
15040    parseInsurancePlanPlanBenefitCostComponentProperties(json, owner, res);
15041    return res;
15042  }
15043
15044  protected void parseInsurancePlanPlanBenefitCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitCostComponent res) throws IOException, FHIRFormatError {
15045    parseBackboneElementProperties(json, res);
15046    if (json.has("type"))
15047      res.setType(parseCodeableConcept(getJObject(json, "type")));
15048    if (json.has("applicability"))
15049      res.setApplicability(parseCodeableConcept(getJObject(json, "applicability")));
15050    if (json.has("qualifiers")) {
15051      JsonArray array = json.getAsJsonArray("qualifiers");
15052      for (int i = 0; i < array.size(); i++) {
15053        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15054      }
15055    };
15056    if (json.has("value"))
15057      res.setValue(parseQuantity(getJObject(json, "value")));
15058  }
15059
15060  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
15061    Invoice res = new Invoice();
15062    parseInvoiceProperties(json, res);
15063    return res;
15064  }
15065
15066  protected void parseInvoiceProperties(JsonObject json, Invoice res) throws IOException, FHIRFormatError {
15067    parseDomainResourceProperties(json, res);
15068    if (json.has("identifier")) {
15069      JsonArray array = json.getAsJsonArray("identifier");
15070      for (int i = 0; i < array.size(); i++) {
15071        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15072      }
15073    };
15074    if (json.has("status"))
15075      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
15076    if (json.has("_status"))
15077      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15078    if (json.has("cancelledReason"))
15079      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
15080    if (json.has("_cancelledReason"))
15081      parseElementProperties(getJObject(json, "_cancelledReason"), res.getCancelledReasonElement());
15082    if (json.has("type"))
15083      res.setType(parseCodeableConcept(getJObject(json, "type")));
15084    if (json.has("subject"))
15085      res.setSubject(parseReference(getJObject(json, "subject")));
15086    if (json.has("recipient"))
15087      res.setRecipient(parseReference(getJObject(json, "recipient")));
15088    if (json.has("date"))
15089      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15090    if (json.has("_date"))
15091      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15092    if (json.has("participant")) {
15093      JsonArray array = json.getAsJsonArray("participant");
15094      for (int i = 0; i < array.size(); i++) {
15095        res.getParticipant().add(parseInvoiceInvoiceParticipantComponent(array.get(i).getAsJsonObject(), res));
15096      }
15097    };
15098    if (json.has("issuer"))
15099      res.setIssuer(parseReference(getJObject(json, "issuer")));
15100    if (json.has("account"))
15101      res.setAccount(parseReference(getJObject(json, "account")));
15102    if (json.has("lineItem")) {
15103      JsonArray array = json.getAsJsonArray("lineItem");
15104      for (int i = 0; i < array.size(); i++) {
15105        res.getLineItem().add(parseInvoiceInvoiceLineItemComponent(array.get(i).getAsJsonObject(), res));
15106      }
15107    };
15108    if (json.has("totalPriceComponent")) {
15109      JsonArray array = json.getAsJsonArray("totalPriceComponent");
15110      for (int i = 0; i < array.size(); i++) {
15111        res.getTotalPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), res));
15112      }
15113    };
15114    if (json.has("totalNet"))
15115      res.setTotalNet(parseMoney(getJObject(json, "totalNet")));
15116    if (json.has("totalGross"))
15117      res.setTotalGross(parseMoney(getJObject(json, "totalGross")));
15118    if (json.has("paymentTerms"))
15119      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
15120    if (json.has("_paymentTerms"))
15121      parseElementProperties(getJObject(json, "_paymentTerms"), res.getPaymentTermsElement());
15122    if (json.has("note")) {
15123      JsonArray array = json.getAsJsonArray("note");
15124      for (int i = 0; i < array.size(); i++) {
15125        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15126      }
15127    };
15128  }
15129
15130  protected Invoice.InvoiceParticipantComponent parseInvoiceInvoiceParticipantComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
15131    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
15132    parseInvoiceInvoiceParticipantComponentProperties(json, owner, res);
15133    return res;
15134  }
15135
15136  protected void parseInvoiceInvoiceParticipantComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
15137    parseBackboneElementProperties(json, res);
15138    if (json.has("role"))
15139      res.setRole(parseCodeableConcept(getJObject(json, "role")));
15140    if (json.has("actor"))
15141      res.setActor(parseReference(getJObject(json, "actor")));
15142  }
15143
15144  protected Invoice.InvoiceLineItemComponent parseInvoiceInvoiceLineItemComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
15145    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
15146    parseInvoiceInvoiceLineItemComponentProperties(json, owner, res);
15147    return res;
15148  }
15149
15150  protected void parseInvoiceInvoiceLineItemComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
15151    parseBackboneElementProperties(json, res);
15152    if (json.has("sequence"))
15153      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
15154    if (json.has("_sequence"))
15155      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
15156    Type chargeItem = parseType("chargeItem", json);
15157    if (chargeItem != null)
15158      res.setChargeItem(chargeItem);
15159    if (json.has("priceComponent")) {
15160      JsonArray array = json.getAsJsonArray("priceComponent");
15161      for (int i = 0; i < array.size(); i++) {
15162        res.getPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
15163      }
15164    };
15165  }
15166
15167  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceInvoiceLineItemPriceComponentComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
15168    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
15169    parseInvoiceInvoiceLineItemPriceComponentComponentProperties(json, owner, res);
15170    return res;
15171  }
15172
15173  protected void parseInvoiceInvoiceLineItemPriceComponentComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemPriceComponentComponent res) throws IOException, FHIRFormatError {
15174    parseBackboneElementProperties(json, res);
15175    if (json.has("type"))
15176      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Invoice.InvoicePriceComponentType.NULL, new Invoice.InvoicePriceComponentTypeEnumFactory()));
15177    if (json.has("_type"))
15178      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
15179    if (json.has("code"))
15180      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15181    if (json.has("factor"))
15182      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
15183    if (json.has("_factor"))
15184      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
15185    if (json.has("amount"))
15186      res.setAmount(parseMoney(getJObject(json, "amount")));
15187  }
15188
15189  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
15190    Library res = new Library();
15191    parseLibraryProperties(json, res);
15192    return res;
15193  }
15194
15195  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
15196    parseDomainResourceProperties(json, res);
15197    if (json.has("url"))
15198      res.setUrlElement(parseUri(json.get("url").getAsString()));
15199    if (json.has("_url"))
15200      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
15201    if (json.has("identifier")) {
15202      JsonArray array = json.getAsJsonArray("identifier");
15203      for (int i = 0; i < array.size(); i++) {
15204        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15205      }
15206    };
15207    if (json.has("version"))
15208      res.setVersionElement(parseString(json.get("version").getAsString()));
15209    if (json.has("_version"))
15210      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
15211    if (json.has("name"))
15212      res.setNameElement(parseString(json.get("name").getAsString()));
15213    if (json.has("_name"))
15214      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15215    if (json.has("title"))
15216      res.setTitleElement(parseString(json.get("title").getAsString()));
15217    if (json.has("_title"))
15218      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15219    if (json.has("subtitle"))
15220      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
15221    if (json.has("_subtitle"))
15222      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
15223    if (json.has("status"))
15224      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15225    if (json.has("_status"))
15226      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15227    if (json.has("experimental"))
15228      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15229    if (json.has("_experimental"))
15230      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
15231    if (json.has("type"))
15232      res.setType(parseCodeableConcept(getJObject(json, "type")));
15233    Type subject = parseType("subject", json);
15234    if (subject != null)
15235      res.setSubject(subject);
15236    if (json.has("date"))
15237      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15238    if (json.has("_date"))
15239      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15240    if (json.has("publisher"))
15241      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15242    if (json.has("_publisher"))
15243      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
15244    if (json.has("contact")) {
15245      JsonArray array = json.getAsJsonArray("contact");
15246      for (int i = 0; i < array.size(); i++) {
15247        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15248      }
15249    };
15250    if (json.has("description"))
15251      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15252    if (json.has("_description"))
15253      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15254    if (json.has("useContext")) {
15255      JsonArray array = json.getAsJsonArray("useContext");
15256      for (int i = 0; i < array.size(); i++) {
15257        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15258      }
15259    };
15260    if (json.has("jurisdiction")) {
15261      JsonArray array = json.getAsJsonArray("jurisdiction");
15262      for (int i = 0; i < array.size(); i++) {
15263        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15264      }
15265    };
15266    if (json.has("purpose"))
15267      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15268    if (json.has("_purpose"))
15269      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
15270    if (json.has("usage"))
15271      res.setUsageElement(parseString(json.get("usage").getAsString()));
15272    if (json.has("_usage"))
15273      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
15274    if (json.has("copyright"))
15275      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15276    if (json.has("_copyright"))
15277      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
15278    if (json.has("approvalDate"))
15279      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
15280    if (json.has("_approvalDate"))
15281      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
15282    if (json.has("lastReviewDate"))
15283      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
15284    if (json.has("_lastReviewDate"))
15285      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
15286    if (json.has("effectivePeriod"))
15287      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
15288    if (json.has("topic")) {
15289      JsonArray array = json.getAsJsonArray("topic");
15290      for (int i = 0; i < array.size(); i++) {
15291        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15292      }
15293    };
15294    if (json.has("author")) {
15295      JsonArray array = json.getAsJsonArray("author");
15296      for (int i = 0; i < array.size(); i++) {
15297        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15298      }
15299    };
15300    if (json.has("editor")) {
15301      JsonArray array = json.getAsJsonArray("editor");
15302      for (int i = 0; i < array.size(); i++) {
15303        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15304      }
15305    };
15306    if (json.has("reviewer")) {
15307      JsonArray array = json.getAsJsonArray("reviewer");
15308      for (int i = 0; i < array.size(); i++) {
15309        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
15310      }
15311    };
15312    if (json.has("endorser")) {
15313      JsonArray array = json.getAsJsonArray("endorser");
15314      for (int i = 0; i < array.size(); i++) {
15315        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
15316      }
15317    };
15318    if (json.has("relatedArtifact")) {
15319      JsonArray array = json.getAsJsonArray("relatedArtifact");
15320      for (int i = 0; i < array.size(); i++) {
15321        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
15322      }
15323    };
15324    if (json.has("parameter")) {
15325      JsonArray array = json.getAsJsonArray("parameter");
15326      for (int i = 0; i < array.size(); i++) {
15327        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
15328      }
15329    };
15330    if (json.has("dataRequirement")) {
15331      JsonArray array = json.getAsJsonArray("dataRequirement");
15332      for (int i = 0; i < array.size(); i++) {
15333        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
15334      }
15335    };
15336    if (json.has("content")) {
15337      JsonArray array = json.getAsJsonArray("content");
15338      for (int i = 0; i < array.size(); i++) {
15339        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
15340      }
15341    };
15342  }
15343
15344  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
15345    Linkage res = new Linkage();
15346    parseLinkageProperties(json, res);
15347    return res;
15348  }
15349
15350  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
15351    parseDomainResourceProperties(json, res);
15352    if (json.has("active"))
15353      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
15354    if (json.has("_active"))
15355      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
15356    if (json.has("author"))
15357      res.setAuthor(parseReference(getJObject(json, "author")));
15358    if (json.has("item")) {
15359      JsonArray array = json.getAsJsonArray("item");
15360      for (int i = 0; i < array.size(); i++) {
15361        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
15362      }
15363    };
15364  }
15365
15366  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
15367    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
15368    parseLinkageLinkageItemComponentProperties(json, owner, res);
15369    return res;
15370  }
15371
15372  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
15373    parseBackboneElementProperties(json, res);
15374    if (json.has("type"))
15375      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
15376    if (json.has("_type"))
15377      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
15378    if (json.has("resource"))
15379      res.setResource(parseReference(getJObject(json, "resource")));
15380  }
15381
15382  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
15383    ListResource res = new ListResource();
15384    parseListResourceProperties(json, res);
15385    return res;
15386  }
15387
15388  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
15389    parseDomainResourceProperties(json, res);
15390    if (json.has("identifier")) {
15391      JsonArray array = json.getAsJsonArray("identifier");
15392      for (int i = 0; i < array.size(); i++) {
15393        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15394      }
15395    };
15396    if (json.has("status"))
15397      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
15398    if (json.has("_status"))
15399      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15400    if (json.has("mode"))
15401      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
15402    if (json.has("_mode"))
15403      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
15404    if (json.has("title"))
15405      res.setTitleElement(parseString(json.get("title").getAsString()));
15406    if (json.has("_title"))
15407      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15408    if (json.has("code"))
15409      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15410    if (json.has("subject"))
15411      res.setSubject(parseReference(getJObject(json, "subject")));
15412    if (json.has("encounter"))
15413      res.setEncounter(parseReference(getJObject(json, "encounter")));
15414    if (json.has("date"))
15415      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15416    if (json.has("_date"))
15417      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15418    if (json.has("source"))
15419      res.setSource(parseReference(getJObject(json, "source")));
15420    if (json.has("orderedBy"))
15421      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
15422    if (json.has("note")) {
15423      JsonArray array = json.getAsJsonArray("note");
15424      for (int i = 0; i < array.size(); i++) {
15425        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15426      }
15427    };
15428    if (json.has("entry")) {
15429      JsonArray array = json.getAsJsonArray("entry");
15430      for (int i = 0; i < array.size(); i++) {
15431        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
15432      }
15433    };
15434    if (json.has("emptyReason"))
15435      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
15436  }
15437
15438  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
15439    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
15440    parseListResourceListEntryComponentProperties(json, owner, res);
15441    return res;
15442  }
15443
15444  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner, ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
15445    parseBackboneElementProperties(json, res);
15446    if (json.has("flag"))
15447      res.setFlag(parseCodeableConcept(getJObject(json, "flag")));
15448    if (json.has("deleted"))
15449      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
15450    if (json.has("_deleted"))
15451      parseElementProperties(getJObject(json, "_deleted"), res.getDeletedElement());
15452    if (json.has("date"))
15453      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15454    if (json.has("_date"))
15455      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15456    if (json.has("item"))
15457      res.setItem(parseReference(getJObject(json, "item")));
15458  }
15459
15460  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
15461    Location res = new Location();
15462    parseLocationProperties(json, res);
15463    return res;
15464  }
15465
15466  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
15467    parseDomainResourceProperties(json, res);
15468    if (json.has("identifier")) {
15469      JsonArray array = json.getAsJsonArray("identifier");
15470      for (int i = 0; i < array.size(); i++) {
15471        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15472      }
15473    };
15474    if (json.has("status"))
15475      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
15476    if (json.has("_status"))
15477      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15478    if (json.has("operationalStatus"))
15479      res.setOperationalStatus(parseCoding(getJObject(json, "operationalStatus")));
15480    if (json.has("name"))
15481      res.setNameElement(parseString(json.get("name").getAsString()));
15482    if (json.has("_name"))
15483      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15484    if (json.has("alias")) {
15485      JsonArray array = json.getAsJsonArray("alias");
15486      for (int i = 0; i < array.size(); i++) {
15487        if (array.get(i).isJsonNull()) {
15488          res.getAlias().add(new StringType());
15489        } else {
15490          res.getAlias().add(parseString(array.get(i).getAsString()));
15491        }
15492      }
15493    };
15494    if (json.has("_alias")) {
15495      JsonArray array = json.getAsJsonArray("_alias");
15496      for (int i = 0; i < array.size(); i++) {
15497        if (i == res.getAlias().size())
15498          res.getAlias().add(parseString(null));
15499        if (array.get(i) instanceof JsonObject) 
15500          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
15501      }
15502    };
15503    if (json.has("description"))
15504      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15505    if (json.has("_description"))
15506      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15507    if (json.has("mode"))
15508      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
15509    if (json.has("_mode"))
15510      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
15511    if (json.has("type")) {
15512      JsonArray array = json.getAsJsonArray("type");
15513      for (int i = 0; i < array.size(); i++) {
15514        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15515      }
15516    };
15517    if (json.has("telecom")) {
15518      JsonArray array = json.getAsJsonArray("telecom");
15519      for (int i = 0; i < array.size(); i++) {
15520        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
15521      }
15522    };
15523    if (json.has("address"))
15524      res.setAddress(parseAddress(getJObject(json, "address")));
15525    if (json.has("physicalType"))
15526      res.setPhysicalType(parseCodeableConcept(getJObject(json, "physicalType")));
15527    if (json.has("position"))
15528      res.setPosition(parseLocationLocationPositionComponent(getJObject(json, "position"), res));
15529    if (json.has("managingOrganization"))
15530      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
15531    if (json.has("partOf"))
15532      res.setPartOf(parseReference(getJObject(json, "partOf")));
15533    if (json.has("hoursOfOperation")) {
15534      JsonArray array = json.getAsJsonArray("hoursOfOperation");
15535      for (int i = 0; i < array.size(); i++) {
15536        res.getHoursOfOperation().add(parseLocationLocationHoursOfOperationComponent(array.get(i).getAsJsonObject(), res));
15537      }
15538    };
15539    if (json.has("availabilityExceptions"))
15540      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
15541    if (json.has("_availabilityExceptions"))
15542      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
15543    if (json.has("endpoint")) {
15544      JsonArray array = json.getAsJsonArray("endpoint");
15545      for (int i = 0; i < array.size(); i++) {
15546        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15547      }
15548    };
15549  }
15550
15551  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
15552    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
15553    parseLocationLocationPositionComponentProperties(json, owner, res);
15554    return res;
15555  }
15556
15557  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
15558    parseBackboneElementProperties(json, res);
15559    if (json.has("longitude"))
15560      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
15561    if (json.has("_longitude"))
15562      parseElementProperties(getJObject(json, "_longitude"), res.getLongitudeElement());
15563    if (json.has("latitude"))
15564      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
15565    if (json.has("_latitude"))
15566      parseElementProperties(getJObject(json, "_latitude"), res.getLatitudeElement());
15567    if (json.has("altitude"))
15568      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
15569    if (json.has("_altitude"))
15570      parseElementProperties(getJObject(json, "_altitude"), res.getAltitudeElement());
15571  }
15572
15573  protected Location.LocationHoursOfOperationComponent parseLocationLocationHoursOfOperationComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
15574    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
15575    parseLocationLocationHoursOfOperationComponentProperties(json, owner, res);
15576    return res;
15577  }
15578
15579  protected void parseLocationLocationHoursOfOperationComponentProperties(JsonObject json, Location owner, Location.LocationHoursOfOperationComponent res) throws IOException, FHIRFormatError {
15580    parseBackboneElementProperties(json, res);
15581    if (json.has("daysOfWeek")) {
15582      JsonArray array = json.getAsJsonArray("daysOfWeek");
15583      for (int i = 0; i < array.size(); i++) {
15584        if (array.get(i).isJsonNull()) {
15585          res.getDaysOfWeek().add(new Enumeration<Location.DaysOfWeek>());
15586        } else {
15587          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
15588        }
15589      }
15590    };
15591    if (json.has("_daysOfWeek")) {
15592      JsonArray array = json.getAsJsonArray("_daysOfWeek");
15593      for (int i = 0; i < array.size(); i++) {
15594        if (i == res.getDaysOfWeek().size())
15595          res.getDaysOfWeek().add(parseEnumeration(null, Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
15596        if (array.get(i) instanceof JsonObject) 
15597          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
15598      }
15599    };
15600    if (json.has("allDay"))
15601      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
15602    if (json.has("_allDay"))
15603      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
15604    if (json.has("openingTime"))
15605      res.setOpeningTimeElement(parseTime(json.get("openingTime").getAsString()));
15606    if (json.has("_openingTime"))
15607      parseElementProperties(getJObject(json, "_openingTime"), res.getOpeningTimeElement());
15608    if (json.has("closingTime"))
15609      res.setClosingTimeElement(parseTime(json.get("closingTime").getAsString()));
15610    if (json.has("_closingTime"))
15611      parseElementProperties(getJObject(json, "_closingTime"), res.getClosingTimeElement());
15612  }
15613
15614  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
15615    Measure res = new Measure();
15616    parseMeasureProperties(json, res);
15617    return res;
15618  }
15619
15620  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
15621    parseDomainResourceProperties(json, res);
15622    if (json.has("url"))
15623      res.setUrlElement(parseUri(json.get("url").getAsString()));
15624    if (json.has("_url"))
15625      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
15626    if (json.has("identifier")) {
15627      JsonArray array = json.getAsJsonArray("identifier");
15628      for (int i = 0; i < array.size(); i++) {
15629        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15630      }
15631    };
15632    if (json.has("version"))
15633      res.setVersionElement(parseString(json.get("version").getAsString()));
15634    if (json.has("_version"))
15635      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
15636    if (json.has("name"))
15637      res.setNameElement(parseString(json.get("name").getAsString()));
15638    if (json.has("_name"))
15639      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15640    if (json.has("title"))
15641      res.setTitleElement(parseString(json.get("title").getAsString()));
15642    if (json.has("_title"))
15643      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15644    if (json.has("subtitle"))
15645      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
15646    if (json.has("_subtitle"))
15647      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
15648    if (json.has("status"))
15649      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15650    if (json.has("_status"))
15651      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15652    if (json.has("experimental"))
15653      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15654    if (json.has("_experimental"))
15655      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
15656    Type subject = parseType("subject", json);
15657    if (subject != null)
15658      res.setSubject(subject);
15659    if (json.has("date"))
15660      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15661    if (json.has("_date"))
15662      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15663    if (json.has("publisher"))
15664      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15665    if (json.has("_publisher"))
15666      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
15667    if (json.has("contact")) {
15668      JsonArray array = json.getAsJsonArray("contact");
15669      for (int i = 0; i < array.size(); i++) {
15670        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15671      }
15672    };
15673    if (json.has("description"))
15674      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15675    if (json.has("_description"))
15676      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15677    if (json.has("useContext")) {
15678      JsonArray array = json.getAsJsonArray("useContext");
15679      for (int i = 0; i < array.size(); i++) {
15680        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15681      }
15682    };
15683    if (json.has("jurisdiction")) {
15684      JsonArray array = json.getAsJsonArray("jurisdiction");
15685      for (int i = 0; i < array.size(); i++) {
15686        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15687      }
15688    };
15689    if (json.has("purpose"))
15690      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15691    if (json.has("_purpose"))
15692      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
15693    if (json.has("usage"))
15694      res.setUsageElement(parseString(json.get("usage").getAsString()));
15695    if (json.has("_usage"))
15696      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
15697    if (json.has("copyright"))
15698      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15699    if (json.has("_copyright"))
15700      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
15701    if (json.has("approvalDate"))
15702      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
15703    if (json.has("_approvalDate"))
15704      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
15705    if (json.has("lastReviewDate"))
15706      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
15707    if (json.has("_lastReviewDate"))
15708      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
15709    if (json.has("effectivePeriod"))
15710      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
15711    if (json.has("topic")) {
15712      JsonArray array = json.getAsJsonArray("topic");
15713      for (int i = 0; i < array.size(); i++) {
15714        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15715      }
15716    };
15717    if (json.has("author")) {
15718      JsonArray array = json.getAsJsonArray("author");
15719      for (int i = 0; i < array.size(); i++) {
15720        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15721      }
15722    };
15723    if (json.has("editor")) {
15724      JsonArray array = json.getAsJsonArray("editor");
15725      for (int i = 0; i < array.size(); i++) {
15726        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15727      }
15728    };
15729    if (json.has("reviewer")) {
15730      JsonArray array = json.getAsJsonArray("reviewer");
15731      for (int i = 0; i < array.size(); i++) {
15732        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
15733      }
15734    };
15735    if (json.has("endorser")) {
15736      JsonArray array = json.getAsJsonArray("endorser");
15737      for (int i = 0; i < array.size(); i++) {
15738        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
15739      }
15740    };
15741    if (json.has("relatedArtifact")) {
15742      JsonArray array = json.getAsJsonArray("relatedArtifact");
15743      for (int i = 0; i < array.size(); i++) {
15744        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
15745      }
15746    };
15747    if (json.has("library")) {
15748      JsonArray array = json.getAsJsonArray("library");
15749      for (int i = 0; i < array.size(); i++) {
15750        if (array.get(i).isJsonNull()) {
15751          res.getLibrary().add(new CanonicalType());
15752        } else {
15753          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
15754        }
15755      }
15756    };
15757    if (json.has("_library")) {
15758      JsonArray array = json.getAsJsonArray("_library");
15759      for (int i = 0; i < array.size(); i++) {
15760        if (i == res.getLibrary().size())
15761          res.getLibrary().add(parseCanonical(null));
15762        if (array.get(i) instanceof JsonObject) 
15763          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
15764      }
15765    };
15766    if (json.has("disclaimer"))
15767      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
15768    if (json.has("_disclaimer"))
15769      parseElementProperties(getJObject(json, "_disclaimer"), res.getDisclaimerElement());
15770    if (json.has("scoring"))
15771      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
15772    if (json.has("compositeScoring"))
15773      res.setCompositeScoring(parseCodeableConcept(getJObject(json, "compositeScoring")));
15774    if (json.has("type")) {
15775      JsonArray array = json.getAsJsonArray("type");
15776      for (int i = 0; i < array.size(); i++) {
15777        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15778      }
15779    };
15780    if (json.has("riskAdjustment"))
15781      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
15782    if (json.has("_riskAdjustment"))
15783      parseElementProperties(getJObject(json, "_riskAdjustment"), res.getRiskAdjustmentElement());
15784    if (json.has("rateAggregation"))
15785      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
15786    if (json.has("_rateAggregation"))
15787      parseElementProperties(getJObject(json, "_rateAggregation"), res.getRateAggregationElement());
15788    if (json.has("rationale"))
15789      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
15790    if (json.has("_rationale"))
15791      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
15792    if (json.has("clinicalRecommendationStatement"))
15793      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
15794    if (json.has("_clinicalRecommendationStatement"))
15795      parseElementProperties(getJObject(json, "_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
15796    if (json.has("improvementNotation"))
15797      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
15798    if (json.has("definition")) {
15799      JsonArray array = json.getAsJsonArray("definition");
15800      for (int i = 0; i < array.size(); i++) {
15801        if (array.get(i).isJsonNull()) {
15802          res.getDefinition().add(new MarkdownType());
15803        } else {
15804          res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
15805        }
15806      }
15807    };
15808    if (json.has("_definition")) {
15809      JsonArray array = json.getAsJsonArray("_definition");
15810      for (int i = 0; i < array.size(); i++) {
15811        if (i == res.getDefinition().size())
15812          res.getDefinition().add(parseMarkdown(null));
15813        if (array.get(i) instanceof JsonObject) 
15814          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
15815      }
15816    };
15817    if (json.has("guidance"))
15818      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
15819    if (json.has("_guidance"))
15820      parseElementProperties(getJObject(json, "_guidance"), res.getGuidanceElement());
15821    if (json.has("group")) {
15822      JsonArray array = json.getAsJsonArray("group");
15823      for (int i = 0; i < array.size(); i++) {
15824        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
15825      }
15826    };
15827    if (json.has("supplementalData")) {
15828      JsonArray array = json.getAsJsonArray("supplementalData");
15829      for (int i = 0; i < array.size(); i++) {
15830        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
15831      }
15832    };
15833  }
15834
15835  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15836    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
15837    parseMeasureMeasureGroupComponentProperties(json, owner, res);
15838    return res;
15839  }
15840
15841  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
15842    parseBackboneElementProperties(json, res);
15843    if (json.has("code"))
15844      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15845    if (json.has("description"))
15846      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15847    if (json.has("_description"))
15848      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15849    if (json.has("population")) {
15850      JsonArray array = json.getAsJsonArray("population");
15851      for (int i = 0; i < array.size(); i++) {
15852        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
15853      }
15854    };
15855    if (json.has("stratifier")) {
15856      JsonArray array = json.getAsJsonArray("stratifier");
15857      for (int i = 0; i < array.size(); i++) {
15858        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
15859      }
15860    };
15861  }
15862
15863  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15864    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
15865    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
15866    return res;
15867  }
15868
15869  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
15870    parseBackboneElementProperties(json, res);
15871    if (json.has("code"))
15872      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15873    if (json.has("description"))
15874      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15875    if (json.has("_description"))
15876      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15877    if (json.has("criteria"))
15878      res.setCriteria(parseExpression(getJObject(json, "criteria")));
15879  }
15880
15881  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15882    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
15883    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
15884    return res;
15885  }
15886
15887  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
15888    parseBackboneElementProperties(json, res);
15889    if (json.has("code"))
15890      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15891    if (json.has("description"))
15892      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15893    if (json.has("_description"))
15894      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15895    if (json.has("criteria"))
15896      res.setCriteria(parseExpression(getJObject(json, "criteria")));
15897    if (json.has("component")) {
15898      JsonArray array = json.getAsJsonArray("component");
15899      for (int i = 0; i < array.size(); i++) {
15900        res.getComponent().add(parseMeasureMeasureGroupStratifierComponentComponent(array.get(i).getAsJsonObject(), owner));
15901      }
15902    };
15903  }
15904
15905  protected Measure.MeasureGroupStratifierComponentComponent parseMeasureMeasureGroupStratifierComponentComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15906    Measure.MeasureGroupStratifierComponentComponent res = new Measure.MeasureGroupStratifierComponentComponent();
15907    parseMeasureMeasureGroupStratifierComponentComponentProperties(json, owner, res);
15908    return res;
15909  }
15910
15911  protected void parseMeasureMeasureGroupStratifierComponentComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponentComponent res) throws IOException, FHIRFormatError {
15912    parseBackboneElementProperties(json, res);
15913    if (json.has("code"))
15914      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15915    if (json.has("description"))
15916      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15917    if (json.has("_description"))
15918      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15919    if (json.has("criteria"))
15920      res.setCriteria(parseExpression(getJObject(json, "criteria")));
15921  }
15922
15923  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15924    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
15925    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
15926    return res;
15927  }
15928
15929  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
15930    parseBackboneElementProperties(json, res);
15931    if (json.has("code"))
15932      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15933    if (json.has("usage")) {
15934      JsonArray array = json.getAsJsonArray("usage");
15935      for (int i = 0; i < array.size(); i++) {
15936        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15937      }
15938    };
15939    if (json.has("description"))
15940      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15941    if (json.has("_description"))
15942      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15943    if (json.has("criteria"))
15944      res.setCriteria(parseExpression(getJObject(json, "criteria")));
15945  }
15946
15947  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
15948    MeasureReport res = new MeasureReport();
15949    parseMeasureReportProperties(json, res);
15950    return res;
15951  }
15952
15953  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
15954    parseDomainResourceProperties(json, res);
15955    if (json.has("identifier")) {
15956      JsonArray array = json.getAsJsonArray("identifier");
15957      for (int i = 0; i < array.size(); i++) {
15958        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15959      }
15960    };
15961    if (json.has("status"))
15962      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
15963    if (json.has("_status"))
15964      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15965    if (json.has("type"))
15966      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
15967    if (json.has("_type"))
15968      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
15969    if (json.has("measure"))
15970      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
15971    if (json.has("_measure"))
15972      parseElementProperties(getJObject(json, "_measure"), res.getMeasureElement());
15973    if (json.has("subject"))
15974      res.setSubject(parseReference(getJObject(json, "subject")));
15975    if (json.has("date"))
15976      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15977    if (json.has("_date"))
15978      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15979    if (json.has("reporter"))
15980      res.setReporter(parseReference(getJObject(json, "reporter")));
15981    if (json.has("period"))
15982      res.setPeriod(parsePeriod(getJObject(json, "period")));
15983    if (json.has("improvementNotation"))
15984      res.setImprovementNotation(parseCodeableConcept(getJObject(json, "improvementNotation")));
15985    if (json.has("group")) {
15986      JsonArray array = json.getAsJsonArray("group");
15987      for (int i = 0; i < array.size(); i++) {
15988        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
15989      }
15990    };
15991    if (json.has("evaluatedResource")) {
15992      JsonArray array = json.getAsJsonArray("evaluatedResource");
15993      for (int i = 0; i < array.size(); i++) {
15994        res.getEvaluatedResource().add(parseReference(array.get(i).getAsJsonObject()));
15995      }
15996    };
15997  }
15998
15999  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16000    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
16001    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
16002    return res;
16003  }
16004
16005  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
16006    parseBackboneElementProperties(json, res);
16007    if (json.has("code"))
16008      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16009    if (json.has("population")) {
16010      JsonArray array = json.getAsJsonArray("population");
16011      for (int i = 0; i < array.size(); i++) {
16012        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
16013      }
16014    };
16015    if (json.has("measureScore"))
16016      res.setMeasureScore(parseQuantity(getJObject(json, "measureScore")));
16017    if (json.has("stratifier")) {
16018      JsonArray array = json.getAsJsonArray("stratifier");
16019      for (int i = 0; i < array.size(); i++) {
16020        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
16021      }
16022    };
16023  }
16024
16025  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16026    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
16027    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
16028    return res;
16029  }
16030
16031  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
16032    parseBackboneElementProperties(json, res);
16033    if (json.has("code"))
16034      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16035    if (json.has("count"))
16036      res.setCountElement(parseInteger(json.get("count").getAsLong()));
16037    if (json.has("_count"))
16038      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
16039    if (json.has("subjectResults"))
16040      res.setSubjectResults(parseReference(getJObject(json, "subjectResults")));
16041  }
16042
16043  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16044    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
16045    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
16046    return res;
16047  }
16048
16049  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
16050    parseBackboneElementProperties(json, res);
16051    if (json.has("code")) {
16052      JsonArray array = json.getAsJsonArray("code");
16053      for (int i = 0; i < array.size(); i++) {
16054        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16055      }
16056    };
16057    if (json.has("stratum")) {
16058      JsonArray array = json.getAsJsonArray("stratum");
16059      for (int i = 0; i < array.size(); i++) {
16060        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
16061      }
16062    };
16063  }
16064
16065  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16066    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
16067    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
16068    return res;
16069  }
16070
16071  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
16072    parseBackboneElementProperties(json, res);
16073    if (json.has("value"))
16074      res.setValue(parseCodeableConcept(getJObject(json, "value")));
16075    if (json.has("component")) {
16076      JsonArray array = json.getAsJsonArray("component");
16077      for (int i = 0; i < array.size(); i++) {
16078        res.getComponent().add(parseMeasureReportStratifierGroupComponentComponent(array.get(i).getAsJsonObject(), owner));
16079      }
16080    };
16081    if (json.has("population")) {
16082      JsonArray array = json.getAsJsonArray("population");
16083      for (int i = 0; i < array.size(); i++) {
16084        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
16085      }
16086    };
16087    if (json.has("measureScore"))
16088      res.setMeasureScore(parseQuantity(getJObject(json, "measureScore")));
16089  }
16090
16091  protected MeasureReport.StratifierGroupComponentComponent parseMeasureReportStratifierGroupComponentComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16092    MeasureReport.StratifierGroupComponentComponent res = new MeasureReport.StratifierGroupComponentComponent();
16093    parseMeasureReportStratifierGroupComponentComponentProperties(json, owner, res);
16094    return res;
16095  }
16096
16097  protected void parseMeasureReportStratifierGroupComponentComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponentComponent res) throws IOException, FHIRFormatError {
16098    parseBackboneElementProperties(json, res);
16099    if (json.has("code"))
16100      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16101    if (json.has("value"))
16102      res.setValue(parseCodeableConcept(getJObject(json, "value")));
16103  }
16104
16105  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
16106    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
16107    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
16108    return res;
16109  }
16110
16111  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
16112    parseBackboneElementProperties(json, res);
16113    if (json.has("code"))
16114      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16115    if (json.has("count"))
16116      res.setCountElement(parseInteger(json.get("count").getAsLong()));
16117    if (json.has("_count"))
16118      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
16119    if (json.has("subjectResults"))
16120      res.setSubjectResults(parseReference(getJObject(json, "subjectResults")));
16121  }
16122
16123  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
16124    Media res = new Media();
16125    parseMediaProperties(json, res);
16126    return res;
16127  }
16128
16129  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
16130    parseDomainResourceProperties(json, res);
16131    if (json.has("identifier")) {
16132      JsonArray array = json.getAsJsonArray("identifier");
16133      for (int i = 0; i < array.size(); i++) {
16134        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16135      }
16136    };
16137    if (json.has("basedOn")) {
16138      JsonArray array = json.getAsJsonArray("basedOn");
16139      for (int i = 0; i < array.size(); i++) {
16140        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
16141      }
16142    };
16143    if (json.has("partOf")) {
16144      JsonArray array = json.getAsJsonArray("partOf");
16145      for (int i = 0; i < array.size(); i++) {
16146        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16147      }
16148    };
16149    if (json.has("status"))
16150      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Media.MediaStatus.NULL, new Media.MediaStatusEnumFactory()));
16151    if (json.has("_status"))
16152      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16153    if (json.has("type"))
16154      res.setType(parseCodeableConcept(getJObject(json, "type")));
16155    if (json.has("modality"))
16156      res.setModality(parseCodeableConcept(getJObject(json, "modality")));
16157    if (json.has("view"))
16158      res.setView(parseCodeableConcept(getJObject(json, "view")));
16159    if (json.has("subject"))
16160      res.setSubject(parseReference(getJObject(json, "subject")));
16161    if (json.has("encounter"))
16162      res.setEncounter(parseReference(getJObject(json, "encounter")));
16163    Type created = parseType("created", json);
16164    if (created != null)
16165      res.setCreated(created);
16166    if (json.has("issued"))
16167      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
16168    if (json.has("_issued"))
16169      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
16170    if (json.has("operator"))
16171      res.setOperator(parseReference(getJObject(json, "operator")));
16172    if (json.has("reasonCode")) {
16173      JsonArray array = json.getAsJsonArray("reasonCode");
16174      for (int i = 0; i < array.size(); i++) {
16175        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16176      }
16177    };
16178    if (json.has("bodySite"))
16179      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
16180    if (json.has("deviceName"))
16181      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
16182    if (json.has("_deviceName"))
16183      parseElementProperties(getJObject(json, "_deviceName"), res.getDeviceNameElement());
16184    if (json.has("device"))
16185      res.setDevice(parseReference(getJObject(json, "device")));
16186    if (json.has("height"))
16187      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
16188    if (json.has("_height"))
16189      parseElementProperties(getJObject(json, "_height"), res.getHeightElement());
16190    if (json.has("width"))
16191      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
16192    if (json.has("_width"))
16193      parseElementProperties(getJObject(json, "_width"), res.getWidthElement());
16194    if (json.has("frames"))
16195      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
16196    if (json.has("_frames"))
16197      parseElementProperties(getJObject(json, "_frames"), res.getFramesElement());
16198    if (json.has("duration"))
16199      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
16200    if (json.has("_duration"))
16201      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
16202    if (json.has("content"))
16203      res.setContent(parseAttachment(getJObject(json, "content")));
16204    if (json.has("note")) {
16205      JsonArray array = json.getAsJsonArray("note");
16206      for (int i = 0; i < array.size(); i++) {
16207        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16208      }
16209    };
16210  }
16211
16212  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
16213    Medication res = new Medication();
16214    parseMedicationProperties(json, res);
16215    return res;
16216  }
16217
16218  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
16219    parseDomainResourceProperties(json, res);
16220    if (json.has("identifier")) {
16221      JsonArray array = json.getAsJsonArray("identifier");
16222      for (int i = 0; i < array.size(); i++) {
16223        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16224      }
16225    };
16226    if (json.has("code"))
16227      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16228    if (json.has("status"))
16229      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
16230    if (json.has("_status"))
16231      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16232    if (json.has("manufacturer"))
16233      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
16234    if (json.has("form"))
16235      res.setForm(parseCodeableConcept(getJObject(json, "form")));
16236    if (json.has("amount"))
16237      res.setAmount(parseRatio(getJObject(json, "amount")));
16238    if (json.has("ingredient")) {
16239      JsonArray array = json.getAsJsonArray("ingredient");
16240      for (int i = 0; i < array.size(); i++) {
16241        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
16242      }
16243    };
16244    if (json.has("batch"))
16245      res.setBatch(parseMedicationMedicationBatchComponent(getJObject(json, "batch"), res));
16246  }
16247
16248  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
16249    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
16250    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
16251    return res;
16252  }
16253
16254  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
16255    parseBackboneElementProperties(json, res);
16256    Type item = parseType("item", json);
16257    if (item != null)
16258      res.setItem(item);
16259    if (json.has("isActive"))
16260      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
16261    if (json.has("_isActive"))
16262      parseElementProperties(getJObject(json, "_isActive"), res.getIsActiveElement());
16263    if (json.has("strength"))
16264      res.setStrength(parseRatio(getJObject(json, "strength")));
16265  }
16266
16267  protected Medication.MedicationBatchComponent parseMedicationMedicationBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
16268    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
16269    parseMedicationMedicationBatchComponentProperties(json, owner, res);
16270    return res;
16271  }
16272
16273  protected void parseMedicationMedicationBatchComponentProperties(JsonObject json, Medication owner, Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
16274    parseBackboneElementProperties(json, res);
16275    if (json.has("lotNumber"))
16276      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
16277    if (json.has("_lotNumber"))
16278      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
16279    if (json.has("expirationDate"))
16280      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
16281    if (json.has("_expirationDate"))
16282      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
16283  }
16284
16285  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
16286    MedicationAdministration res = new MedicationAdministration();
16287    parseMedicationAdministrationProperties(json, res);
16288    return res;
16289  }
16290
16291  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
16292    parseDomainResourceProperties(json, res);
16293    if (json.has("identifier")) {
16294      JsonArray array = json.getAsJsonArray("identifier");
16295      for (int i = 0; i < array.size(); i++) {
16296        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16297      }
16298    };
16299    if (json.has("instantiates")) {
16300      JsonArray array = json.getAsJsonArray("instantiates");
16301      for (int i = 0; i < array.size(); i++) {
16302        if (array.get(i).isJsonNull()) {
16303          res.getInstantiates().add(new UriType());
16304        } else {
16305          res.getInstantiates().add(parseUri(array.get(i).getAsString()));
16306        }
16307      }
16308    };
16309    if (json.has("_instantiates")) {
16310      JsonArray array = json.getAsJsonArray("_instantiates");
16311      for (int i = 0; i < array.size(); i++) {
16312        if (i == res.getInstantiates().size())
16313          res.getInstantiates().add(parseUri(null));
16314        if (array.get(i) instanceof JsonObject) 
16315          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
16316      }
16317    };
16318    if (json.has("partOf")) {
16319      JsonArray array = json.getAsJsonArray("partOf");
16320      for (int i = 0; i < array.size(); i++) {
16321        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16322      }
16323    };
16324    if (json.has("status"))
16325      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
16326    if (json.has("_status"))
16327      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16328    if (json.has("statusReason")) {
16329      JsonArray array = json.getAsJsonArray("statusReason");
16330      for (int i = 0; i < array.size(); i++) {
16331        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16332      }
16333    };
16334    if (json.has("category"))
16335      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16336    Type medication = parseType("medication", json);
16337    if (medication != null)
16338      res.setMedication(medication);
16339    if (json.has("subject"))
16340      res.setSubject(parseReference(getJObject(json, "subject")));
16341    if (json.has("context"))
16342      res.setContext(parseReference(getJObject(json, "context")));
16343    if (json.has("supportingInformation")) {
16344      JsonArray array = json.getAsJsonArray("supportingInformation");
16345      for (int i = 0; i < array.size(); i++) {
16346        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
16347      }
16348    };
16349    Type effective = parseType("effective", json);
16350    if (effective != null)
16351      res.setEffective(effective);
16352    if (json.has("performer")) {
16353      JsonArray array = json.getAsJsonArray("performer");
16354      for (int i = 0; i < array.size(); i++) {
16355        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject(), res));
16356      }
16357    };
16358    if (json.has("reasonCode")) {
16359      JsonArray array = json.getAsJsonArray("reasonCode");
16360      for (int i = 0; i < array.size(); i++) {
16361        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16362      }
16363    };
16364    if (json.has("reasonReference")) {
16365      JsonArray array = json.getAsJsonArray("reasonReference");
16366      for (int i = 0; i < array.size(); i++) {
16367        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
16368      }
16369    };
16370    if (json.has("request"))
16371      res.setRequest(parseReference(getJObject(json, "request")));
16372    if (json.has("device")) {
16373      JsonArray array = json.getAsJsonArray("device");
16374      for (int i = 0; i < array.size(); i++) {
16375        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
16376      }
16377    };
16378    if (json.has("note")) {
16379      JsonArray array = json.getAsJsonArray("note");
16380      for (int i = 0; i < array.size(); i++) {
16381        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16382      }
16383    };
16384    if (json.has("dosage"))
16385      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(getJObject(json, "dosage"), res));
16386    if (json.has("eventHistory")) {
16387      JsonArray array = json.getAsJsonArray("eventHistory");
16388      for (int i = 0; i < array.size(); i++) {
16389        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
16390      }
16391    };
16392  }
16393
16394  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
16395    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
16396    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
16397    return res;
16398  }
16399
16400  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
16401    parseBackboneElementProperties(json, res);
16402    if (json.has("function"))
16403      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
16404    if (json.has("actor"))
16405      res.setActor(parseReference(getJObject(json, "actor")));
16406  }
16407
16408  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
16409    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
16410    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
16411    return res;
16412  }
16413
16414  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
16415    parseBackboneElementProperties(json, res);
16416    if (json.has("text"))
16417      res.setTextElement(parseString(json.get("text").getAsString()));
16418    if (json.has("_text"))
16419      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
16420    if (json.has("site"))
16421      res.setSite(parseCodeableConcept(getJObject(json, "site")));
16422    if (json.has("route"))
16423      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
16424    if (json.has("method"))
16425      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
16426    if (json.has("dose"))
16427      res.setDose(parseQuantity(getJObject(json, "dose")));
16428    Type rate = parseType("rate", json);
16429    if (rate != null)
16430      res.setRate(rate);
16431  }
16432
16433  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
16434    MedicationDispense res = new MedicationDispense();
16435    parseMedicationDispenseProperties(json, res);
16436    return res;
16437  }
16438
16439  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
16440    parseDomainResourceProperties(json, res);
16441    if (json.has("identifier")) {
16442      JsonArray array = json.getAsJsonArray("identifier");
16443      for (int i = 0; i < array.size(); i++) {
16444        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16445      }
16446    };
16447    if (json.has("partOf")) {
16448      JsonArray array = json.getAsJsonArray("partOf");
16449      for (int i = 0; i < array.size(); i++) {
16450        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16451      }
16452    };
16453    if (json.has("status"))
16454      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
16455    if (json.has("_status"))
16456      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16457    Type statusReason = parseType("statusReason", json);
16458    if (statusReason != null)
16459      res.setStatusReason(statusReason);
16460    if (json.has("category"))
16461      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
16462    Type medication = parseType("medication", json);
16463    if (medication != null)
16464      res.setMedication(medication);
16465    if (json.has("subject"))
16466      res.setSubject(parseReference(getJObject(json, "subject")));
16467    if (json.has("context"))
16468      res.setContext(parseReference(getJObject(json, "context")));
16469    if (json.has("supportingInformation")) {
16470      JsonArray array = json.getAsJsonArray("supportingInformation");
16471      for (int i = 0; i < array.size(); i++) {
16472        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
16473      }
16474    };
16475    if (json.has("performer")) {
16476      JsonArray array = json.getAsJsonArray("performer");
16477      for (int i = 0; i < array.size(); i++) {
16478        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
16479      }
16480    };
16481    if (json.has("location"))
16482      res.setLocation(parseReference(getJObject(json, "location")));
16483    if (json.has("authorizingPrescription")) {
16484      JsonArray array = json.getAsJsonArray("authorizingPrescription");
16485      for (int i = 0; i < array.size(); i++) {
16486        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
16487      }
16488    };
16489    if (json.has("type"))
16490      res.setType(parseCodeableConcept(getJObject(json, "type")));
16491    if (json.has("quantity"))
16492      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16493    if (json.has("daysSupply"))
16494      res.setDaysSupply(parseQuantity(getJObject(json, "daysSupply")));
16495    if (json.has("whenPrepared"))
16496      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
16497    if (json.has("_whenPrepared"))
16498      parseElementProperties(getJObject(json, "_whenPrepared"), res.getWhenPreparedElement());
16499    if (json.has("whenHandedOver"))
16500      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
16501    if (json.has("_whenHandedOver"))
16502      parseElementProperties(getJObject(json, "_whenHandedOver"), res.getWhenHandedOverElement());
16503    if (json.has("destination"))
16504      res.setDestination(parseReference(getJObject(json, "destination")));
16505    if (json.has("receiver")) {
16506      JsonArray array = json.getAsJsonArray("receiver");
16507      for (int i = 0; i < array.size(); i++) {
16508        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
16509      }
16510    };
16511    if (json.has("note")) {
16512      JsonArray array = json.getAsJsonArray("note");
16513      for (int i = 0; i < array.size(); i++) {
16514        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16515      }
16516    };
16517    if (json.has("dosageInstruction")) {
16518      JsonArray array = json.getAsJsonArray("dosageInstruction");
16519      for (int i = 0; i < array.size(); i++) {
16520        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
16521      }
16522    };
16523    if (json.has("substitution"))
16524      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(getJObject(json, "substitution"), res));
16525    if (json.has("detectedIssue")) {
16526      JsonArray array = json.getAsJsonArray("detectedIssue");
16527      for (int i = 0; i < array.size(); i++) {
16528        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
16529      }
16530    };
16531    if (json.has("eventHistory")) {
16532      JsonArray array = json.getAsJsonArray("eventHistory");
16533      for (int i = 0; i < array.size(); i++) {
16534        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
16535      }
16536    };
16537  }
16538
16539  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
16540    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
16541    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
16542    return res;
16543  }
16544
16545  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
16546    parseBackboneElementProperties(json, res);
16547    if (json.has("function"))
16548      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
16549    if (json.has("actor"))
16550      res.setActor(parseReference(getJObject(json, "actor")));
16551  }
16552
16553  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
16554    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
16555    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
16556    return res;
16557  }
16558
16559  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
16560    parseBackboneElementProperties(json, res);
16561    if (json.has("wasSubstituted"))
16562      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
16563    if (json.has("_wasSubstituted"))
16564      parseElementProperties(getJObject(json, "_wasSubstituted"), res.getWasSubstitutedElement());
16565    if (json.has("type"))
16566      res.setType(parseCodeableConcept(getJObject(json, "type")));
16567    if (json.has("reason")) {
16568      JsonArray array = json.getAsJsonArray("reason");
16569      for (int i = 0; i < array.size(); i++) {
16570        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16571      }
16572    };
16573    if (json.has("responsibleParty")) {
16574      JsonArray array = json.getAsJsonArray("responsibleParty");
16575      for (int i = 0; i < array.size(); i++) {
16576        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
16577      }
16578    };
16579  }
16580
16581  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
16582    MedicationKnowledge res = new MedicationKnowledge();
16583    parseMedicationKnowledgeProperties(json, res);
16584    return res;
16585  }
16586
16587  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res) throws IOException, FHIRFormatError {
16588    parseDomainResourceProperties(json, res);
16589    if (json.has("code"))
16590      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16591    if (json.has("status"))
16592      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationKnowledge.MedicationKnowledgeStatus.NULL, new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory()));
16593    if (json.has("_status"))
16594      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16595    if (json.has("manufacturer"))
16596      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
16597    if (json.has("doseForm"))
16598      res.setDoseForm(parseCodeableConcept(getJObject(json, "doseForm")));
16599    if (json.has("amount"))
16600      res.setAmount(parseQuantity(getJObject(json, "amount")));
16601    if (json.has("synonym")) {
16602      JsonArray array = json.getAsJsonArray("synonym");
16603      for (int i = 0; i < array.size(); i++) {
16604        if (array.get(i).isJsonNull()) {
16605          res.getSynonym().add(new StringType());
16606        } else {
16607          res.getSynonym().add(parseString(array.get(i).getAsString()));
16608        }
16609      }
16610    };
16611    if (json.has("_synonym")) {
16612      JsonArray array = json.getAsJsonArray("_synonym");
16613      for (int i = 0; i < array.size(); i++) {
16614        if (i == res.getSynonym().size())
16615          res.getSynonym().add(parseString(null));
16616        if (array.get(i) instanceof JsonObject) 
16617          parseElementProperties(array.get(i).getAsJsonObject(), res.getSynonym().get(i));
16618      }
16619    };
16620    if (json.has("relatedMedicationKnowledge")) {
16621      JsonArray array = json.getAsJsonArray("relatedMedicationKnowledge");
16622      for (int i = 0; i < array.size(); i++) {
16623        res.getRelatedMedicationKnowledge().add(parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(array.get(i).getAsJsonObject(), res));
16624      }
16625    };
16626    if (json.has("associatedMedication")) {
16627      JsonArray array = json.getAsJsonArray("associatedMedication");
16628      for (int i = 0; i < array.size(); i++) {
16629        res.getAssociatedMedication().add(parseReference(array.get(i).getAsJsonObject()));
16630      }
16631    };
16632    if (json.has("productType")) {
16633      JsonArray array = json.getAsJsonArray("productType");
16634      for (int i = 0; i < array.size(); i++) {
16635        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16636      }
16637    };
16638    if (json.has("monograph")) {
16639      JsonArray array = json.getAsJsonArray("monograph");
16640      for (int i = 0; i < array.size(); i++) {
16641        res.getMonograph().add(parseMedicationKnowledgeMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject(), res));
16642      }
16643    };
16644    if (json.has("ingredient")) {
16645      JsonArray array = json.getAsJsonArray("ingredient");
16646      for (int i = 0; i < array.size(); i++) {
16647        res.getIngredient().add(parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(array.get(i).getAsJsonObject(), res));
16648      }
16649    };
16650    if (json.has("preparationInstruction"))
16651      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
16652    if (json.has("_preparationInstruction"))
16653      parseElementProperties(getJObject(json, "_preparationInstruction"), res.getPreparationInstructionElement());
16654    if (json.has("intendedRoute")) {
16655      JsonArray array = json.getAsJsonArray("intendedRoute");
16656      for (int i = 0; i < array.size(); i++) {
16657        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16658      }
16659    };
16660    if (json.has("cost")) {
16661      JsonArray array = json.getAsJsonArray("cost");
16662      for (int i = 0; i < array.size(); i++) {
16663        res.getCost().add(parseMedicationKnowledgeMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject(), res));
16664      }
16665    };
16666    if (json.has("monitoringProgram")) {
16667      JsonArray array = json.getAsJsonArray("monitoringProgram");
16668      for (int i = 0; i < array.size(); i++) {
16669        res.getMonitoringProgram().add(parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject(), res));
16670      }
16671    };
16672    if (json.has("administrationGuidelines")) {
16673      JsonArray array = json.getAsJsonArray("administrationGuidelines");
16674      for (int i = 0; i < array.size(); i++) {
16675        res.getAdministrationGuidelines().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(array.get(i).getAsJsonObject(), res));
16676      }
16677    };
16678    if (json.has("medicineClassification")) {
16679      JsonArray array = json.getAsJsonArray("medicineClassification");
16680      for (int i = 0; i < array.size(); i++) {
16681        res.getMedicineClassification().add(parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(array.get(i).getAsJsonObject(), res));
16682      }
16683    };
16684    if (json.has("packaging"))
16685      res.setPackaging(parseMedicationKnowledgeMedicationKnowledgePackagingComponent(getJObject(json, "packaging"), res));
16686    if (json.has("drugCharacteristic")) {
16687      JsonArray array = json.getAsJsonArray("drugCharacteristic");
16688      for (int i = 0; i < array.size(); i++) {
16689        res.getDrugCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(array.get(i).getAsJsonObject(), res));
16690      }
16691    };
16692    if (json.has("contraindication")) {
16693      JsonArray array = json.getAsJsonArray("contraindication");
16694      for (int i = 0; i < array.size(); i++) {
16695        res.getContraindication().add(parseReference(array.get(i).getAsJsonObject()));
16696      }
16697    };
16698    if (json.has("regulatory")) {
16699      JsonArray array = json.getAsJsonArray("regulatory");
16700      for (int i = 0; i < array.size(); i++) {
16701        res.getRegulatory().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(array.get(i).getAsJsonObject(), res));
16702      }
16703    };
16704    if (json.has("kinetics")) {
16705      JsonArray array = json.getAsJsonArray("kinetics");
16706      for (int i = 0; i < array.size(); i++) {
16707        res.getKinetics().add(parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(array.get(i).getAsJsonObject(), res));
16708      }
16709    };
16710  }
16711
16712  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16713    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
16714    parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(json, owner, res);
16715    return res;
16716  }
16717
16718  protected void parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res) throws IOException, FHIRFormatError {
16719    parseBackboneElementProperties(json, res);
16720    if (json.has("type"))
16721      res.setType(parseCodeableConcept(getJObject(json, "type")));
16722    if (json.has("reference")) {
16723      JsonArray array = json.getAsJsonArray("reference");
16724      for (int i = 0; i < array.size(); i++) {
16725        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
16726      }
16727    };
16728  }
16729
16730  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMedicationKnowledgeMonographComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16731    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
16732    parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(json, owner, res);
16733    return res;
16734  }
16735
16736  protected void parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonographComponent res) throws IOException, FHIRFormatError {
16737    parseBackboneElementProperties(json, res);
16738    if (json.has("type"))
16739      res.setType(parseCodeableConcept(getJObject(json, "type")));
16740    if (json.has("source"))
16741      res.setSource(parseReference(getJObject(json, "source")));
16742  }
16743
16744  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16745    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
16746    parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(json, owner, res);
16747    return res;
16748  }
16749
16750  protected void parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeIngredientComponent res) throws IOException, FHIRFormatError {
16751    parseBackboneElementProperties(json, res);
16752    Type item = parseType("item", json);
16753    if (item != null)
16754      res.setItem(item);
16755    if (json.has("isActive"))
16756      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
16757    if (json.has("_isActive"))
16758      parseElementProperties(getJObject(json, "_isActive"), res.getIsActiveElement());
16759    if (json.has("strength"))
16760      res.setStrength(parseRatio(getJObject(json, "strength")));
16761  }
16762
16763  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeMedicationKnowledgeCostComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16764    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
16765    parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(json, owner, res);
16766    return res;
16767  }
16768
16769  protected void parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeCostComponent res) throws IOException, FHIRFormatError {
16770    parseBackboneElementProperties(json, res);
16771    if (json.has("type"))
16772      res.setType(parseCodeableConcept(getJObject(json, "type")));
16773    if (json.has("source"))
16774      res.setSourceElement(parseString(json.get("source").getAsString()));
16775    if (json.has("_source"))
16776      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
16777    if (json.has("cost"))
16778      res.setCost(parseMoney(getJObject(json, "cost")));
16779  }
16780
16781  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16782    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
16783    parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(json, owner, res);
16784    return res;
16785  }
16786
16787  protected void parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res) throws IOException, FHIRFormatError {
16788    parseBackboneElementProperties(json, res);
16789    if (json.has("type"))
16790      res.setType(parseCodeableConcept(getJObject(json, "type")));
16791    if (json.has("name"))
16792      res.setNameElement(parseString(json.get("name").getAsString()));
16793    if (json.has("_name"))
16794      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16795  }
16796
16797  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16798    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent();
16799    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(json, owner, res);
16800    return res;
16801  }
16802
16803  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res) throws IOException, FHIRFormatError {
16804    parseBackboneElementProperties(json, res);
16805    if (json.has("dosage")) {
16806      JsonArray array = json.getAsJsonArray("dosage");
16807      for (int i = 0; i < array.size(); i++) {
16808        res.getDosage().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(array.get(i).getAsJsonObject(), owner));
16809      }
16810    };
16811    Type indication = parseType("indication", json);
16812    if (indication != null)
16813      res.setIndication(indication);
16814    if (json.has("patientCharacteristics")) {
16815      JsonArray array = json.getAsJsonArray("patientCharacteristics");
16816      for (int i = 0; i < array.size(); i++) {
16817        res.getPatientCharacteristics().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(array.get(i).getAsJsonObject(), owner));
16818      }
16819    };
16820  }
16821
16822  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16823    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent();
16824    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(json, owner, res);
16825    return res;
16826  }
16827
16828  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res) throws IOException, FHIRFormatError {
16829    parseBackboneElementProperties(json, res);
16830    if (json.has("type"))
16831      res.setType(parseCodeableConcept(getJObject(json, "type")));
16832    if (json.has("dosage")) {
16833      JsonArray array = json.getAsJsonArray("dosage");
16834      for (int i = 0; i < array.size(); i++) {
16835        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
16836      }
16837    };
16838  }
16839
16840  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16841    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
16842    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(json, owner, res);
16843    return res;
16844  }
16845
16846  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res) throws IOException, FHIRFormatError {
16847    parseBackboneElementProperties(json, res);
16848    Type characteristic = parseType("characteristic", json);
16849    if (characteristic != null)
16850      res.setCharacteristic(characteristic);
16851    if (json.has("value")) {
16852      JsonArray array = json.getAsJsonArray("value");
16853      for (int i = 0; i < array.size(); i++) {
16854        if (array.get(i).isJsonNull()) {
16855          res.getValue().add(new StringType());
16856        } else {
16857          res.getValue().add(parseString(array.get(i).getAsString()));
16858        }
16859      }
16860    };
16861    if (json.has("_value")) {
16862      JsonArray array = json.getAsJsonArray("_value");
16863      for (int i = 0; i < array.size(); i++) {
16864        if (i == res.getValue().size())
16865          res.getValue().add(parseString(null));
16866        if (array.get(i) instanceof JsonObject) 
16867          parseElementProperties(array.get(i).getAsJsonObject(), res.getValue().get(i));
16868      }
16869    };
16870  }
16871
16872  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16873    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
16874    parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(json, owner, res);
16875    return res;
16876  }
16877
16878  protected void parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res) throws IOException, FHIRFormatError {
16879    parseBackboneElementProperties(json, res);
16880    if (json.has("type"))
16881      res.setType(parseCodeableConcept(getJObject(json, "type")));
16882    if (json.has("classification")) {
16883      JsonArray array = json.getAsJsonArray("classification");
16884      for (int i = 0; i < array.size(); i++) {
16885        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16886      }
16887    };
16888  }
16889
16890  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgeMedicationKnowledgePackagingComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16891    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
16892    parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(json, owner, res);
16893    return res;
16894  }
16895
16896  protected void parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgePackagingComponent res) throws IOException, FHIRFormatError {
16897    parseBackboneElementProperties(json, res);
16898    if (json.has("type"))
16899      res.setType(parseCodeableConcept(getJObject(json, "type")));
16900    if (json.has("quantity"))
16901      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16902  }
16903
16904  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16905    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
16906    parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(json, owner, res);
16907    return res;
16908  }
16909
16910  protected void parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res) throws IOException, FHIRFormatError {
16911    parseBackboneElementProperties(json, res);
16912    if (json.has("type"))
16913      res.setType(parseCodeableConcept(getJObject(json, "type")));
16914    Type value = parseType("value", json);
16915    if (value != null)
16916      res.setValue(value);
16917  }
16918
16919  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16920    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
16921    parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(json, owner, res);
16922    return res;
16923  }
16924
16925  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res) throws IOException, FHIRFormatError {
16926    parseBackboneElementProperties(json, res);
16927    if (json.has("regulatoryAuthority"))
16928      res.setRegulatoryAuthority(parseReference(getJObject(json, "regulatoryAuthority")));
16929    if (json.has("substitution")) {
16930      JsonArray array = json.getAsJsonArray("substitution");
16931      for (int i = 0; i < array.size(); i++) {
16932        res.getSubstitution().add(parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(array.get(i).getAsJsonObject(), owner));
16933      }
16934    };
16935    if (json.has("schedule")) {
16936      JsonArray array = json.getAsJsonArray("schedule");
16937      for (int i = 0; i < array.size(); i++) {
16938        res.getSchedule().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(array.get(i).getAsJsonObject(), owner));
16939      }
16940    };
16941    if (json.has("maxDispense"))
16942      res.setMaxDispense(parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(getJObject(json, "maxDispense"), owner));
16943  }
16944
16945  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16946    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
16947    parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(json, owner, res);
16948    return res;
16949  }
16950
16951  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res) throws IOException, FHIRFormatError {
16952    parseBackboneElementProperties(json, res);
16953    if (json.has("type"))
16954      res.setType(parseCodeableConcept(getJObject(json, "type")));
16955    if (json.has("allowed"))
16956      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
16957    if (json.has("_allowed"))
16958      parseElementProperties(getJObject(json, "_allowed"), res.getAllowedElement());
16959  }
16960
16961  protected MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16962    MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent();
16963    parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(json, owner, res);
16964    return res;
16965  }
16966
16967  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res) throws IOException, FHIRFormatError {
16968    parseBackboneElementProperties(json, res);
16969    if (json.has("schedule"))
16970      res.setSchedule(parseCodeableConcept(getJObject(json, "schedule")));
16971  }
16972
16973  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16974    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
16975    parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(json, owner, res);
16976    return res;
16977  }
16978
16979  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res) throws IOException, FHIRFormatError {
16980    parseBackboneElementProperties(json, res);
16981    if (json.has("quantity"))
16982      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16983    if (json.has("period"))
16984      res.setPeriod(parseDuration(getJObject(json, "period")));
16985  }
16986
16987  protected MedicationKnowledge.MedicationKnowledgeKineticsComponent parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16988    MedicationKnowledge.MedicationKnowledgeKineticsComponent res = new MedicationKnowledge.MedicationKnowledgeKineticsComponent();
16989    parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(json, owner, res);
16990    return res;
16991  }
16992
16993  protected void parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeKineticsComponent res) throws IOException, FHIRFormatError {
16994    parseBackboneElementProperties(json, res);
16995    if (json.has("areaUnderCurve")) {
16996      JsonArray array = json.getAsJsonArray("areaUnderCurve");
16997      for (int i = 0; i < array.size(); i++) {
16998        res.getAreaUnderCurve().add(parseQuantity(array.get(i).getAsJsonObject()));
16999      }
17000    };
17001    if (json.has("lethalDose50")) {
17002      JsonArray array = json.getAsJsonArray("lethalDose50");
17003      for (int i = 0; i < array.size(); i++) {
17004        res.getLethalDose50().add(parseQuantity(array.get(i).getAsJsonObject()));
17005      }
17006    };
17007    if (json.has("halfLifePeriod"))
17008      res.setHalfLifePeriod(parseDuration(getJObject(json, "halfLifePeriod")));
17009  }
17010
17011  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
17012    MedicationRequest res = new MedicationRequest();
17013    parseMedicationRequestProperties(json, res);
17014    return res;
17015  }
17016
17017  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
17018    parseDomainResourceProperties(json, res);
17019    if (json.has("identifier")) {
17020      JsonArray array = json.getAsJsonArray("identifier");
17021      for (int i = 0; i < array.size(); i++) {
17022        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17023      }
17024    };
17025    if (json.has("status"))
17026      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
17027    if (json.has("_status"))
17028      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17029    if (json.has("statusReason"))
17030      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
17031    if (json.has("intent"))
17032      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
17033    if (json.has("_intent"))
17034      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
17035    if (json.has("category")) {
17036      JsonArray array = json.getAsJsonArray("category");
17037      for (int i = 0; i < array.size(); i++) {
17038        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17039      }
17040    };
17041    if (json.has("priority"))
17042      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
17043    if (json.has("_priority"))
17044      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
17045    if (json.has("doNotPerform"))
17046      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
17047    if (json.has("_doNotPerform"))
17048      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
17049    Type reported = parseType("reported", json);
17050    if (reported != null)
17051      res.setReported(reported);
17052    Type medication = parseType("medication", json);
17053    if (medication != null)
17054      res.setMedication(medication);
17055    if (json.has("subject"))
17056      res.setSubject(parseReference(getJObject(json, "subject")));
17057    if (json.has("encounter"))
17058      res.setEncounter(parseReference(getJObject(json, "encounter")));
17059    if (json.has("supportingInformation")) {
17060      JsonArray array = json.getAsJsonArray("supportingInformation");
17061      for (int i = 0; i < array.size(); i++) {
17062        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
17063      }
17064    };
17065    if (json.has("authoredOn"))
17066      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
17067    if (json.has("_authoredOn"))
17068      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
17069    if (json.has("requester"))
17070      res.setRequester(parseReference(getJObject(json, "requester")));
17071    if (json.has("performer"))
17072      res.setPerformer(parseReference(getJObject(json, "performer")));
17073    if (json.has("performerType"))
17074      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
17075    if (json.has("recorder"))
17076      res.setRecorder(parseReference(getJObject(json, "recorder")));
17077    if (json.has("reasonCode")) {
17078      JsonArray array = json.getAsJsonArray("reasonCode");
17079      for (int i = 0; i < array.size(); i++) {
17080        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17081      }
17082    };
17083    if (json.has("reasonReference")) {
17084      JsonArray array = json.getAsJsonArray("reasonReference");
17085      for (int i = 0; i < array.size(); i++) {
17086        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
17087      }
17088    };
17089    if (json.has("instantiatesCanonical")) {
17090      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
17091      for (int i = 0; i < array.size(); i++) {
17092        if (array.get(i).isJsonNull()) {
17093          res.getInstantiatesCanonical().add(new CanonicalType());
17094        } else {
17095          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
17096        }
17097      }
17098    };
17099    if (json.has("_instantiatesCanonical")) {
17100      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
17101      for (int i = 0; i < array.size(); i++) {
17102        if (i == res.getInstantiatesCanonical().size())
17103          res.getInstantiatesCanonical().add(parseCanonical(null));
17104        if (array.get(i) instanceof JsonObject) 
17105          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
17106      }
17107    };
17108    if (json.has("instantiatesUri")) {
17109      JsonArray array = json.getAsJsonArray("instantiatesUri");
17110      for (int i = 0; i < array.size(); i++) {
17111        if (array.get(i).isJsonNull()) {
17112          res.getInstantiatesUri().add(new UriType());
17113        } else {
17114          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
17115        }
17116      }
17117    };
17118    if (json.has("_instantiatesUri")) {
17119      JsonArray array = json.getAsJsonArray("_instantiatesUri");
17120      for (int i = 0; i < array.size(); i++) {
17121        if (i == res.getInstantiatesUri().size())
17122          res.getInstantiatesUri().add(parseUri(null));
17123        if (array.get(i) instanceof JsonObject) 
17124          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
17125      }
17126    };
17127    if (json.has("basedOn")) {
17128      JsonArray array = json.getAsJsonArray("basedOn");
17129      for (int i = 0; i < array.size(); i++) {
17130        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17131      }
17132    };
17133    if (json.has("groupIdentifier"))
17134      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
17135    if (json.has("courseOfTherapyType"))
17136      res.setCourseOfTherapyType(parseCodeableConcept(getJObject(json, "courseOfTherapyType")));
17137    if (json.has("insurance")) {
17138      JsonArray array = json.getAsJsonArray("insurance");
17139      for (int i = 0; i < array.size(); i++) {
17140        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
17141      }
17142    };
17143    if (json.has("note")) {
17144      JsonArray array = json.getAsJsonArray("note");
17145      for (int i = 0; i < array.size(); i++) {
17146        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17147      }
17148    };
17149    if (json.has("dosageInstruction")) {
17150      JsonArray array = json.getAsJsonArray("dosageInstruction");
17151      for (int i = 0; i < array.size(); i++) {
17152        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
17153      }
17154    };
17155    if (json.has("dispenseRequest"))
17156      res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(getJObject(json, "dispenseRequest"), res));
17157    if (json.has("substitution"))
17158      res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(getJObject(json, "substitution"), res));
17159    if (json.has("priorPrescription"))
17160      res.setPriorPrescription(parseReference(getJObject(json, "priorPrescription")));
17161    if (json.has("detectedIssue")) {
17162      JsonArray array = json.getAsJsonArray("detectedIssue");
17163      for (int i = 0; i < array.size(); i++) {
17164        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
17165      }
17166    };
17167    if (json.has("eventHistory")) {
17168      JsonArray array = json.getAsJsonArray("eventHistory");
17169      for (int i = 0; i < array.size(); i++) {
17170        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
17171      }
17172    };
17173  }
17174
17175  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
17176    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
17177    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
17178    return res;
17179  }
17180
17181  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
17182    parseBackboneElementProperties(json, res);
17183    if (json.has("initialFill"))
17184      res.setInitialFill(parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(getJObject(json, "initialFill"), owner));
17185    if (json.has("dispenseInterval"))
17186      res.setDispenseInterval(parseDuration(getJObject(json, "dispenseInterval")));
17187    if (json.has("validityPeriod"))
17188      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
17189    if (json.has("numberOfRepeatsAllowed"))
17190      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
17191    if (json.has("_numberOfRepeatsAllowed"))
17192      parseElementProperties(getJObject(json, "_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
17193    if (json.has("quantity"))
17194      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
17195    if (json.has("expectedSupplyDuration"))
17196      res.setExpectedSupplyDuration(parseDuration(getJObject(json, "expectedSupplyDuration")));
17197    if (json.has("performer"))
17198      res.setPerformer(parseReference(getJObject(json, "performer")));
17199  }
17200
17201  protected MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
17202    MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res = new MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent();
17203    parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(json, owner, res);
17204    return res;
17205  }
17206
17207  protected void parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res) throws IOException, FHIRFormatError {
17208    parseBackboneElementProperties(json, res);
17209    if (json.has("quantity"))
17210      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
17211    if (json.has("duration"))
17212      res.setDuration(parseDuration(getJObject(json, "duration")));
17213  }
17214
17215  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
17216    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
17217    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
17218    return res;
17219  }
17220
17221  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
17222    parseBackboneElementProperties(json, res);
17223    Type allowed = parseType("allowed", json);
17224    if (allowed != null)
17225      res.setAllowed(allowed);
17226    if (json.has("reason"))
17227      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
17228  }
17229
17230  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
17231    MedicationStatement res = new MedicationStatement();
17232    parseMedicationStatementProperties(json, res);
17233    return res;
17234  }
17235
17236  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
17237    parseDomainResourceProperties(json, res);
17238    if (json.has("identifier")) {
17239      JsonArray array = json.getAsJsonArray("identifier");
17240      for (int i = 0; i < array.size(); i++) {
17241        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17242      }
17243    };
17244    if (json.has("basedOn")) {
17245      JsonArray array = json.getAsJsonArray("basedOn");
17246      for (int i = 0; i < array.size(); i++) {
17247        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17248      }
17249    };
17250    if (json.has("partOf")) {
17251      JsonArray array = json.getAsJsonArray("partOf");
17252      for (int i = 0; i < array.size(); i++) {
17253        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17254      }
17255    };
17256    if (json.has("status"))
17257      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
17258    if (json.has("_status"))
17259      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17260    if (json.has("statusReason")) {
17261      JsonArray array = json.getAsJsonArray("statusReason");
17262      for (int i = 0; i < array.size(); i++) {
17263        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17264      }
17265    };
17266    if (json.has("category"))
17267      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
17268    Type medication = parseType("medication", json);
17269    if (medication != null)
17270      res.setMedication(medication);
17271    if (json.has("subject"))
17272      res.setSubject(parseReference(getJObject(json, "subject")));
17273    if (json.has("context"))
17274      res.setContext(parseReference(getJObject(json, "context")));
17275    Type effective = parseType("effective", json);
17276    if (effective != null)
17277      res.setEffective(effective);
17278    if (json.has("dateAsserted"))
17279      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
17280    if (json.has("_dateAsserted"))
17281      parseElementProperties(getJObject(json, "_dateAsserted"), res.getDateAssertedElement());
17282    if (json.has("informationSource"))
17283      res.setInformationSource(parseReference(getJObject(json, "informationSource")));
17284    if (json.has("derivedFrom")) {
17285      JsonArray array = json.getAsJsonArray("derivedFrom");
17286      for (int i = 0; i < array.size(); i++) {
17287        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
17288      }
17289    };
17290    if (json.has("reasonCode")) {
17291      JsonArray array = json.getAsJsonArray("reasonCode");
17292      for (int i = 0; i < array.size(); i++) {
17293        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17294      }
17295    };
17296    if (json.has("reasonReference")) {
17297      JsonArray array = json.getAsJsonArray("reasonReference");
17298      for (int i = 0; i < array.size(); i++) {
17299        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
17300      }
17301    };
17302    if (json.has("note")) {
17303      JsonArray array = json.getAsJsonArray("note");
17304      for (int i = 0; i < array.size(); i++) {
17305        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17306      }
17307    };
17308    if (json.has("dosage")) {
17309      JsonArray array = json.getAsJsonArray("dosage");
17310      for (int i = 0; i < array.size(); i++) {
17311        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
17312      }
17313    };
17314  }
17315
17316  protected MedicinalProduct parseMedicinalProduct(JsonObject json) throws IOException, FHIRFormatError {
17317    MedicinalProduct res = new MedicinalProduct();
17318    parseMedicinalProductProperties(json, res);
17319    return res;
17320  }
17321
17322  protected void parseMedicinalProductProperties(JsonObject json, MedicinalProduct res) throws IOException, FHIRFormatError {
17323    parseDomainResourceProperties(json, res);
17324    if (json.has("identifier")) {
17325      JsonArray array = json.getAsJsonArray("identifier");
17326      for (int i = 0; i < array.size(); i++) {
17327        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17328      }
17329    };
17330    if (json.has("type"))
17331      res.setType(parseCodeableConcept(getJObject(json, "type")));
17332    if (json.has("domain"))
17333      res.setDomain(parseCoding(getJObject(json, "domain")));
17334    if (json.has("combinedPharmaceuticalDoseForm"))
17335      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(getJObject(json, "combinedPharmaceuticalDoseForm")));
17336    if (json.has("legalStatusOfSupply"))
17337      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
17338    if (json.has("additionalMonitoringIndicator"))
17339      res.setAdditionalMonitoringIndicator(parseCodeableConcept(getJObject(json, "additionalMonitoringIndicator")));
17340    if (json.has("specialMeasures")) {
17341      JsonArray array = json.getAsJsonArray("specialMeasures");
17342      for (int i = 0; i < array.size(); i++) {
17343        if (array.get(i).isJsonNull()) {
17344          res.getSpecialMeasures().add(new StringType());
17345        } else {
17346          res.getSpecialMeasures().add(parseString(array.get(i).getAsString()));
17347        }
17348      }
17349    };
17350    if (json.has("_specialMeasures")) {
17351      JsonArray array = json.getAsJsonArray("_specialMeasures");
17352      for (int i = 0; i < array.size(); i++) {
17353        if (i == res.getSpecialMeasures().size())
17354          res.getSpecialMeasures().add(parseString(null));
17355        if (array.get(i) instanceof JsonObject) 
17356          parseElementProperties(array.get(i).getAsJsonObject(), res.getSpecialMeasures().get(i));
17357      }
17358    };
17359    if (json.has("paediatricUseIndicator"))
17360      res.setPaediatricUseIndicator(parseCodeableConcept(getJObject(json, "paediatricUseIndicator")));
17361    if (json.has("productClassification")) {
17362      JsonArray array = json.getAsJsonArray("productClassification");
17363      for (int i = 0; i < array.size(); i++) {
17364        res.getProductClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17365      }
17366    };
17367    if (json.has("marketingStatus")) {
17368      JsonArray array = json.getAsJsonArray("marketingStatus");
17369      for (int i = 0; i < array.size(); i++) {
17370        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
17371      }
17372    };
17373    if (json.has("pharmaceuticalProduct")) {
17374      JsonArray array = json.getAsJsonArray("pharmaceuticalProduct");
17375      for (int i = 0; i < array.size(); i++) {
17376        res.getPharmaceuticalProduct().add(parseReference(array.get(i).getAsJsonObject()));
17377      }
17378    };
17379    if (json.has("packagedMedicinalProduct")) {
17380      JsonArray array = json.getAsJsonArray("packagedMedicinalProduct");
17381      for (int i = 0; i < array.size(); i++) {
17382        res.getPackagedMedicinalProduct().add(parseReference(array.get(i).getAsJsonObject()));
17383      }
17384    };
17385    if (json.has("attachedDocument")) {
17386      JsonArray array = json.getAsJsonArray("attachedDocument");
17387      for (int i = 0; i < array.size(); i++) {
17388        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
17389      }
17390    };
17391    if (json.has("masterFile")) {
17392      JsonArray array = json.getAsJsonArray("masterFile");
17393      for (int i = 0; i < array.size(); i++) {
17394        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
17395      }
17396    };
17397    if (json.has("contact")) {
17398      JsonArray array = json.getAsJsonArray("contact");
17399      for (int i = 0; i < array.size(); i++) {
17400        res.getContact().add(parseReference(array.get(i).getAsJsonObject()));
17401      }
17402    };
17403    if (json.has("clinicalTrial")) {
17404      JsonArray array = json.getAsJsonArray("clinicalTrial");
17405      for (int i = 0; i < array.size(); i++) {
17406        res.getClinicalTrial().add(parseReference(array.get(i).getAsJsonObject()));
17407      }
17408    };
17409    if (json.has("name")) {
17410      JsonArray array = json.getAsJsonArray("name");
17411      for (int i = 0; i < array.size(); i++) {
17412        res.getName().add(parseMedicinalProductMedicinalProductNameComponent(array.get(i).getAsJsonObject(), res));
17413      }
17414    };
17415    if (json.has("crossReference")) {
17416      JsonArray array = json.getAsJsonArray("crossReference");
17417      for (int i = 0; i < array.size(); i++) {
17418        res.getCrossReference().add(parseIdentifier(array.get(i).getAsJsonObject()));
17419      }
17420    };
17421    if (json.has("manufacturingBusinessOperation")) {
17422      JsonArray array = json.getAsJsonArray("manufacturingBusinessOperation");
17423      for (int i = 0; i < array.size(); i++) {
17424        res.getManufacturingBusinessOperation().add(parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(array.get(i).getAsJsonObject(), res));
17425      }
17426    };
17427    if (json.has("specialDesignation")) {
17428      JsonArray array = json.getAsJsonArray("specialDesignation");
17429      for (int i = 0; i < array.size(); i++) {
17430        res.getSpecialDesignation().add(parseMedicinalProductMedicinalProductSpecialDesignationComponent(array.get(i).getAsJsonObject(), res));
17431      }
17432    };
17433  }
17434
17435  protected MedicinalProduct.MedicinalProductNameComponent parseMedicinalProductMedicinalProductNameComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17436    MedicinalProduct.MedicinalProductNameComponent res = new MedicinalProduct.MedicinalProductNameComponent();
17437    parseMedicinalProductMedicinalProductNameComponentProperties(json, owner, res);
17438    return res;
17439  }
17440
17441  protected void parseMedicinalProductMedicinalProductNameComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameComponent res) throws IOException, FHIRFormatError {
17442    parseBackboneElementProperties(json, res);
17443    if (json.has("productName"))
17444      res.setProductNameElement(parseString(json.get("productName").getAsString()));
17445    if (json.has("_productName"))
17446      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
17447    if (json.has("namePart")) {
17448      JsonArray array = json.getAsJsonArray("namePart");
17449      for (int i = 0; i < array.size(); i++) {
17450        res.getNamePart().add(parseMedicinalProductMedicinalProductNameNamePartComponent(array.get(i).getAsJsonObject(), owner));
17451      }
17452    };
17453    if (json.has("countryLanguage")) {
17454      JsonArray array = json.getAsJsonArray("countryLanguage");
17455      for (int i = 0; i < array.size(); i++) {
17456        res.getCountryLanguage().add(parseMedicinalProductMedicinalProductNameCountryLanguageComponent(array.get(i).getAsJsonObject(), owner));
17457      }
17458    };
17459  }
17460
17461  protected MedicinalProduct.MedicinalProductNameNamePartComponent parseMedicinalProductMedicinalProductNameNamePartComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17462    MedicinalProduct.MedicinalProductNameNamePartComponent res = new MedicinalProduct.MedicinalProductNameNamePartComponent();
17463    parseMedicinalProductMedicinalProductNameNamePartComponentProperties(json, owner, res);
17464    return res;
17465  }
17466
17467  protected void parseMedicinalProductMedicinalProductNameNamePartComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameNamePartComponent res) throws IOException, FHIRFormatError {
17468    parseBackboneElementProperties(json, res);
17469    if (json.has("part"))
17470      res.setPartElement(parseString(json.get("part").getAsString()));
17471    if (json.has("_part"))
17472      parseElementProperties(getJObject(json, "_part"), res.getPartElement());
17473    if (json.has("type"))
17474      res.setType(parseCoding(getJObject(json, "type")));
17475  }
17476
17477  protected MedicinalProduct.MedicinalProductNameCountryLanguageComponent parseMedicinalProductMedicinalProductNameCountryLanguageComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17478    MedicinalProduct.MedicinalProductNameCountryLanguageComponent res = new MedicinalProduct.MedicinalProductNameCountryLanguageComponent();
17479    parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(json, owner, res);
17480    return res;
17481  }
17482
17483  protected void parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameCountryLanguageComponent res) throws IOException, FHIRFormatError {
17484    parseBackboneElementProperties(json, res);
17485    if (json.has("country"))
17486      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
17487    if (json.has("jurisdiction"))
17488      res.setJurisdiction(parseCodeableConcept(getJObject(json, "jurisdiction")));
17489    if (json.has("language"))
17490      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
17491  }
17492
17493  protected MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17494    MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res = new MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent();
17495    parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(json, owner, res);
17496    return res;
17497  }
17498
17499  protected void parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res) throws IOException, FHIRFormatError {
17500    parseBackboneElementProperties(json, res);
17501    if (json.has("operationType"))
17502      res.setOperationType(parseCodeableConcept(getJObject(json, "operationType")));
17503    if (json.has("authorisationReferenceNumber"))
17504      res.setAuthorisationReferenceNumber(parseIdentifier(getJObject(json, "authorisationReferenceNumber")));
17505    if (json.has("effectiveDate"))
17506      res.setEffectiveDateElement(parseDateTime(json.get("effectiveDate").getAsString()));
17507    if (json.has("_effectiveDate"))
17508      parseElementProperties(getJObject(json, "_effectiveDate"), res.getEffectiveDateElement());
17509    if (json.has("confidentialityIndicator"))
17510      res.setConfidentialityIndicator(parseCodeableConcept(getJObject(json, "confidentialityIndicator")));
17511    if (json.has("manufacturer")) {
17512      JsonArray array = json.getAsJsonArray("manufacturer");
17513      for (int i = 0; i < array.size(); i++) {
17514        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17515      }
17516    };
17517    if (json.has("regulator"))
17518      res.setRegulator(parseReference(getJObject(json, "regulator")));
17519  }
17520
17521  protected MedicinalProduct.MedicinalProductSpecialDesignationComponent parseMedicinalProductMedicinalProductSpecialDesignationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17522    MedicinalProduct.MedicinalProductSpecialDesignationComponent res = new MedicinalProduct.MedicinalProductSpecialDesignationComponent();
17523    parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(json, owner, res);
17524    return res;
17525  }
17526
17527  protected void parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductSpecialDesignationComponent res) throws IOException, FHIRFormatError {
17528    parseBackboneElementProperties(json, res);
17529    if (json.has("identifier")) {
17530      JsonArray array = json.getAsJsonArray("identifier");
17531      for (int i = 0; i < array.size(); i++) {
17532        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17533      }
17534    };
17535    if (json.has("type"))
17536      res.setType(parseCodeableConcept(getJObject(json, "type")));
17537    if (json.has("intendedUse"))
17538      res.setIntendedUse(parseCodeableConcept(getJObject(json, "intendedUse")));
17539    Type indication = parseType("indication", json);
17540    if (indication != null)
17541      res.setIndication(indication);
17542    if (json.has("status"))
17543      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
17544    if (json.has("date"))
17545      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17546    if (json.has("_date"))
17547      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17548    if (json.has("species"))
17549      res.setSpecies(parseCodeableConcept(getJObject(json, "species")));
17550  }
17551
17552  protected MedicinalProductAuthorization parseMedicinalProductAuthorization(JsonObject json) throws IOException, FHIRFormatError {
17553    MedicinalProductAuthorization res = new MedicinalProductAuthorization();
17554    parseMedicinalProductAuthorizationProperties(json, res);
17555    return res;
17556  }
17557
17558  protected void parseMedicinalProductAuthorizationProperties(JsonObject json, MedicinalProductAuthorization res) throws IOException, FHIRFormatError {
17559    parseDomainResourceProperties(json, res);
17560    if (json.has("identifier")) {
17561      JsonArray array = json.getAsJsonArray("identifier");
17562      for (int i = 0; i < array.size(); i++) {
17563        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17564      }
17565    };
17566    if (json.has("subject"))
17567      res.setSubject(parseReference(getJObject(json, "subject")));
17568    if (json.has("country")) {
17569      JsonArray array = json.getAsJsonArray("country");
17570      for (int i = 0; i < array.size(); i++) {
17571        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17572      }
17573    };
17574    if (json.has("jurisdiction")) {
17575      JsonArray array = json.getAsJsonArray("jurisdiction");
17576      for (int i = 0; i < array.size(); i++) {
17577        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17578      }
17579    };
17580    if (json.has("status"))
17581      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
17582    if (json.has("statusDate"))
17583      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
17584    if (json.has("_statusDate"))
17585      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
17586    if (json.has("restoreDate"))
17587      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
17588    if (json.has("_restoreDate"))
17589      parseElementProperties(getJObject(json, "_restoreDate"), res.getRestoreDateElement());
17590    if (json.has("validityPeriod"))
17591      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
17592    if (json.has("dataExclusivityPeriod"))
17593      res.setDataExclusivityPeriod(parsePeriod(getJObject(json, "dataExclusivityPeriod")));
17594    if (json.has("dateOfFirstAuthorization"))
17595      res.setDateOfFirstAuthorizationElement(parseDateTime(json.get("dateOfFirstAuthorization").getAsString()));
17596    if (json.has("_dateOfFirstAuthorization"))
17597      parseElementProperties(getJObject(json, "_dateOfFirstAuthorization"), res.getDateOfFirstAuthorizationElement());
17598    if (json.has("internationalBirthDate"))
17599      res.setInternationalBirthDateElement(parseDateTime(json.get("internationalBirthDate").getAsString()));
17600    if (json.has("_internationalBirthDate"))
17601      parseElementProperties(getJObject(json, "_internationalBirthDate"), res.getInternationalBirthDateElement());
17602    if (json.has("legalBasis"))
17603      res.setLegalBasis(parseCodeableConcept(getJObject(json, "legalBasis")));
17604    if (json.has("jurisdictionalAuthorization")) {
17605      JsonArray array = json.getAsJsonArray("jurisdictionalAuthorization");
17606      for (int i = 0; i < array.size(); i++) {
17607        res.getJurisdictionalAuthorization().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(array.get(i).getAsJsonObject(), res));
17608      }
17609    };
17610    if (json.has("holder"))
17611      res.setHolder(parseReference(getJObject(json, "holder")));
17612    if (json.has("regulator"))
17613      res.setRegulator(parseReference(getJObject(json, "regulator")));
17614    if (json.has("procedure"))
17615      res.setProcedure(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(getJObject(json, "procedure"), res));
17616  }
17617
17618  protected MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
17619    MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
17620    parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(json, owner, res);
17621    return res;
17622  }
17623
17624  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res) throws IOException, FHIRFormatError {
17625    parseBackboneElementProperties(json, res);
17626    if (json.has("identifier")) {
17627      JsonArray array = json.getAsJsonArray("identifier");
17628      for (int i = 0; i < array.size(); i++) {
17629        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17630      }
17631    };
17632    if (json.has("country"))
17633      res.setCountry(parseCodeableConcept(getJObject(json, "country")));
17634    if (json.has("jurisdiction")) {
17635      JsonArray array = json.getAsJsonArray("jurisdiction");
17636      for (int i = 0; i < array.size(); i++) {
17637        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17638      }
17639    };
17640    if (json.has("legalStatusOfSupply"))
17641      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
17642    if (json.has("validityPeriod"))
17643      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
17644  }
17645
17646  protected MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
17647    MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent();
17648    parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(json, owner, res);
17649    return res;
17650  }
17651
17652  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res) throws IOException, FHIRFormatError {
17653    parseBackboneElementProperties(json, res);
17654    if (json.has("identifier"))
17655      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
17656    if (json.has("type"))
17657      res.setType(parseCodeableConcept(getJObject(json, "type")));
17658    Type date = parseType("date", json);
17659    if (date != null)
17660      res.setDate(date);
17661    if (json.has("application")) {
17662      JsonArray array = json.getAsJsonArray("application");
17663      for (int i = 0; i < array.size(); i++) {
17664        res.getApplication().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(array.get(i).getAsJsonObject(), owner));
17665      }
17666    };
17667  }
17668
17669  protected MedicinalProductContraindication parseMedicinalProductContraindication(JsonObject json) throws IOException, FHIRFormatError {
17670    MedicinalProductContraindication res = new MedicinalProductContraindication();
17671    parseMedicinalProductContraindicationProperties(json, res);
17672    return res;
17673  }
17674
17675  protected void parseMedicinalProductContraindicationProperties(JsonObject json, MedicinalProductContraindication res) throws IOException, FHIRFormatError {
17676    parseDomainResourceProperties(json, res);
17677    if (json.has("subject")) {
17678      JsonArray array = json.getAsJsonArray("subject");
17679      for (int i = 0; i < array.size(); i++) {
17680        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17681      }
17682    };
17683    if (json.has("disease"))
17684      res.setDisease(parseCodeableConcept(getJObject(json, "disease")));
17685    if (json.has("diseaseStatus"))
17686      res.setDiseaseStatus(parseCodeableConcept(getJObject(json, "diseaseStatus")));
17687    if (json.has("comorbidity")) {
17688      JsonArray array = json.getAsJsonArray("comorbidity");
17689      for (int i = 0; i < array.size(); i++) {
17690        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17691      }
17692    };
17693    if (json.has("therapeuticIndication")) {
17694      JsonArray array = json.getAsJsonArray("therapeuticIndication");
17695      for (int i = 0; i < array.size(); i++) {
17696        res.getTherapeuticIndication().add(parseReference(array.get(i).getAsJsonObject()));
17697      }
17698    };
17699    if (json.has("otherTherapy")) {
17700      JsonArray array = json.getAsJsonArray("otherTherapy");
17701      for (int i = 0; i < array.size(); i++) {
17702        res.getOtherTherapy().add(parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject(), res));
17703      }
17704    };
17705    if (json.has("population")) {
17706      JsonArray array = json.getAsJsonArray("population");
17707      for (int i = 0; i < array.size(); i++) {
17708        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17709      }
17710    };
17711  }
17712
17713  protected MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(JsonObject json, MedicinalProductContraindication owner) throws IOException, FHIRFormatError {
17714    MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res = new MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent();
17715    parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(json, owner, res);
17716    return res;
17717  }
17718
17719  protected void parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductContraindication owner, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
17720    parseBackboneElementProperties(json, res);
17721    if (json.has("therapyRelationshipType"))
17722      res.setTherapyRelationshipType(parseCodeableConcept(getJObject(json, "therapyRelationshipType")));
17723    Type medication = parseType("medication", json);
17724    if (medication != null)
17725      res.setMedication(medication);
17726  }
17727
17728  protected MedicinalProductIndication parseMedicinalProductIndication(JsonObject json) throws IOException, FHIRFormatError {
17729    MedicinalProductIndication res = new MedicinalProductIndication();
17730    parseMedicinalProductIndicationProperties(json, res);
17731    return res;
17732  }
17733
17734  protected void parseMedicinalProductIndicationProperties(JsonObject json, MedicinalProductIndication res) throws IOException, FHIRFormatError {
17735    parseDomainResourceProperties(json, res);
17736    if (json.has("subject")) {
17737      JsonArray array = json.getAsJsonArray("subject");
17738      for (int i = 0; i < array.size(); i++) {
17739        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17740      }
17741    };
17742    if (json.has("diseaseSymptomProcedure"))
17743      res.setDiseaseSymptomProcedure(parseCodeableConcept(getJObject(json, "diseaseSymptomProcedure")));
17744    if (json.has("diseaseStatus"))
17745      res.setDiseaseStatus(parseCodeableConcept(getJObject(json, "diseaseStatus")));
17746    if (json.has("comorbidity")) {
17747      JsonArray array = json.getAsJsonArray("comorbidity");
17748      for (int i = 0; i < array.size(); i++) {
17749        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17750      }
17751    };
17752    if (json.has("intendedEffect"))
17753      res.setIntendedEffect(parseCodeableConcept(getJObject(json, "intendedEffect")));
17754    if (json.has("duration"))
17755      res.setDuration(parseQuantity(getJObject(json, "duration")));
17756    if (json.has("otherTherapy")) {
17757      JsonArray array = json.getAsJsonArray("otherTherapy");
17758      for (int i = 0; i < array.size(); i++) {
17759        res.getOtherTherapy().add(parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(array.get(i).getAsJsonObject(), res));
17760      }
17761    };
17762    if (json.has("undesirableEffect")) {
17763      JsonArray array = json.getAsJsonArray("undesirableEffect");
17764      for (int i = 0; i < array.size(); i++) {
17765        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
17766      }
17767    };
17768    if (json.has("population")) {
17769      JsonArray array = json.getAsJsonArray("population");
17770      for (int i = 0; i < array.size(); i++) {
17771        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17772      }
17773    };
17774  }
17775
17776  protected MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(JsonObject json, MedicinalProductIndication owner) throws IOException, FHIRFormatError {
17777    MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res = new MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent();
17778    parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(json, owner, res);
17779    return res;
17780  }
17781
17782  protected void parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductIndication owner, MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
17783    parseBackboneElementProperties(json, res);
17784    if (json.has("therapyRelationshipType"))
17785      res.setTherapyRelationshipType(parseCodeableConcept(getJObject(json, "therapyRelationshipType")));
17786    Type medication = parseType("medication", json);
17787    if (medication != null)
17788      res.setMedication(medication);
17789  }
17790
17791  protected MedicinalProductIngredient parseMedicinalProductIngredient(JsonObject json) throws IOException, FHIRFormatError {
17792    MedicinalProductIngredient res = new MedicinalProductIngredient();
17793    parseMedicinalProductIngredientProperties(json, res);
17794    return res;
17795  }
17796
17797  protected void parseMedicinalProductIngredientProperties(JsonObject json, MedicinalProductIngredient res) throws IOException, FHIRFormatError {
17798    parseDomainResourceProperties(json, res);
17799    if (json.has("identifier"))
17800      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
17801    if (json.has("role"))
17802      res.setRole(parseCodeableConcept(getJObject(json, "role")));
17803    if (json.has("allergenicIndicator"))
17804      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
17805    if (json.has("_allergenicIndicator"))
17806      parseElementProperties(getJObject(json, "_allergenicIndicator"), res.getAllergenicIndicatorElement());
17807    if (json.has("manufacturer")) {
17808      JsonArray array = json.getAsJsonArray("manufacturer");
17809      for (int i = 0; i < array.size(); i++) {
17810        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17811      }
17812    };
17813    if (json.has("specifiedSubstance")) {
17814      JsonArray array = json.getAsJsonArray("specifiedSubstance");
17815      for (int i = 0; i < array.size(); i++) {
17816        res.getSpecifiedSubstance().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(array.get(i).getAsJsonObject(), res));
17817      }
17818    };
17819    if (json.has("substance"))
17820      res.setSubstance(parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(getJObject(json, "substance"), res));
17821  }
17822
17823  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17824    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent();
17825    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(json, owner, res);
17826    return res;
17827  }
17828
17829  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res) throws IOException, FHIRFormatError {
17830    parseBackboneElementProperties(json, res);
17831    if (json.has("code"))
17832      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17833    if (json.has("group"))
17834      res.setGroup(parseCodeableConcept(getJObject(json, "group")));
17835    if (json.has("confidentiality"))
17836      res.setConfidentiality(parseCodeableConcept(getJObject(json, "confidentiality")));
17837    if (json.has("strength")) {
17838      JsonArray array = json.getAsJsonArray("strength");
17839      for (int i = 0; i < array.size(); i++) {
17840        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17841      }
17842    };
17843  }
17844
17845  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17846    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent();
17847    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(json, owner, res);
17848    return res;
17849  }
17850
17851  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res) throws IOException, FHIRFormatError {
17852    parseBackboneElementProperties(json, res);
17853    if (json.has("presentation"))
17854      res.setPresentation(parseRatio(getJObject(json, "presentation")));
17855    if (json.has("presentationLowLimit"))
17856      res.setPresentationLowLimit(parseRatio(getJObject(json, "presentationLowLimit")));
17857    if (json.has("concentration"))
17858      res.setConcentration(parseRatio(getJObject(json, "concentration")));
17859    if (json.has("concentrationLowLimit"))
17860      res.setConcentrationLowLimit(parseRatio(getJObject(json, "concentrationLowLimit")));
17861    if (json.has("measurementPoint"))
17862      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
17863    if (json.has("_measurementPoint"))
17864      parseElementProperties(getJObject(json, "_measurementPoint"), res.getMeasurementPointElement());
17865    if (json.has("country")) {
17866      JsonArray array = json.getAsJsonArray("country");
17867      for (int i = 0; i < array.size(); i++) {
17868        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17869      }
17870    };
17871    if (json.has("referenceStrength")) {
17872      JsonArray array = json.getAsJsonArray("referenceStrength");
17873      for (int i = 0; i < array.size(); i++) {
17874        res.getReferenceStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17875      }
17876    };
17877  }
17878
17879  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17880    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent();
17881    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(json, owner, res);
17882    return res;
17883  }
17884
17885  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res) throws IOException, FHIRFormatError {
17886    parseBackboneElementProperties(json, res);
17887    if (json.has("substance"))
17888      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
17889    if (json.has("strength"))
17890      res.setStrength(parseRatio(getJObject(json, "strength")));
17891    if (json.has("strengthLowLimit"))
17892      res.setStrengthLowLimit(parseRatio(getJObject(json, "strengthLowLimit")));
17893    if (json.has("measurementPoint"))
17894      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
17895    if (json.has("_measurementPoint"))
17896      parseElementProperties(getJObject(json, "_measurementPoint"), res.getMeasurementPointElement());
17897    if (json.has("country")) {
17898      JsonArray array = json.getAsJsonArray("country");
17899      for (int i = 0; i < array.size(); i++) {
17900        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17901      }
17902    };
17903  }
17904
17905  protected MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17906    MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent();
17907    parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(json, owner, res);
17908    return res;
17909  }
17910
17911  protected void parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res) throws IOException, FHIRFormatError {
17912    parseBackboneElementProperties(json, res);
17913    if (json.has("code"))
17914      res.setCode(parseCodeableConcept(getJObject(json, "code")));
17915    if (json.has("strength")) {
17916      JsonArray array = json.getAsJsonArray("strength");
17917      for (int i = 0; i < array.size(); i++) {
17918        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17919      }
17920    };
17921  }
17922
17923  protected MedicinalProductInteraction parseMedicinalProductInteraction(JsonObject json) throws IOException, FHIRFormatError {
17924    MedicinalProductInteraction res = new MedicinalProductInteraction();
17925    parseMedicinalProductInteractionProperties(json, res);
17926    return res;
17927  }
17928
17929  protected void parseMedicinalProductInteractionProperties(JsonObject json, MedicinalProductInteraction res) throws IOException, FHIRFormatError {
17930    parseDomainResourceProperties(json, res);
17931    if (json.has("subject")) {
17932      JsonArray array = json.getAsJsonArray("subject");
17933      for (int i = 0; i < array.size(); i++) {
17934        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17935      }
17936    };
17937    if (json.has("description"))
17938      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17939    if (json.has("_description"))
17940      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17941    if (json.has("interactant")) {
17942      JsonArray array = json.getAsJsonArray("interactant");
17943      for (int i = 0; i < array.size(); i++) {
17944        res.getInteractant().add(parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(array.get(i).getAsJsonObject(), res));
17945      }
17946    };
17947    if (json.has("type"))
17948      res.setType(parseCodeableConcept(getJObject(json, "type")));
17949    if (json.has("effect"))
17950      res.setEffect(parseCodeableConcept(getJObject(json, "effect")));
17951    if (json.has("incidence"))
17952      res.setIncidence(parseCodeableConcept(getJObject(json, "incidence")));
17953    if (json.has("management"))
17954      res.setManagement(parseCodeableConcept(getJObject(json, "management")));
17955  }
17956
17957  protected MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(JsonObject json, MedicinalProductInteraction owner) throws IOException, FHIRFormatError {
17958    MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res = new MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent();
17959    parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentProperties(json, owner, res);
17960    return res;
17961  }
17962
17963  protected void parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentProperties(JsonObject json, MedicinalProductInteraction owner, MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res) throws IOException, FHIRFormatError {
17964    parseBackboneElementProperties(json, res);
17965    Type item = parseType("item", json);
17966    if (item != null)
17967      res.setItem(item);
17968  }
17969
17970  protected MedicinalProductManufactured parseMedicinalProductManufactured(JsonObject json) throws IOException, FHIRFormatError {
17971    MedicinalProductManufactured res = new MedicinalProductManufactured();
17972    parseMedicinalProductManufacturedProperties(json, res);
17973    return res;
17974  }
17975
17976  protected void parseMedicinalProductManufacturedProperties(JsonObject json, MedicinalProductManufactured res) throws IOException, FHIRFormatError {
17977    parseDomainResourceProperties(json, res);
17978    if (json.has("manufacturedDoseForm"))
17979      res.setManufacturedDoseForm(parseCodeableConcept(getJObject(json, "manufacturedDoseForm")));
17980    if (json.has("unitOfPresentation"))
17981      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
17982    if (json.has("quantity"))
17983      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
17984    if (json.has("manufacturer")) {
17985      JsonArray array = json.getAsJsonArray("manufacturer");
17986      for (int i = 0; i < array.size(); i++) {
17987        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17988      }
17989    };
17990    if (json.has("ingredient")) {
17991      JsonArray array = json.getAsJsonArray("ingredient");
17992      for (int i = 0; i < array.size(); i++) {
17993        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
17994      }
17995    };
17996    if (json.has("physicalCharacteristics"))
17997      res.setPhysicalCharacteristics(parseProdCharacteristic(getJObject(json, "physicalCharacteristics")));
17998    if (json.has("otherCharacteristics")) {
17999      JsonArray array = json.getAsJsonArray("otherCharacteristics");
18000      for (int i = 0; i < array.size(); i++) {
18001        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18002      }
18003    };
18004  }
18005
18006  protected MedicinalProductPackaged parseMedicinalProductPackaged(JsonObject json) throws IOException, FHIRFormatError {
18007    MedicinalProductPackaged res = new MedicinalProductPackaged();
18008    parseMedicinalProductPackagedProperties(json, res);
18009    return res;
18010  }
18011
18012  protected void parseMedicinalProductPackagedProperties(JsonObject json, MedicinalProductPackaged res) throws IOException, FHIRFormatError {
18013    parseDomainResourceProperties(json, res);
18014    if (json.has("identifier")) {
18015      JsonArray array = json.getAsJsonArray("identifier");
18016      for (int i = 0; i < array.size(); i++) {
18017        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18018      }
18019    };
18020    if (json.has("subject")) {
18021      JsonArray array = json.getAsJsonArray("subject");
18022      for (int i = 0; i < array.size(); i++) {
18023        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
18024      }
18025    };
18026    if (json.has("description"))
18027      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18028    if (json.has("_description"))
18029      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18030    if (json.has("legalStatusOfSupply"))
18031      res.setLegalStatusOfSupply(parseCodeableConcept(getJObject(json, "legalStatusOfSupply")));
18032    if (json.has("marketingStatus")) {
18033      JsonArray array = json.getAsJsonArray("marketingStatus");
18034      for (int i = 0; i < array.size(); i++) {
18035        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
18036      }
18037    };
18038    if (json.has("marketingAuthorization"))
18039      res.setMarketingAuthorization(parseReference(getJObject(json, "marketingAuthorization")));
18040    if (json.has("manufacturer")) {
18041      JsonArray array = json.getAsJsonArray("manufacturer");
18042      for (int i = 0; i < array.size(); i++) {
18043        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
18044      }
18045    };
18046    if (json.has("batchIdentifier")) {
18047      JsonArray array = json.getAsJsonArray("batchIdentifier");
18048      for (int i = 0; i < array.size(); i++) {
18049        res.getBatchIdentifier().add(parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(array.get(i).getAsJsonObject(), res));
18050      }
18051    };
18052    if (json.has("packageItem")) {
18053      JsonArray array = json.getAsJsonArray("packageItem");
18054      for (int i = 0; i < array.size(); i++) {
18055        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), res));
18056      }
18057    };
18058  }
18059
18060  protected MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
18061    MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res = new MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent();
18062    parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(json, owner, res);
18063    return res;
18064  }
18065
18066  protected void parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res) throws IOException, FHIRFormatError {
18067    parseBackboneElementProperties(json, res);
18068    if (json.has("outerPackaging"))
18069      res.setOuterPackaging(parseIdentifier(getJObject(json, "outerPackaging")));
18070    if (json.has("immediatePackaging"))
18071      res.setImmediatePackaging(parseIdentifier(getJObject(json, "immediatePackaging")));
18072  }
18073
18074  protected MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
18075    MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res = new MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent();
18076    parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(json, owner, res);
18077    return res;
18078  }
18079
18080  protected void parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res) throws IOException, FHIRFormatError {
18081    parseBackboneElementProperties(json, res);
18082    if (json.has("identifier")) {
18083      JsonArray array = json.getAsJsonArray("identifier");
18084      for (int i = 0; i < array.size(); i++) {
18085        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18086      }
18087    };
18088    if (json.has("type"))
18089      res.setType(parseCodeableConcept(getJObject(json, "type")));
18090    if (json.has("quantity"))
18091      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18092    if (json.has("material")) {
18093      JsonArray array = json.getAsJsonArray("material");
18094      for (int i = 0; i < array.size(); i++) {
18095        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18096      }
18097    };
18098    if (json.has("alternateMaterial")) {
18099      JsonArray array = json.getAsJsonArray("alternateMaterial");
18100      for (int i = 0; i < array.size(); i++) {
18101        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18102      }
18103    };
18104    if (json.has("device")) {
18105      JsonArray array = json.getAsJsonArray("device");
18106      for (int i = 0; i < array.size(); i++) {
18107        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
18108      }
18109    };
18110    if (json.has("manufacturedItem")) {
18111      JsonArray array = json.getAsJsonArray("manufacturedItem");
18112      for (int i = 0; i < array.size(); i++) {
18113        res.getManufacturedItem().add(parseReference(array.get(i).getAsJsonObject()));
18114      }
18115    };
18116    if (json.has("packageItem")) {
18117      JsonArray array = json.getAsJsonArray("packageItem");
18118      for (int i = 0; i < array.size(); i++) {
18119        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), owner));
18120      }
18121    };
18122    if (json.has("physicalCharacteristics"))
18123      res.setPhysicalCharacteristics(parseProdCharacteristic(getJObject(json, "physicalCharacteristics")));
18124    if (json.has("otherCharacteristics")) {
18125      JsonArray array = json.getAsJsonArray("otherCharacteristics");
18126      for (int i = 0; i < array.size(); i++) {
18127        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18128      }
18129    };
18130    if (json.has("shelfLifeStorage")) {
18131      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
18132      for (int i = 0; i < array.size(); i++) {
18133        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
18134      }
18135    };
18136    if (json.has("manufacturer")) {
18137      JsonArray array = json.getAsJsonArray("manufacturer");
18138      for (int i = 0; i < array.size(); i++) {
18139        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
18140      }
18141    };
18142  }
18143
18144  protected MedicinalProductPharmaceutical parseMedicinalProductPharmaceutical(JsonObject json) throws IOException, FHIRFormatError {
18145    MedicinalProductPharmaceutical res = new MedicinalProductPharmaceutical();
18146    parseMedicinalProductPharmaceuticalProperties(json, res);
18147    return res;
18148  }
18149
18150  protected void parseMedicinalProductPharmaceuticalProperties(JsonObject json, MedicinalProductPharmaceutical res) throws IOException, FHIRFormatError {
18151    parseDomainResourceProperties(json, res);
18152    if (json.has("identifier")) {
18153      JsonArray array = json.getAsJsonArray("identifier");
18154      for (int i = 0; i < array.size(); i++) {
18155        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18156      }
18157    };
18158    if (json.has("administrableDoseForm"))
18159      res.setAdministrableDoseForm(parseCodeableConcept(getJObject(json, "administrableDoseForm")));
18160    if (json.has("unitOfPresentation"))
18161      res.setUnitOfPresentation(parseCodeableConcept(getJObject(json, "unitOfPresentation")));
18162    if (json.has("ingredient")) {
18163      JsonArray array = json.getAsJsonArray("ingredient");
18164      for (int i = 0; i < array.size(); i++) {
18165        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
18166      }
18167    };
18168    if (json.has("device")) {
18169      JsonArray array = json.getAsJsonArray("device");
18170      for (int i = 0; i < array.size(); i++) {
18171        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
18172      }
18173    };
18174    if (json.has("characteristics")) {
18175      JsonArray array = json.getAsJsonArray("characteristics");
18176      for (int i = 0; i < array.size(); i++) {
18177        res.getCharacteristics().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(array.get(i).getAsJsonObject(), res));
18178      }
18179    };
18180    if (json.has("routeOfAdministration")) {
18181      JsonArray array = json.getAsJsonArray("routeOfAdministration");
18182      for (int i = 0; i < array.size(); i++) {
18183        res.getRouteOfAdministration().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(array.get(i).getAsJsonObject(), res));
18184      }
18185    };
18186  }
18187
18188  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
18189    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent();
18190    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(json, owner, res);
18191    return res;
18192  }
18193
18194  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res) throws IOException, FHIRFormatError {
18195    parseBackboneElementProperties(json, res);
18196    if (json.has("code"))
18197      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18198    if (json.has("status"))
18199      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
18200  }
18201
18202  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
18203    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
18204    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(json, owner, res);
18205    return res;
18206  }
18207
18208  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
18209    parseBackboneElementProperties(json, res);
18210    if (json.has("code"))
18211      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18212    if (json.has("firstDose"))
18213      res.setFirstDose(parseQuantity(getJObject(json, "firstDose")));
18214    if (json.has("maxSingleDose"))
18215      res.setMaxSingleDose(parseQuantity(getJObject(json, "maxSingleDose")));
18216    if (json.has("maxDosePerDay"))
18217      res.setMaxDosePerDay(parseQuantity(getJObject(json, "maxDosePerDay")));
18218    if (json.has("maxDosePerTreatmentPeriod"))
18219      res.setMaxDosePerTreatmentPeriod(parseRatio(getJObject(json, "maxDosePerTreatmentPeriod")));
18220    if (json.has("maxTreatmentPeriod"))
18221      res.setMaxTreatmentPeriod(parseDuration(getJObject(json, "maxTreatmentPeriod")));
18222    if (json.has("targetSpecies")) {
18223      JsonArray array = json.getAsJsonArray("targetSpecies");
18224      for (int i = 0; i < array.size(); i++) {
18225        res.getTargetSpecies().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject(), owner));
18226      }
18227    };
18228  }
18229
18230  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
18231    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
18232    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(json, owner, res);
18233    return res;
18234  }
18235
18236  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
18237    parseBackboneElementProperties(json, res);
18238    if (json.has("code"))
18239      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18240    if (json.has("withdrawalPeriod")) {
18241      JsonArray array = json.getAsJsonArray("withdrawalPeriod");
18242      for (int i = 0; i < array.size(); i++) {
18243        res.getWithdrawalPeriod().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject(), owner));
18244      }
18245    };
18246  }
18247
18248  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
18249    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
18250    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, owner, res);
18251    return res;
18252  }
18253
18254  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
18255    parseBackboneElementProperties(json, res);
18256    if (json.has("tissue"))
18257      res.setTissue(parseCodeableConcept(getJObject(json, "tissue")));
18258    if (json.has("value"))
18259      res.setValue(parseQuantity(getJObject(json, "value")));
18260    if (json.has("supportingInformation"))
18261      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
18262    if (json.has("_supportingInformation"))
18263      parseElementProperties(getJObject(json, "_supportingInformation"), res.getSupportingInformationElement());
18264  }
18265
18266  protected MedicinalProductUndesirableEffect parseMedicinalProductUndesirableEffect(JsonObject json) throws IOException, FHIRFormatError {
18267    MedicinalProductUndesirableEffect res = new MedicinalProductUndesirableEffect();
18268    parseMedicinalProductUndesirableEffectProperties(json, res);
18269    return res;
18270  }
18271
18272  protected void parseMedicinalProductUndesirableEffectProperties(JsonObject json, MedicinalProductUndesirableEffect res) throws IOException, FHIRFormatError {
18273    parseDomainResourceProperties(json, res);
18274    if (json.has("subject")) {
18275      JsonArray array = json.getAsJsonArray("subject");
18276      for (int i = 0; i < array.size(); i++) {
18277        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
18278      }
18279    };
18280    if (json.has("symptomConditionEffect"))
18281      res.setSymptomConditionEffect(parseCodeableConcept(getJObject(json, "symptomConditionEffect")));
18282    if (json.has("classification"))
18283      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
18284    if (json.has("frequencyOfOccurrence"))
18285      res.setFrequencyOfOccurrence(parseCodeableConcept(getJObject(json, "frequencyOfOccurrence")));
18286    if (json.has("population")) {
18287      JsonArray array = json.getAsJsonArray("population");
18288      for (int i = 0; i < array.size(); i++) {
18289        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
18290      }
18291    };
18292  }
18293
18294  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
18295    MessageDefinition res = new MessageDefinition();
18296    parseMessageDefinitionProperties(json, res);
18297    return res;
18298  }
18299
18300  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
18301    parseDomainResourceProperties(json, res);
18302    if (json.has("url"))
18303      res.setUrlElement(parseUri(json.get("url").getAsString()));
18304    if (json.has("_url"))
18305      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
18306    if (json.has("identifier")) {
18307      JsonArray array = json.getAsJsonArray("identifier");
18308      for (int i = 0; i < array.size(); i++) {
18309        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18310      }
18311    };
18312    if (json.has("version"))
18313      res.setVersionElement(parseString(json.get("version").getAsString()));
18314    if (json.has("_version"))
18315      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
18316    if (json.has("name"))
18317      res.setNameElement(parseString(json.get("name").getAsString()));
18318    if (json.has("_name"))
18319      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18320    if (json.has("title"))
18321      res.setTitleElement(parseString(json.get("title").getAsString()));
18322    if (json.has("_title"))
18323      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
18324    if (json.has("replaces")) {
18325      JsonArray array = json.getAsJsonArray("replaces");
18326      for (int i = 0; i < array.size(); i++) {
18327        if (array.get(i).isJsonNull()) {
18328          res.getReplaces().add(new CanonicalType());
18329        } else {
18330          res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
18331        }
18332      }
18333    };
18334    if (json.has("_replaces")) {
18335      JsonArray array = json.getAsJsonArray("_replaces");
18336      for (int i = 0; i < array.size(); i++) {
18337        if (i == res.getReplaces().size())
18338          res.getReplaces().add(parseCanonical(null));
18339        if (array.get(i) instanceof JsonObject) 
18340          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
18341      }
18342    };
18343    if (json.has("status"))
18344      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18345    if (json.has("_status"))
18346      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18347    if (json.has("experimental"))
18348      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
18349    if (json.has("_experimental"))
18350      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
18351    if (json.has("date"))
18352      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18353    if (json.has("_date"))
18354      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
18355    if (json.has("publisher"))
18356      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18357    if (json.has("_publisher"))
18358      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
18359    if (json.has("contact")) {
18360      JsonArray array = json.getAsJsonArray("contact");
18361      for (int i = 0; i < array.size(); i++) {
18362        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18363      }
18364    };
18365    if (json.has("description"))
18366      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18367    if (json.has("_description"))
18368      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18369    if (json.has("useContext")) {
18370      JsonArray array = json.getAsJsonArray("useContext");
18371      for (int i = 0; i < array.size(); i++) {
18372        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18373      }
18374    };
18375    if (json.has("jurisdiction")) {
18376      JsonArray array = json.getAsJsonArray("jurisdiction");
18377      for (int i = 0; i < array.size(); i++) {
18378        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18379      }
18380    };
18381    if (json.has("purpose"))
18382      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
18383    if (json.has("_purpose"))
18384      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
18385    if (json.has("copyright"))
18386      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
18387    if (json.has("_copyright"))
18388      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
18389    if (json.has("base"))
18390      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
18391    if (json.has("_base"))
18392      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
18393    if (json.has("parent")) {
18394      JsonArray array = json.getAsJsonArray("parent");
18395      for (int i = 0; i < array.size(); i++) {
18396        if (array.get(i).isJsonNull()) {
18397          res.getParent().add(new CanonicalType());
18398        } else {
18399          res.getParent().add(parseCanonical(array.get(i).getAsString()));
18400        }
18401      }
18402    };
18403    if (json.has("_parent")) {
18404      JsonArray array = json.getAsJsonArray("_parent");
18405      for (int i = 0; i < array.size(); i++) {
18406        if (i == res.getParent().size())
18407          res.getParent().add(parseCanonical(null));
18408        if (array.get(i) instanceof JsonObject) 
18409          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
18410      }
18411    };
18412    Type event = parseType("event", json);
18413    if (event != null)
18414      res.setEvent(event);
18415    if (json.has("category"))
18416      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
18417    if (json.has("_category"))
18418      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
18419    if (json.has("focus")) {
18420      JsonArray array = json.getAsJsonArray("focus");
18421      for (int i = 0; i < array.size(); i++) {
18422        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
18423      }
18424    };
18425    if (json.has("responseRequired"))
18426      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(), MessageDefinition.MessageheaderResponseRequest.NULL, new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
18427    if (json.has("_responseRequired"))
18428      parseElementProperties(getJObject(json, "_responseRequired"), res.getResponseRequiredElement());
18429    if (json.has("allowedResponse")) {
18430      JsonArray array = json.getAsJsonArray("allowedResponse");
18431      for (int i = 0; i < array.size(); i++) {
18432        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
18433      }
18434    };
18435    if (json.has("graph")) {
18436      JsonArray array = json.getAsJsonArray("graph");
18437      for (int i = 0; i < array.size(); i++) {
18438        if (array.get(i).isJsonNull()) {
18439          res.getGraph().add(new CanonicalType());
18440        } else {
18441          res.getGraph().add(parseCanonical(array.get(i).getAsString()));
18442        }
18443      }
18444    };
18445    if (json.has("_graph")) {
18446      JsonArray array = json.getAsJsonArray("_graph");
18447      for (int i = 0; i < array.size(); i++) {
18448        if (i == res.getGraph().size())
18449          res.getGraph().add(parseCanonical(null));
18450        if (array.get(i) instanceof JsonObject) 
18451          parseElementProperties(array.get(i).getAsJsonObject(), res.getGraph().get(i));
18452      }
18453    };
18454  }
18455
18456  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
18457    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
18458    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
18459    return res;
18460  }
18461
18462  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
18463    parseBackboneElementProperties(json, res);
18464    if (json.has("code"))
18465      res.setCodeElement(parseCode(json.get("code").getAsString()));
18466    if (json.has("_code"))
18467      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
18468    if (json.has("profile"))
18469      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
18470    if (json.has("_profile"))
18471      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
18472    if (json.has("min"))
18473      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
18474    if (json.has("_min"))
18475      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
18476    if (json.has("max"))
18477      res.setMaxElement(parseString(json.get("max").getAsString()));
18478    if (json.has("_max"))
18479      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
18480  }
18481
18482  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
18483    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
18484    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
18485    return res;
18486  }
18487
18488  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
18489    parseBackboneElementProperties(json, res);
18490    if (json.has("message"))
18491      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
18492    if (json.has("_message"))
18493      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
18494    if (json.has("situation"))
18495      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
18496    if (json.has("_situation"))
18497      parseElementProperties(getJObject(json, "_situation"), res.getSituationElement());
18498  }
18499
18500  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
18501    MessageHeader res = new MessageHeader();
18502    parseMessageHeaderProperties(json, res);
18503    return res;
18504  }
18505
18506  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
18507    parseDomainResourceProperties(json, res);
18508    Type event = parseType("event", json);
18509    if (event != null)
18510      res.setEvent(event);
18511    if (json.has("destination")) {
18512      JsonArray array = json.getAsJsonArray("destination");
18513      for (int i = 0; i < array.size(); i++) {
18514        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
18515      }
18516    };
18517    if (json.has("sender"))
18518      res.setSender(parseReference(getJObject(json, "sender")));
18519    if (json.has("enterer"))
18520      res.setEnterer(parseReference(getJObject(json, "enterer")));
18521    if (json.has("author"))
18522      res.setAuthor(parseReference(getJObject(json, "author")));
18523    if (json.has("source"))
18524      res.setSource(parseMessageHeaderMessageSourceComponent(getJObject(json, "source"), res));
18525    if (json.has("responsible"))
18526      res.setResponsible(parseReference(getJObject(json, "responsible")));
18527    if (json.has("reason"))
18528      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
18529    if (json.has("response"))
18530      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(getJObject(json, "response"), res));
18531    if (json.has("focus")) {
18532      JsonArray array = json.getAsJsonArray("focus");
18533      for (int i = 0; i < array.size(); i++) {
18534        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18535      }
18536    };
18537    if (json.has("definition"))
18538      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
18539    if (json.has("_definition"))
18540      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
18541  }
18542
18543  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18544    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
18545    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
18546    return res;
18547  }
18548
18549  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
18550    parseBackboneElementProperties(json, res);
18551    if (json.has("name"))
18552      res.setNameElement(parseString(json.get("name").getAsString()));
18553    if (json.has("_name"))
18554      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18555    if (json.has("target"))
18556      res.setTarget(parseReference(getJObject(json, "target")));
18557    if (json.has("endpoint"))
18558      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18559    if (json.has("_endpoint"))
18560      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
18561    if (json.has("receiver"))
18562      res.setReceiver(parseReference(getJObject(json, "receiver")));
18563  }
18564
18565  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18566    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
18567    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
18568    return res;
18569  }
18570
18571  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
18572    parseBackboneElementProperties(json, res);
18573    if (json.has("name"))
18574      res.setNameElement(parseString(json.get("name").getAsString()));
18575    if (json.has("_name"))
18576      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18577    if (json.has("software"))
18578      res.setSoftwareElement(parseString(json.get("software").getAsString()));
18579    if (json.has("_software"))
18580      parseElementProperties(getJObject(json, "_software"), res.getSoftwareElement());
18581    if (json.has("version"))
18582      res.setVersionElement(parseString(json.get("version").getAsString()));
18583    if (json.has("_version"))
18584      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
18585    if (json.has("contact"))
18586      res.setContact(parseContactPoint(getJObject(json, "contact")));
18587    if (json.has("endpoint"))
18588      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18589    if (json.has("_endpoint"))
18590      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
18591  }
18592
18593  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18594    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
18595    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
18596    return res;
18597  }
18598
18599  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
18600    parseBackboneElementProperties(json, res);
18601    if (json.has("identifier"))
18602      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
18603    if (json.has("_identifier"))
18604      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
18605    if (json.has("code"))
18606      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
18607    if (json.has("_code"))
18608      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
18609    if (json.has("details"))
18610      res.setDetails(parseReference(getJObject(json, "details")));
18611  }
18612
18613  protected MolecularSequence parseMolecularSequence(JsonObject json) throws IOException, FHIRFormatError {
18614    MolecularSequence res = new MolecularSequence();
18615    parseMolecularSequenceProperties(json, res);
18616    return res;
18617  }
18618
18619  protected void parseMolecularSequenceProperties(JsonObject json, MolecularSequence res) throws IOException, FHIRFormatError {
18620    parseDomainResourceProperties(json, res);
18621    if (json.has("identifier")) {
18622      JsonArray array = json.getAsJsonArray("identifier");
18623      for (int i = 0; i < array.size(); i++) {
18624        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18625      }
18626    };
18627    if (json.has("type"))
18628      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.SequenceType.NULL, new MolecularSequence.SequenceTypeEnumFactory()));
18629    if (json.has("_type"))
18630      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
18631    if (json.has("coordinateSystem"))
18632      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
18633    if (json.has("_coordinateSystem"))
18634      parseElementProperties(getJObject(json, "_coordinateSystem"), res.getCoordinateSystemElement());
18635    if (json.has("patient"))
18636      res.setPatient(parseReference(getJObject(json, "patient")));
18637    if (json.has("specimen"))
18638      res.setSpecimen(parseReference(getJObject(json, "specimen")));
18639    if (json.has("device"))
18640      res.setDevice(parseReference(getJObject(json, "device")));
18641    if (json.has("performer"))
18642      res.setPerformer(parseReference(getJObject(json, "performer")));
18643    if (json.has("quantity"))
18644      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18645    if (json.has("referenceSeq"))
18646      res.setReferenceSeq(parseMolecularSequenceMolecularSequenceReferenceSeqComponent(getJObject(json, "referenceSeq"), res));
18647    if (json.has("variant")) {
18648      JsonArray array = json.getAsJsonArray("variant");
18649      for (int i = 0; i < array.size(); i++) {
18650        res.getVariant().add(parseMolecularSequenceMolecularSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
18651      }
18652    };
18653    if (json.has("observedSeq"))
18654      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
18655    if (json.has("_observedSeq"))
18656      parseElementProperties(getJObject(json, "_observedSeq"), res.getObservedSeqElement());
18657    if (json.has("quality")) {
18658      JsonArray array = json.getAsJsonArray("quality");
18659      for (int i = 0; i < array.size(); i++) {
18660        res.getQuality().add(parseMolecularSequenceMolecularSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
18661      }
18662    };
18663    if (json.has("readCoverage"))
18664      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
18665    if (json.has("_readCoverage"))
18666      parseElementProperties(getJObject(json, "_readCoverage"), res.getReadCoverageElement());
18667    if (json.has("repository")) {
18668      JsonArray array = json.getAsJsonArray("repository");
18669      for (int i = 0; i < array.size(); i++) {
18670        res.getRepository().add(parseMolecularSequenceMolecularSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
18671      }
18672    };
18673    if (json.has("pointer")) {
18674      JsonArray array = json.getAsJsonArray("pointer");
18675      for (int i = 0; i < array.size(); i++) {
18676        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
18677      }
18678    };
18679    if (json.has("structureVariant")) {
18680      JsonArray array = json.getAsJsonArray("structureVariant");
18681      for (int i = 0; i < array.size(); i++) {
18682        res.getStructureVariant().add(parseMolecularSequenceMolecularSequenceStructureVariantComponent(array.get(i).getAsJsonObject(), res));
18683      }
18684    };
18685  }
18686
18687  protected MolecularSequence.MolecularSequenceReferenceSeqComponent parseMolecularSequenceMolecularSequenceReferenceSeqComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18688    MolecularSequence.MolecularSequenceReferenceSeqComponent res = new MolecularSequence.MolecularSequenceReferenceSeqComponent();
18689    parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(json, owner, res);
18690    return res;
18691  }
18692
18693  protected void parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
18694    parseBackboneElementProperties(json, res);
18695    if (json.has("chromosome"))
18696      res.setChromosome(parseCodeableConcept(getJObject(json, "chromosome")));
18697    if (json.has("genomeBuild"))
18698      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
18699    if (json.has("_genomeBuild"))
18700      parseElementProperties(getJObject(json, "_genomeBuild"), res.getGenomeBuildElement());
18701    if (json.has("orientation"))
18702      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(), MolecularSequence.OrientationType.NULL, new MolecularSequence.OrientationTypeEnumFactory()));
18703    if (json.has("_orientation"))
18704      parseElementProperties(getJObject(json, "_orientation"), res.getOrientationElement());
18705    if (json.has("referenceSeqId"))
18706      res.setReferenceSeqId(parseCodeableConcept(getJObject(json, "referenceSeqId")));
18707    if (json.has("referenceSeqPointer"))
18708      res.setReferenceSeqPointer(parseReference(getJObject(json, "referenceSeqPointer")));
18709    if (json.has("referenceSeqString"))
18710      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
18711    if (json.has("_referenceSeqString"))
18712      parseElementProperties(getJObject(json, "_referenceSeqString"), res.getReferenceSeqStringElement());
18713    if (json.has("strand"))
18714      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), MolecularSequence.StrandType.NULL, new MolecularSequence.StrandTypeEnumFactory()));
18715    if (json.has("_strand"))
18716      parseElementProperties(getJObject(json, "_strand"), res.getStrandElement());
18717    if (json.has("windowStart"))
18718      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
18719    if (json.has("_windowStart"))
18720      parseElementProperties(getJObject(json, "_windowStart"), res.getWindowStartElement());
18721    if (json.has("windowEnd"))
18722      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
18723    if (json.has("_windowEnd"))
18724      parseElementProperties(getJObject(json, "_windowEnd"), res.getWindowEndElement());
18725  }
18726
18727  protected MolecularSequence.MolecularSequenceVariantComponent parseMolecularSequenceMolecularSequenceVariantComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18728    MolecularSequence.MolecularSequenceVariantComponent res = new MolecularSequence.MolecularSequenceVariantComponent();
18729    parseMolecularSequenceMolecularSequenceVariantComponentProperties(json, owner, res);
18730    return res;
18731  }
18732
18733  protected void parseMolecularSequenceMolecularSequenceVariantComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceVariantComponent res) throws IOException, FHIRFormatError {
18734    parseBackboneElementProperties(json, res);
18735    if (json.has("start"))
18736      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18737    if (json.has("_start"))
18738      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
18739    if (json.has("end"))
18740      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18741    if (json.has("_end"))
18742      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
18743    if (json.has("observedAllele"))
18744      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
18745    if (json.has("_observedAllele"))
18746      parseElementProperties(getJObject(json, "_observedAllele"), res.getObservedAlleleElement());
18747    if (json.has("referenceAllele"))
18748      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
18749    if (json.has("_referenceAllele"))
18750      parseElementProperties(getJObject(json, "_referenceAllele"), res.getReferenceAlleleElement());
18751    if (json.has("cigar"))
18752      res.setCigarElement(parseString(json.get("cigar").getAsString()));
18753    if (json.has("_cigar"))
18754      parseElementProperties(getJObject(json, "_cigar"), res.getCigarElement());
18755    if (json.has("variantPointer"))
18756      res.setVariantPointer(parseReference(getJObject(json, "variantPointer")));
18757  }
18758
18759  protected MolecularSequence.MolecularSequenceQualityComponent parseMolecularSequenceMolecularSequenceQualityComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18760    MolecularSequence.MolecularSequenceQualityComponent res = new MolecularSequence.MolecularSequenceQualityComponent();
18761    parseMolecularSequenceMolecularSequenceQualityComponentProperties(json, owner, res);
18762    return res;
18763  }
18764
18765  protected void parseMolecularSequenceMolecularSequenceQualityComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceQualityComponent res) throws IOException, FHIRFormatError {
18766    parseBackboneElementProperties(json, res);
18767    if (json.has("type"))
18768      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.QualityType.NULL, new MolecularSequence.QualityTypeEnumFactory()));
18769    if (json.has("_type"))
18770      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
18771    if (json.has("standardSequence"))
18772      res.setStandardSequence(parseCodeableConcept(getJObject(json, "standardSequence")));
18773    if (json.has("start"))
18774      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18775    if (json.has("_start"))
18776      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
18777    if (json.has("end"))
18778      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18779    if (json.has("_end"))
18780      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
18781    if (json.has("score"))
18782      res.setScore(parseQuantity(getJObject(json, "score")));
18783    if (json.has("method"))
18784      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
18785    if (json.has("truthTP"))
18786      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
18787    if (json.has("_truthTP"))
18788      parseElementProperties(getJObject(json, "_truthTP"), res.getTruthTPElement());
18789    if (json.has("queryTP"))
18790      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
18791    if (json.has("_queryTP"))
18792      parseElementProperties(getJObject(json, "_queryTP"), res.getQueryTPElement());
18793    if (json.has("truthFN"))
18794      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
18795    if (json.has("_truthFN"))
18796      parseElementProperties(getJObject(json, "_truthFN"), res.getTruthFNElement());
18797    if (json.has("queryFP"))
18798      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
18799    if (json.has("_queryFP"))
18800      parseElementProperties(getJObject(json, "_queryFP"), res.getQueryFPElement());
18801    if (json.has("gtFP"))
18802      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
18803    if (json.has("_gtFP"))
18804      parseElementProperties(getJObject(json, "_gtFP"), res.getGtFPElement());
18805    if (json.has("precision"))
18806      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
18807    if (json.has("_precision"))
18808      parseElementProperties(getJObject(json, "_precision"), res.getPrecisionElement());
18809    if (json.has("recall"))
18810      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
18811    if (json.has("_recall"))
18812      parseElementProperties(getJObject(json, "_recall"), res.getRecallElement());
18813    if (json.has("fScore"))
18814      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
18815    if (json.has("_fScore"))
18816      parseElementProperties(getJObject(json, "_fScore"), res.getFScoreElement());
18817    if (json.has("roc"))
18818      res.setRoc(parseMolecularSequenceMolecularSequenceQualityRocComponent(getJObject(json, "roc"), owner));
18819  }
18820
18821  protected MolecularSequence.MolecularSequenceQualityRocComponent parseMolecularSequenceMolecularSequenceQualityRocComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18822    MolecularSequence.MolecularSequenceQualityRocComponent res = new MolecularSequence.MolecularSequenceQualityRocComponent();
18823    parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(json, owner, res);
18824    return res;
18825  }
18826
18827  protected void parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceQualityRocComponent res) throws IOException, FHIRFormatError {
18828    parseBackboneElementProperties(json, res);
18829    if (json.has("score")) {
18830      JsonArray array = json.getAsJsonArray("score");
18831      for (int i = 0; i < array.size(); i++) {
18832        if (array.get(i).isJsonNull()) {
18833          res.getScore().add(new IntegerType());
18834        } else {
18835          res.getScore().add(parseInteger(array.get(i).getAsLong()));
18836        }
18837      }
18838    };
18839    if (json.has("_score")) {
18840      JsonArray array = json.getAsJsonArray("_score");
18841      for (int i = 0; i < array.size(); i++) {
18842        if (i == res.getScore().size())
18843          res.getScore().add(parseInteger(null));
18844        if (array.get(i) instanceof JsonObject) 
18845          parseElementProperties(array.get(i).getAsJsonObject(), res.getScore().get(i));
18846      }
18847    };
18848    if (json.has("numTP")) {
18849      JsonArray array = json.getAsJsonArray("numTP");
18850      for (int i = 0; i < array.size(); i++) {
18851        if (array.get(i).isJsonNull()) {
18852          res.getNumTP().add(new IntegerType());
18853        } else {
18854          res.getNumTP().add(parseInteger(array.get(i).getAsLong()));
18855        }
18856      }
18857    };
18858    if (json.has("_numTP")) {
18859      JsonArray array = json.getAsJsonArray("_numTP");
18860      for (int i = 0; i < array.size(); i++) {
18861        if (i == res.getNumTP().size())
18862          res.getNumTP().add(parseInteger(null));
18863        if (array.get(i) instanceof JsonObject) 
18864          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumTP().get(i));
18865      }
18866    };
18867    if (json.has("numFP")) {
18868      JsonArray array = json.getAsJsonArray("numFP");
18869      for (int i = 0; i < array.size(); i++) {
18870        if (array.get(i).isJsonNull()) {
18871          res.getNumFP().add(new IntegerType());
18872        } else {
18873          res.getNumFP().add(parseInteger(array.get(i).getAsLong()));
18874        }
18875      }
18876    };
18877    if (json.has("_numFP")) {
18878      JsonArray array = json.getAsJsonArray("_numFP");
18879      for (int i = 0; i < array.size(); i++) {
18880        if (i == res.getNumFP().size())
18881          res.getNumFP().add(parseInteger(null));
18882        if (array.get(i) instanceof JsonObject) 
18883          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFP().get(i));
18884      }
18885    };
18886    if (json.has("numFN")) {
18887      JsonArray array = json.getAsJsonArray("numFN");
18888      for (int i = 0; i < array.size(); i++) {
18889        if (array.get(i).isJsonNull()) {
18890          res.getNumFN().add(new IntegerType());
18891        } else {
18892          res.getNumFN().add(parseInteger(array.get(i).getAsLong()));
18893        }
18894      }
18895    };
18896    if (json.has("_numFN")) {
18897      JsonArray array = json.getAsJsonArray("_numFN");
18898      for (int i = 0; i < array.size(); i++) {
18899        if (i == res.getNumFN().size())
18900          res.getNumFN().add(parseInteger(null));
18901        if (array.get(i) instanceof JsonObject) 
18902          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFN().get(i));
18903      }
18904    };
18905    if (json.has("precision")) {
18906      JsonArray array = json.getAsJsonArray("precision");
18907      for (int i = 0; i < array.size(); i++) {
18908        if (array.get(i).isJsonNull()) {
18909          res.getPrecision().add(new DecimalType());
18910        } else {
18911          res.getPrecision().add(parseDecimal(array.get(i).getAsBigDecimal()));
18912        }
18913      }
18914    };
18915    if (json.has("_precision")) {
18916      JsonArray array = json.getAsJsonArray("_precision");
18917      for (int i = 0; i < array.size(); i++) {
18918        if (i == res.getPrecision().size())
18919          res.getPrecision().add(parseDecimal(null));
18920        if (array.get(i) instanceof JsonObject) 
18921          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrecision().get(i));
18922      }
18923    };
18924    if (json.has("sensitivity")) {
18925      JsonArray array = json.getAsJsonArray("sensitivity");
18926      for (int i = 0; i < array.size(); i++) {
18927        if (array.get(i).isJsonNull()) {
18928          res.getSensitivity().add(new DecimalType());
18929        } else {
18930          res.getSensitivity().add(parseDecimal(array.get(i).getAsBigDecimal()));
18931        }
18932      }
18933    };
18934    if (json.has("_sensitivity")) {
18935      JsonArray array = json.getAsJsonArray("_sensitivity");
18936      for (int i = 0; i < array.size(); i++) {
18937        if (i == res.getSensitivity().size())
18938          res.getSensitivity().add(parseDecimal(null));
18939        if (array.get(i) instanceof JsonObject) 
18940          parseElementProperties(array.get(i).getAsJsonObject(), res.getSensitivity().get(i));
18941      }
18942    };
18943    if (json.has("fMeasure")) {
18944      JsonArray array = json.getAsJsonArray("fMeasure");
18945      for (int i = 0; i < array.size(); i++) {
18946        if (array.get(i).isJsonNull()) {
18947          res.getFMeasure().add(new DecimalType());
18948        } else {
18949          res.getFMeasure().add(parseDecimal(array.get(i).getAsBigDecimal()));
18950        }
18951      }
18952    };
18953    if (json.has("_fMeasure")) {
18954      JsonArray array = json.getAsJsonArray("_fMeasure");
18955      for (int i = 0; i < array.size(); i++) {
18956        if (i == res.getFMeasure().size())
18957          res.getFMeasure().add(parseDecimal(null));
18958        if (array.get(i) instanceof JsonObject) 
18959          parseElementProperties(array.get(i).getAsJsonObject(), res.getFMeasure().get(i));
18960      }
18961    };
18962  }
18963
18964  protected MolecularSequence.MolecularSequenceRepositoryComponent parseMolecularSequenceMolecularSequenceRepositoryComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18965    MolecularSequence.MolecularSequenceRepositoryComponent res = new MolecularSequence.MolecularSequenceRepositoryComponent();
18966    parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(json, owner, res);
18967    return res;
18968  }
18969
18970  protected void parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceRepositoryComponent res) throws IOException, FHIRFormatError {
18971    parseBackboneElementProperties(json, res);
18972    if (json.has("type"))
18973      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.RepositoryType.NULL, new MolecularSequence.RepositoryTypeEnumFactory()));
18974    if (json.has("_type"))
18975      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
18976    if (json.has("url"))
18977      res.setUrlElement(parseUri(json.get("url").getAsString()));
18978    if (json.has("_url"))
18979      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
18980    if (json.has("name"))
18981      res.setNameElement(parseString(json.get("name").getAsString()));
18982    if (json.has("_name"))
18983      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18984    if (json.has("datasetId"))
18985      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
18986    if (json.has("_datasetId"))
18987      parseElementProperties(getJObject(json, "_datasetId"), res.getDatasetIdElement());
18988    if (json.has("variantsetId"))
18989      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
18990    if (json.has("_variantsetId"))
18991      parseElementProperties(getJObject(json, "_variantsetId"), res.getVariantsetIdElement());
18992    if (json.has("readsetId"))
18993      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
18994    if (json.has("_readsetId"))
18995      parseElementProperties(getJObject(json, "_readsetId"), res.getReadsetIdElement());
18996  }
18997
18998  protected MolecularSequence.MolecularSequenceStructureVariantComponent parseMolecularSequenceMolecularSequenceStructureVariantComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18999    MolecularSequence.MolecularSequenceStructureVariantComponent res = new MolecularSequence.MolecularSequenceStructureVariantComponent();
19000    parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(json, owner, res);
19001    return res;
19002  }
19003
19004  protected void parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantComponent res) throws IOException, FHIRFormatError {
19005    parseBackboneElementProperties(json, res);
19006    if (json.has("variantType"))
19007      res.setVariantType(parseCodeableConcept(getJObject(json, "variantType")));
19008    if (json.has("exact"))
19009      res.setExactElement(parseBoolean(json.get("exact").getAsBoolean()));
19010    if (json.has("_exact"))
19011      parseElementProperties(getJObject(json, "_exact"), res.getExactElement());
19012    if (json.has("length"))
19013      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
19014    if (json.has("_length"))
19015      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
19016    if (json.has("outer"))
19017      res.setOuter(parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(getJObject(json, "outer"), owner));
19018    if (json.has("inner"))
19019      res.setInner(parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(getJObject(json, "inner"), owner));
19020  }
19021
19022  protected MolecularSequence.MolecularSequenceStructureVariantOuterComponent parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
19023    MolecularSequence.MolecularSequenceStructureVariantOuterComponent res = new MolecularSequence.MolecularSequenceStructureVariantOuterComponent();
19024    parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(json, owner, res);
19025    return res;
19026  }
19027
19028  protected void parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantOuterComponent res) throws IOException, FHIRFormatError {
19029    parseBackboneElementProperties(json, res);
19030    if (json.has("start"))
19031      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19032    if (json.has("_start"))
19033      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
19034    if (json.has("end"))
19035      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19036    if (json.has("_end"))
19037      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
19038  }
19039
19040  protected MolecularSequence.MolecularSequenceStructureVariantInnerComponent parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
19041    MolecularSequence.MolecularSequenceStructureVariantInnerComponent res = new MolecularSequence.MolecularSequenceStructureVariantInnerComponent();
19042    parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(json, owner, res);
19043    return res;
19044  }
19045
19046  protected void parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantInnerComponent res) throws IOException, FHIRFormatError {
19047    parseBackboneElementProperties(json, res);
19048    if (json.has("start"))
19049      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19050    if (json.has("_start"))
19051      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
19052    if (json.has("end"))
19053      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19054    if (json.has("_end"))
19055      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
19056  }
19057
19058  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
19059    NamingSystem res = new NamingSystem();
19060    parseNamingSystemProperties(json, res);
19061    return res;
19062  }
19063
19064  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
19065    parseDomainResourceProperties(json, res);
19066    if (json.has("name"))
19067      res.setNameElement(parseString(json.get("name").getAsString()));
19068    if (json.has("_name"))
19069      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19070    if (json.has("status"))
19071      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19072    if (json.has("_status"))
19073      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19074    if (json.has("kind"))
19075      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
19076    if (json.has("_kind"))
19077      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
19078    if (json.has("date"))
19079      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19080    if (json.has("_date"))
19081      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
19082    if (json.has("publisher"))
19083      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19084    if (json.has("_publisher"))
19085      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
19086    if (json.has("contact")) {
19087      JsonArray array = json.getAsJsonArray("contact");
19088      for (int i = 0; i < array.size(); i++) {
19089        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19090      }
19091    };
19092    if (json.has("responsible"))
19093      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
19094    if (json.has("_responsible"))
19095      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
19096    if (json.has("type"))
19097      res.setType(parseCodeableConcept(getJObject(json, "type")));
19098    if (json.has("description"))
19099      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19100    if (json.has("_description"))
19101      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19102    if (json.has("useContext")) {
19103      JsonArray array = json.getAsJsonArray("useContext");
19104      for (int i = 0; i < array.size(); i++) {
19105        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19106      }
19107    };
19108    if (json.has("jurisdiction")) {
19109      JsonArray array = json.getAsJsonArray("jurisdiction");
19110      for (int i = 0; i < array.size(); i++) {
19111        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19112      }
19113    };
19114    if (json.has("usage"))
19115      res.setUsageElement(parseString(json.get("usage").getAsString()));
19116    if (json.has("_usage"))
19117      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
19118    if (json.has("uniqueId")) {
19119      JsonArray array = json.getAsJsonArray("uniqueId");
19120      for (int i = 0; i < array.size(); i++) {
19121        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
19122      }
19123    };
19124  }
19125
19126  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
19127    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
19128    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
19129    return res;
19130  }
19131
19132  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
19133    parseBackboneElementProperties(json, res);
19134    if (json.has("type"))
19135      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
19136    if (json.has("_type"))
19137      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
19138    if (json.has("value"))
19139      res.setValueElement(parseString(json.get("value").getAsString()));
19140    if (json.has("_value"))
19141      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
19142    if (json.has("preferred"))
19143      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
19144    if (json.has("_preferred"))
19145      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
19146    if (json.has("comment"))
19147      res.setCommentElement(parseString(json.get("comment").getAsString()));
19148    if (json.has("_comment"))
19149      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
19150    if (json.has("period"))
19151      res.setPeriod(parsePeriod(getJObject(json, "period")));
19152  }
19153
19154  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
19155    NutritionOrder res = new NutritionOrder();
19156    parseNutritionOrderProperties(json, res);
19157    return res;
19158  }
19159
19160  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
19161    parseDomainResourceProperties(json, res);
19162    if (json.has("identifier")) {
19163      JsonArray array = json.getAsJsonArray("identifier");
19164      for (int i = 0; i < array.size(); i++) {
19165        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19166      }
19167    };
19168    if (json.has("instantiatesCanonical")) {
19169      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
19170      for (int i = 0; i < array.size(); i++) {
19171        if (array.get(i).isJsonNull()) {
19172          res.getInstantiatesCanonical().add(new CanonicalType());
19173        } else {
19174          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
19175        }
19176      }
19177    };
19178    if (json.has("_instantiatesCanonical")) {
19179      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
19180      for (int i = 0; i < array.size(); i++) {
19181        if (i == res.getInstantiatesCanonical().size())
19182          res.getInstantiatesCanonical().add(parseCanonical(null));
19183        if (array.get(i) instanceof JsonObject) 
19184          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
19185      }
19186    };
19187    if (json.has("instantiatesUri")) {
19188      JsonArray array = json.getAsJsonArray("instantiatesUri");
19189      for (int i = 0; i < array.size(); i++) {
19190        if (array.get(i).isJsonNull()) {
19191          res.getInstantiatesUri().add(new UriType());
19192        } else {
19193          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
19194        }
19195      }
19196    };
19197    if (json.has("_instantiatesUri")) {
19198      JsonArray array = json.getAsJsonArray("_instantiatesUri");
19199      for (int i = 0; i < array.size(); i++) {
19200        if (i == res.getInstantiatesUri().size())
19201          res.getInstantiatesUri().add(parseUri(null));
19202        if (array.get(i) instanceof JsonObject) 
19203          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
19204      }
19205    };
19206    if (json.has("instantiates")) {
19207      JsonArray array = json.getAsJsonArray("instantiates");
19208      for (int i = 0; i < array.size(); i++) {
19209        if (array.get(i).isJsonNull()) {
19210          res.getInstantiates().add(new UriType());
19211        } else {
19212          res.getInstantiates().add(parseUri(array.get(i).getAsString()));
19213        }
19214      }
19215    };
19216    if (json.has("_instantiates")) {
19217      JsonArray array = json.getAsJsonArray("_instantiates");
19218      for (int i = 0; i < array.size(); i++) {
19219        if (i == res.getInstantiates().size())
19220          res.getInstantiates().add(parseUri(null));
19221        if (array.get(i) instanceof JsonObject) 
19222          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
19223      }
19224    };
19225    if (json.has("status"))
19226      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
19227    if (json.has("_status"))
19228      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19229    if (json.has("intent"))
19230      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), NutritionOrder.NutritiionOrderIntent.NULL, new NutritionOrder.NutritiionOrderIntentEnumFactory()));
19231    if (json.has("_intent"))
19232      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
19233    if (json.has("patient"))
19234      res.setPatient(parseReference(getJObject(json, "patient")));
19235    if (json.has("encounter"))
19236      res.setEncounter(parseReference(getJObject(json, "encounter")));
19237    if (json.has("dateTime"))
19238      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
19239    if (json.has("_dateTime"))
19240      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
19241    if (json.has("orderer"))
19242      res.setOrderer(parseReference(getJObject(json, "orderer")));
19243    if (json.has("allergyIntolerance")) {
19244      JsonArray array = json.getAsJsonArray("allergyIntolerance");
19245      for (int i = 0; i < array.size(); i++) {
19246        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
19247      }
19248    };
19249    if (json.has("foodPreferenceModifier")) {
19250      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
19251      for (int i = 0; i < array.size(); i++) {
19252        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19253      }
19254    };
19255    if (json.has("excludeFoodModifier")) {
19256      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
19257      for (int i = 0; i < array.size(); i++) {
19258        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19259      }
19260    };
19261    if (json.has("oralDiet"))
19262      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(getJObject(json, "oralDiet"), res));
19263    if (json.has("supplement")) {
19264      JsonArray array = json.getAsJsonArray("supplement");
19265      for (int i = 0; i < array.size(); i++) {
19266        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
19267      }
19268    };
19269    if (json.has("enteralFormula"))
19270      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(getJObject(json, "enteralFormula"), res));
19271    if (json.has("note")) {
19272      JsonArray array = json.getAsJsonArray("note");
19273      for (int i = 0; i < array.size(); i++) {
19274        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19275      }
19276    };
19277  }
19278
19279  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19280    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
19281    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
19282    return res;
19283  }
19284
19285  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
19286    parseBackboneElementProperties(json, res);
19287    if (json.has("type")) {
19288      JsonArray array = json.getAsJsonArray("type");
19289      for (int i = 0; i < array.size(); i++) {
19290        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19291      }
19292    };
19293    if (json.has("schedule")) {
19294      JsonArray array = json.getAsJsonArray("schedule");
19295      for (int i = 0; i < array.size(); i++) {
19296        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
19297      }
19298    };
19299    if (json.has("nutrient")) {
19300      JsonArray array = json.getAsJsonArray("nutrient");
19301      for (int i = 0; i < array.size(); i++) {
19302        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
19303      }
19304    };
19305    if (json.has("texture")) {
19306      JsonArray array = json.getAsJsonArray("texture");
19307      for (int i = 0; i < array.size(); i++) {
19308        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
19309      }
19310    };
19311    if (json.has("fluidConsistencyType")) {
19312      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
19313      for (int i = 0; i < array.size(); i++) {
19314        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19315      }
19316    };
19317    if (json.has("instruction"))
19318      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
19319    if (json.has("_instruction"))
19320      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
19321  }
19322
19323  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19324    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
19325    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
19326    return res;
19327  }
19328
19329  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
19330    parseBackboneElementProperties(json, res);
19331    if (json.has("modifier"))
19332      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
19333    if (json.has("amount"))
19334      res.setAmount(parseQuantity(getJObject(json, "amount")));
19335  }
19336
19337  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19338    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
19339    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
19340    return res;
19341  }
19342
19343  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
19344    parseBackboneElementProperties(json, res);
19345    if (json.has("modifier"))
19346      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
19347    if (json.has("foodType"))
19348      res.setFoodType(parseCodeableConcept(getJObject(json, "foodType")));
19349  }
19350
19351  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19352    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
19353    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
19354    return res;
19355  }
19356
19357  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
19358    parseBackboneElementProperties(json, res);
19359    if (json.has("type"))
19360      res.setType(parseCodeableConcept(getJObject(json, "type")));
19361    if (json.has("productName"))
19362      res.setProductNameElement(parseString(json.get("productName").getAsString()));
19363    if (json.has("_productName"))
19364      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
19365    if (json.has("schedule")) {
19366      JsonArray array = json.getAsJsonArray("schedule");
19367      for (int i = 0; i < array.size(); i++) {
19368        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
19369      }
19370    };
19371    if (json.has("quantity"))
19372      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
19373    if (json.has("instruction"))
19374      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
19375    if (json.has("_instruction"))
19376      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
19377  }
19378
19379  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19380    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
19381    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
19382    return res;
19383  }
19384
19385  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
19386    parseBackboneElementProperties(json, res);
19387    if (json.has("baseFormulaType"))
19388      res.setBaseFormulaType(parseCodeableConcept(getJObject(json, "baseFormulaType")));
19389    if (json.has("baseFormulaProductName"))
19390      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
19391    if (json.has("_baseFormulaProductName"))
19392      parseElementProperties(getJObject(json, "_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
19393    if (json.has("additiveType"))
19394      res.setAdditiveType(parseCodeableConcept(getJObject(json, "additiveType")));
19395    if (json.has("additiveProductName"))
19396      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
19397    if (json.has("_additiveProductName"))
19398      parseElementProperties(getJObject(json, "_additiveProductName"), res.getAdditiveProductNameElement());
19399    if (json.has("caloricDensity"))
19400      res.setCaloricDensity(parseQuantity(getJObject(json, "caloricDensity")));
19401    if (json.has("routeofAdministration"))
19402      res.setRouteofAdministration(parseCodeableConcept(getJObject(json, "routeofAdministration")));
19403    if (json.has("administration")) {
19404      JsonArray array = json.getAsJsonArray("administration");
19405      for (int i = 0; i < array.size(); i++) {
19406        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
19407      }
19408    };
19409    if (json.has("maxVolumeToDeliver"))
19410      res.setMaxVolumeToDeliver(parseQuantity(getJObject(json, "maxVolumeToDeliver")));
19411    if (json.has("administrationInstruction"))
19412      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
19413    if (json.has("_administrationInstruction"))
19414      parseElementProperties(getJObject(json, "_administrationInstruction"), res.getAdministrationInstructionElement());
19415  }
19416
19417  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
19418    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
19419    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
19420    return res;
19421  }
19422
19423  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
19424    parseBackboneElementProperties(json, res);
19425    if (json.has("schedule"))
19426      res.setSchedule(parseTiming(getJObject(json, "schedule")));
19427    if (json.has("quantity"))
19428      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
19429    Type rate = parseType("rate", json);
19430    if (rate != null)
19431      res.setRate(rate);
19432  }
19433
19434  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
19435    Observation res = new Observation();
19436    parseObservationProperties(json, res);
19437    return res;
19438  }
19439
19440  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
19441    parseDomainResourceProperties(json, res);
19442    if (json.has("identifier")) {
19443      JsonArray array = json.getAsJsonArray("identifier");
19444      for (int i = 0; i < array.size(); i++) {
19445        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19446      }
19447    };
19448    if (json.has("basedOn")) {
19449      JsonArray array = json.getAsJsonArray("basedOn");
19450      for (int i = 0; i < array.size(); i++) {
19451        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
19452      }
19453    };
19454    if (json.has("partOf")) {
19455      JsonArray array = json.getAsJsonArray("partOf");
19456      for (int i = 0; i < array.size(); i++) {
19457        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
19458      }
19459    };
19460    if (json.has("status"))
19461      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
19462    if (json.has("_status"))
19463      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19464    if (json.has("category")) {
19465      JsonArray array = json.getAsJsonArray("category");
19466      for (int i = 0; i < array.size(); i++) {
19467        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19468      }
19469    };
19470    if (json.has("code"))
19471      res.setCode(parseCodeableConcept(getJObject(json, "code")));
19472    if (json.has("subject"))
19473      res.setSubject(parseReference(getJObject(json, "subject")));
19474    if (json.has("focus")) {
19475      JsonArray array = json.getAsJsonArray("focus");
19476      for (int i = 0; i < array.size(); i++) {
19477        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
19478      }
19479    };
19480    if (json.has("encounter"))
19481      res.setEncounter(parseReference(getJObject(json, "encounter")));
19482    Type effective = parseType("effective", json);
19483    if (effective != null)
19484      res.setEffective(effective);
19485    if (json.has("issued"))
19486      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
19487    if (json.has("_issued"))
19488      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
19489    if (json.has("performer")) {
19490      JsonArray array = json.getAsJsonArray("performer");
19491      for (int i = 0; i < array.size(); i++) {
19492        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
19493      }
19494    };
19495    Type value = parseType("value", json);
19496    if (value != null)
19497      res.setValue(value);
19498    if (json.has("dataAbsentReason"))
19499      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
19500    if (json.has("interpretation")) {
19501      JsonArray array = json.getAsJsonArray("interpretation");
19502      for (int i = 0; i < array.size(); i++) {
19503        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19504      }
19505    };
19506    if (json.has("note")) {
19507      JsonArray array = json.getAsJsonArray("note");
19508      for (int i = 0; i < array.size(); i++) {
19509        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19510      }
19511    };
19512    if (json.has("bodySite"))
19513      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
19514    if (json.has("method"))
19515      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
19516    if (json.has("specimen"))
19517      res.setSpecimen(parseReference(getJObject(json, "specimen")));
19518    if (json.has("device"))
19519      res.setDevice(parseReference(getJObject(json, "device")));
19520    if (json.has("referenceRange")) {
19521      JsonArray array = json.getAsJsonArray("referenceRange");
19522      for (int i = 0; i < array.size(); i++) {
19523        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
19524      }
19525    };
19526    if (json.has("hasMember")) {
19527      JsonArray array = json.getAsJsonArray("hasMember");
19528      for (int i = 0; i < array.size(); i++) {
19529        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
19530      }
19531    };
19532    if (json.has("derivedFrom")) {
19533      JsonArray array = json.getAsJsonArray("derivedFrom");
19534      for (int i = 0; i < array.size(); i++) {
19535        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
19536      }
19537    };
19538    if (json.has("component")) {
19539      JsonArray array = json.getAsJsonArray("component");
19540      for (int i = 0; i < array.size(); i++) {
19541        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
19542      }
19543    };
19544  }
19545
19546  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
19547    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
19548    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
19549    return res;
19550  }
19551
19552  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
19553    parseBackboneElementProperties(json, res);
19554    if (json.has("low"))
19555      res.setLow(parseQuantity(getJObject(json, "low")));
19556    if (json.has("high"))
19557      res.setHigh(parseQuantity(getJObject(json, "high")));
19558    if (json.has("type"))
19559      res.setType(parseCodeableConcept(getJObject(json, "type")));
19560    if (json.has("appliesTo")) {
19561      JsonArray array = json.getAsJsonArray("appliesTo");
19562      for (int i = 0; i < array.size(); i++) {
19563        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19564      }
19565    };
19566    if (json.has("age"))
19567      res.setAge(parseRange(getJObject(json, "age")));
19568    if (json.has("text"))
19569      res.setTextElement(parseString(json.get("text").getAsString()));
19570    if (json.has("_text"))
19571      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
19572  }
19573
19574  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
19575    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
19576    parseObservationObservationComponentComponentProperties(json, owner, res);
19577    return res;
19578  }
19579
19580  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
19581    parseBackboneElementProperties(json, res);
19582    if (json.has("code"))
19583      res.setCode(parseCodeableConcept(getJObject(json, "code")));
19584    Type value = parseType("value", json);
19585    if (value != null)
19586      res.setValue(value);
19587    if (json.has("dataAbsentReason"))
19588      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
19589    if (json.has("interpretation")) {
19590      JsonArray array = json.getAsJsonArray("interpretation");
19591      for (int i = 0; i < array.size(); i++) {
19592        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19593      }
19594    };
19595    if (json.has("referenceRange")) {
19596      JsonArray array = json.getAsJsonArray("referenceRange");
19597      for (int i = 0; i < array.size(); i++) {
19598        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
19599      }
19600    };
19601  }
19602
19603  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
19604    ObservationDefinition res = new ObservationDefinition();
19605    parseObservationDefinitionProperties(json, res);
19606    return res;
19607  }
19608
19609  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res) throws IOException, FHIRFormatError {
19610    parseDomainResourceProperties(json, res);
19611    if (json.has("category")) {
19612      JsonArray array = json.getAsJsonArray("category");
19613      for (int i = 0; i < array.size(); i++) {
19614        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19615      }
19616    };
19617    if (json.has("code"))
19618      res.setCode(parseCodeableConcept(getJObject(json, "code")));
19619    if (json.has("identifier")) {
19620      JsonArray array = json.getAsJsonArray("identifier");
19621      for (int i = 0; i < array.size(); i++) {
19622        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19623      }
19624    };
19625    if (json.has("permittedDataType")) {
19626      JsonArray array = json.getAsJsonArray("permittedDataType");
19627      for (int i = 0; i < array.size(); i++) {
19628        if (array.get(i).isJsonNull()) {
19629          res.getPermittedDataType().add(new Enumeration<ObservationDefinition.ObservationDataType>());
19630        } else {
19631          res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19632        }
19633      }
19634    };
19635    if (json.has("_permittedDataType")) {
19636      JsonArray array = json.getAsJsonArray("_permittedDataType");
19637      for (int i = 0; i < array.size(); i++) {
19638        if (i == res.getPermittedDataType().size())
19639          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19640        if (array.get(i) instanceof JsonObject) 
19641          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
19642      }
19643    };
19644    if (json.has("multipleResultsAllowed"))
19645      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
19646    if (json.has("_multipleResultsAllowed"))
19647      parseElementProperties(getJObject(json, "_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
19648    if (json.has("method"))
19649      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
19650    if (json.has("preferredReportName"))
19651      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
19652    if (json.has("_preferredReportName"))
19653      parseElementProperties(getJObject(json, "_preferredReportName"), res.getPreferredReportNameElement());
19654    if (json.has("quantitativeDetails"))
19655      res.setQuantitativeDetails(parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(getJObject(json, "quantitativeDetails"), res));
19656    if (json.has("qualifiedInterval")) {
19657      JsonArray array = json.getAsJsonArray("qualifiedInterval");
19658      for (int i = 0; i < array.size(); i++) {
19659        res.getQualifiedInterval().add(parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject(), res));
19660      }
19661    };
19662    if (json.has("validCodedValueSet"))
19663      res.setValidCodedValueSet(parseReference(getJObject(json, "validCodedValueSet")));
19664    if (json.has("normalCodedValueSet"))
19665      res.setNormalCodedValueSet(parseReference(getJObject(json, "normalCodedValueSet")));
19666    if (json.has("abnormalCodedValueSet"))
19667      res.setAbnormalCodedValueSet(parseReference(getJObject(json, "abnormalCodedValueSet")));
19668    if (json.has("criticalCodedValueSet"))
19669      res.setCriticalCodedValueSet(parseReference(getJObject(json, "criticalCodedValueSet")));
19670  }
19671
19672  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19673    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
19674    parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(json, owner, res);
19675    return res;
19676  }
19677
19678  protected void parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res) throws IOException, FHIRFormatError {
19679    parseBackboneElementProperties(json, res);
19680    if (json.has("customaryUnit"))
19681      res.setCustomaryUnit(parseCodeableConcept(getJObject(json, "customaryUnit")));
19682    if (json.has("unit"))
19683      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
19684    if (json.has("conversionFactor"))
19685      res.setConversionFactorElement(parseDecimal(json.get("conversionFactor").getAsBigDecimal()));
19686    if (json.has("_conversionFactor"))
19687      parseElementProperties(getJObject(json, "_conversionFactor"), res.getConversionFactorElement());
19688    if (json.has("decimalPrecision"))
19689      res.setDecimalPrecisionElement(parseInteger(json.get("decimalPrecision").getAsLong()));
19690    if (json.has("_decimalPrecision"))
19691      parseElementProperties(getJObject(json, "_decimalPrecision"), res.getDecimalPrecisionElement());
19692  }
19693
19694  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19695    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
19696    parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(json, owner, res);
19697    return res;
19698  }
19699
19700  protected void parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res) throws IOException, FHIRFormatError {
19701    parseBackboneElementProperties(json, res);
19702    if (json.has("category"))
19703      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), ObservationDefinition.ObservationRangeCategory.NULL, new ObservationDefinition.ObservationRangeCategoryEnumFactory()));
19704    if (json.has("_category"))
19705      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
19706    if (json.has("range"))
19707      res.setRange(parseRange(getJObject(json, "range")));
19708    if (json.has("context"))
19709      res.setContext(parseCodeableConcept(getJObject(json, "context")));
19710    if (json.has("appliesTo")) {
19711      JsonArray array = json.getAsJsonArray("appliesTo");
19712      for (int i = 0; i < array.size(); i++) {
19713        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19714      }
19715    };
19716    if (json.has("gender"))
19717      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19718    if (json.has("_gender"))
19719      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
19720    if (json.has("age"))
19721      res.setAge(parseRange(getJObject(json, "age")));
19722    if (json.has("gestationalAge"))
19723      res.setGestationalAge(parseRange(getJObject(json, "gestationalAge")));
19724    if (json.has("condition"))
19725      res.setConditionElement(parseString(json.get("condition").getAsString()));
19726    if (json.has("_condition"))
19727      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
19728  }
19729
19730  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
19731    OperationDefinition res = new OperationDefinition();
19732    parseOperationDefinitionProperties(json, res);
19733    return res;
19734  }
19735
19736  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
19737    parseDomainResourceProperties(json, res);
19738    if (json.has("url"))
19739      res.setUrlElement(parseUri(json.get("url").getAsString()));
19740    if (json.has("_url"))
19741      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
19742    if (json.has("version"))
19743      res.setVersionElement(parseString(json.get("version").getAsString()));
19744    if (json.has("_version"))
19745      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
19746    if (json.has("name"))
19747      res.setNameElement(parseString(json.get("name").getAsString()));
19748    if (json.has("_name"))
19749      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19750    if (json.has("title"))
19751      res.setTitleElement(parseString(json.get("title").getAsString()));
19752    if (json.has("_title"))
19753      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
19754    if (json.has("status"))
19755      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19756    if (json.has("_status"))
19757      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19758    if (json.has("kind"))
19759      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
19760    if (json.has("_kind"))
19761      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
19762    if (json.has("experimental"))
19763      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19764    if (json.has("_experimental"))
19765      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
19766    if (json.has("date"))
19767      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19768    if (json.has("_date"))
19769      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
19770    if (json.has("publisher"))
19771      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19772    if (json.has("_publisher"))
19773      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
19774    if (json.has("contact")) {
19775      JsonArray array = json.getAsJsonArray("contact");
19776      for (int i = 0; i < array.size(); i++) {
19777        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19778      }
19779    };
19780    if (json.has("description"))
19781      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19782    if (json.has("_description"))
19783      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19784    if (json.has("useContext")) {
19785      JsonArray array = json.getAsJsonArray("useContext");
19786      for (int i = 0; i < array.size(); i++) {
19787        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19788      }
19789    };
19790    if (json.has("jurisdiction")) {
19791      JsonArray array = json.getAsJsonArray("jurisdiction");
19792      for (int i = 0; i < array.size(); i++) {
19793        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19794      }
19795    };
19796    if (json.has("purpose"))
19797      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19798    if (json.has("_purpose"))
19799      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
19800    if (json.has("affectsState"))
19801      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
19802    if (json.has("_affectsState"))
19803      parseElementProperties(getJObject(json, "_affectsState"), res.getAffectsStateElement());
19804    if (json.has("code"))
19805      res.setCodeElement(parseCode(json.get("code").getAsString()));
19806    if (json.has("_code"))
19807      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
19808    if (json.has("comment"))
19809      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
19810    if (json.has("_comment"))
19811      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
19812    if (json.has("base"))
19813      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
19814    if (json.has("_base"))
19815      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
19816    if (json.has("resource")) {
19817      JsonArray array = json.getAsJsonArray("resource");
19818      for (int i = 0; i < array.size(); i++) {
19819        if (array.get(i).isJsonNull()) {
19820          res.getResource().add(new CodeType());
19821        } else {
19822          res.getResource().add(parseCode(array.get(i).getAsString()));
19823        }
19824      }
19825    };
19826    if (json.has("_resource")) {
19827      JsonArray array = json.getAsJsonArray("_resource");
19828      for (int i = 0; i < array.size(); i++) {
19829        if (i == res.getResource().size())
19830          res.getResource().add(parseCode(null));
19831        if (array.get(i) instanceof JsonObject) 
19832          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
19833      }
19834    };
19835    if (json.has("system"))
19836      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
19837    if (json.has("_system"))
19838      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
19839    if (json.has("type"))
19840      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
19841    if (json.has("_type"))
19842      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
19843    if (json.has("instance"))
19844      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
19845    if (json.has("_instance"))
19846      parseElementProperties(getJObject(json, "_instance"), res.getInstanceElement());
19847    if (json.has("inputProfile"))
19848      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
19849    if (json.has("_inputProfile"))
19850      parseElementProperties(getJObject(json, "_inputProfile"), res.getInputProfileElement());
19851    if (json.has("outputProfile"))
19852      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
19853    if (json.has("_outputProfile"))
19854      parseElementProperties(getJObject(json, "_outputProfile"), res.getOutputProfileElement());
19855    if (json.has("parameter")) {
19856      JsonArray array = json.getAsJsonArray("parameter");
19857      for (int i = 0; i < array.size(); i++) {
19858        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
19859      }
19860    };
19861    if (json.has("overload")) {
19862      JsonArray array = json.getAsJsonArray("overload");
19863      for (int i = 0; i < array.size(); i++) {
19864        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
19865      }
19866    };
19867  }
19868
19869  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19870    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
19871    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
19872    return res;
19873  }
19874
19875  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
19876    parseBackboneElementProperties(json, res);
19877    if (json.has("name"))
19878      res.setNameElement(parseCode(json.get("name").getAsString()));
19879    if (json.has("_name"))
19880      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19881    if (json.has("use"))
19882      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
19883    if (json.has("_use"))
19884      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
19885    if (json.has("min"))
19886      res.setMinElement(parseInteger(json.get("min").getAsLong()));
19887    if (json.has("_min"))
19888      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
19889    if (json.has("max"))
19890      res.setMaxElement(parseString(json.get("max").getAsString()));
19891    if (json.has("_max"))
19892      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
19893    if (json.has("documentation"))
19894      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
19895    if (json.has("_documentation"))
19896      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
19897    if (json.has("type"))
19898      res.setTypeElement(parseCode(json.get("type").getAsString()));
19899    if (json.has("_type"))
19900      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
19901    if (json.has("targetProfile")) {
19902      JsonArray array = json.getAsJsonArray("targetProfile");
19903      for (int i = 0; i < array.size(); i++) {
19904        if (array.get(i).isJsonNull()) {
19905          res.getTargetProfile().add(new CanonicalType());
19906        } else {
19907          res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
19908        }
19909      }
19910    };
19911    if (json.has("_targetProfile")) {
19912      JsonArray array = json.getAsJsonArray("_targetProfile");
19913      for (int i = 0; i < array.size(); i++) {
19914        if (i == res.getTargetProfile().size())
19915          res.getTargetProfile().add(parseCanonical(null));
19916        if (array.get(i) instanceof JsonObject) 
19917          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
19918      }
19919    };
19920    if (json.has("searchType"))
19921      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
19922    if (json.has("_searchType"))
19923      parseElementProperties(getJObject(json, "_searchType"), res.getSearchTypeElement());
19924    if (json.has("binding"))
19925      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(getJObject(json, "binding"), owner));
19926    if (json.has("referencedFrom")) {
19927      JsonArray array = json.getAsJsonArray("referencedFrom");
19928      for (int i = 0; i < array.size(); i++) {
19929        res.getReferencedFrom().add(parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(array.get(i).getAsJsonObject(), owner));
19930      }
19931    };
19932    if (json.has("part")) {
19933      JsonArray array = json.getAsJsonArray("part");
19934      for (int i = 0; i < array.size(); i++) {
19935        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
19936      }
19937    };
19938  }
19939
19940  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19941    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
19942    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
19943    return res;
19944  }
19945
19946  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
19947    parseBackboneElementProperties(json, res);
19948    if (json.has("strength"))
19949      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
19950    if (json.has("_strength"))
19951      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
19952    if (json.has("valueSet"))
19953      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
19954    if (json.has("_valueSet"))
19955      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
19956  }
19957
19958  protected OperationDefinition.OperationDefinitionParameterReferencedFromComponent parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19959    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
19960    parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(json, owner, res);
19961    return res;
19962  }
19963
19964  protected void parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterReferencedFromComponent res) throws IOException, FHIRFormatError {
19965    parseBackboneElementProperties(json, res);
19966    if (json.has("source"))
19967      res.setSourceElement(parseString(json.get("source").getAsString()));
19968    if (json.has("_source"))
19969      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
19970    if (json.has("sourceId"))
19971      res.setSourceIdElement(parseString(json.get("sourceId").getAsString()));
19972    if (json.has("_sourceId"))
19973      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
19974  }
19975
19976  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19977    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
19978    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
19979    return res;
19980  }
19981
19982  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
19983    parseBackboneElementProperties(json, res);
19984    if (json.has("parameterName")) {
19985      JsonArray array = json.getAsJsonArray("parameterName");
19986      for (int i = 0; i < array.size(); i++) {
19987        if (array.get(i).isJsonNull()) {
19988          res.getParameterName().add(new StringType());
19989        } else {
19990          res.getParameterName().add(parseString(array.get(i).getAsString()));
19991        }
19992      }
19993    };
19994    if (json.has("_parameterName")) {
19995      JsonArray array = json.getAsJsonArray("_parameterName");
19996      for (int i = 0; i < array.size(); i++) {
19997        if (i == res.getParameterName().size())
19998          res.getParameterName().add(parseString(null));
19999        if (array.get(i) instanceof JsonObject) 
20000          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
20001      }
20002    };
20003    if (json.has("comment"))
20004      res.setCommentElement(parseString(json.get("comment").getAsString()));
20005    if (json.has("_comment"))
20006      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
20007  }
20008
20009  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
20010    OperationOutcome res = new OperationOutcome();
20011    parseOperationOutcomeProperties(json, res);
20012    return res;
20013  }
20014
20015  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
20016    parseDomainResourceProperties(json, res);
20017    if (json.has("issue")) {
20018      JsonArray array = json.getAsJsonArray("issue");
20019      for (int i = 0; i < array.size(); i++) {
20020        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
20021      }
20022    };
20023  }
20024
20025  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
20026    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
20027    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
20028    return res;
20029  }
20030
20031  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
20032    parseBackboneElementProperties(json, res);
20033    if (json.has("severity"))
20034      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
20035    if (json.has("_severity"))
20036      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
20037    if (json.has("code"))
20038      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
20039    if (json.has("_code"))
20040      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
20041    if (json.has("details"))
20042      res.setDetails(parseCodeableConcept(getJObject(json, "details")));
20043    if (json.has("diagnostics"))
20044      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
20045    if (json.has("_diagnostics"))
20046      parseElementProperties(getJObject(json, "_diagnostics"), res.getDiagnosticsElement());
20047    if (json.has("location")) {
20048      JsonArray array = json.getAsJsonArray("location");
20049      for (int i = 0; i < array.size(); i++) {
20050        if (array.get(i).isJsonNull()) {
20051          res.getLocation().add(new StringType());
20052        } else {
20053          res.getLocation().add(parseString(array.get(i).getAsString()));
20054        }
20055      }
20056    };
20057    if (json.has("_location")) {
20058      JsonArray array = json.getAsJsonArray("_location");
20059      for (int i = 0; i < array.size(); i++) {
20060        if (i == res.getLocation().size())
20061          res.getLocation().add(parseString(null));
20062        if (array.get(i) instanceof JsonObject) 
20063          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
20064      }
20065    };
20066    if (json.has("expression")) {
20067      JsonArray array = json.getAsJsonArray("expression");
20068      for (int i = 0; i < array.size(); i++) {
20069        if (array.get(i).isJsonNull()) {
20070          res.getExpression().add(new StringType());
20071        } else {
20072          res.getExpression().add(parseString(array.get(i).getAsString()));
20073        }
20074      }
20075    };
20076    if (json.has("_expression")) {
20077      JsonArray array = json.getAsJsonArray("_expression");
20078      for (int i = 0; i < array.size(); i++) {
20079        if (i == res.getExpression().size())
20080          res.getExpression().add(parseString(null));
20081        if (array.get(i) instanceof JsonObject) 
20082          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
20083      }
20084    };
20085  }
20086
20087  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
20088    Organization res = new Organization();
20089    parseOrganizationProperties(json, res);
20090    return res;
20091  }
20092
20093  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
20094    parseDomainResourceProperties(json, res);
20095    if (json.has("identifier")) {
20096      JsonArray array = json.getAsJsonArray("identifier");
20097      for (int i = 0; i < array.size(); i++) {
20098        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20099      }
20100    };
20101    if (json.has("active"))
20102      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20103    if (json.has("_active"))
20104      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
20105    if (json.has("type")) {
20106      JsonArray array = json.getAsJsonArray("type");
20107      for (int i = 0; i < array.size(); i++) {
20108        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20109      }
20110    };
20111    if (json.has("name"))
20112      res.setNameElement(parseString(json.get("name").getAsString()));
20113    if (json.has("_name"))
20114      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20115    if (json.has("alias")) {
20116      JsonArray array = json.getAsJsonArray("alias");
20117      for (int i = 0; i < array.size(); i++) {
20118        if (array.get(i).isJsonNull()) {
20119          res.getAlias().add(new StringType());
20120        } else {
20121          res.getAlias().add(parseString(array.get(i).getAsString()));
20122        }
20123      }
20124    };
20125    if (json.has("_alias")) {
20126      JsonArray array = json.getAsJsonArray("_alias");
20127      for (int i = 0; i < array.size(); i++) {
20128        if (i == res.getAlias().size())
20129          res.getAlias().add(parseString(null));
20130        if (array.get(i) instanceof JsonObject) 
20131          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
20132      }
20133    };
20134    if (json.has("telecom")) {
20135      JsonArray array = json.getAsJsonArray("telecom");
20136      for (int i = 0; i < array.size(); i++) {
20137        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20138      }
20139    };
20140    if (json.has("address")) {
20141      JsonArray array = json.getAsJsonArray("address");
20142      for (int i = 0; i < array.size(); i++) {
20143        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20144      }
20145    };
20146    if (json.has("partOf"))
20147      res.setPartOf(parseReference(getJObject(json, "partOf")));
20148    if (json.has("contact")) {
20149      JsonArray array = json.getAsJsonArray("contact");
20150      for (int i = 0; i < array.size(); i++) {
20151        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
20152      }
20153    };
20154    if (json.has("endpoint")) {
20155      JsonArray array = json.getAsJsonArray("endpoint");
20156      for (int i = 0; i < array.size(); i++) {
20157        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
20158      }
20159    };
20160  }
20161
20162  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
20163    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
20164    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
20165    return res;
20166  }
20167
20168  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
20169    parseBackboneElementProperties(json, res);
20170    if (json.has("purpose"))
20171      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
20172    if (json.has("name"))
20173      res.setName(parseHumanName(getJObject(json, "name")));
20174    if (json.has("telecom")) {
20175      JsonArray array = json.getAsJsonArray("telecom");
20176      for (int i = 0; i < array.size(); i++) {
20177        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20178      }
20179    };
20180    if (json.has("address"))
20181      res.setAddress(parseAddress(getJObject(json, "address")));
20182  }
20183
20184  protected OrganizationAffiliation parseOrganizationAffiliation(JsonObject json) throws IOException, FHIRFormatError {
20185    OrganizationAffiliation res = new OrganizationAffiliation();
20186    parseOrganizationAffiliationProperties(json, res);
20187    return res;
20188  }
20189
20190  protected void parseOrganizationAffiliationProperties(JsonObject json, OrganizationAffiliation res) throws IOException, FHIRFormatError {
20191    parseDomainResourceProperties(json, res);
20192    if (json.has("identifier")) {
20193      JsonArray array = json.getAsJsonArray("identifier");
20194      for (int i = 0; i < array.size(); i++) {
20195        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20196      }
20197    };
20198    if (json.has("active"))
20199      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20200    if (json.has("_active"))
20201      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
20202    if (json.has("period"))
20203      res.setPeriod(parsePeriod(getJObject(json, "period")));
20204    if (json.has("organization"))
20205      res.setOrganization(parseReference(getJObject(json, "organization")));
20206    if (json.has("participatingOrganization"))
20207      res.setParticipatingOrganization(parseReference(getJObject(json, "participatingOrganization")));
20208    if (json.has("network")) {
20209      JsonArray array = json.getAsJsonArray("network");
20210      for (int i = 0; i < array.size(); i++) {
20211        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
20212      }
20213    };
20214    if (json.has("code")) {
20215      JsonArray array = json.getAsJsonArray("code");
20216      for (int i = 0; i < array.size(); i++) {
20217        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20218      }
20219    };
20220    if (json.has("specialty")) {
20221      JsonArray array = json.getAsJsonArray("specialty");
20222      for (int i = 0; i < array.size(); i++) {
20223        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20224      }
20225    };
20226    if (json.has("location")) {
20227      JsonArray array = json.getAsJsonArray("location");
20228      for (int i = 0; i < array.size(); i++) {
20229        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
20230      }
20231    };
20232    if (json.has("healthcareService")) {
20233      JsonArray array = json.getAsJsonArray("healthcareService");
20234      for (int i = 0; i < array.size(); i++) {
20235        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
20236      }
20237    };
20238    if (json.has("telecom")) {
20239      JsonArray array = json.getAsJsonArray("telecom");
20240      for (int i = 0; i < array.size(); i++) {
20241        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20242      }
20243    };
20244    if (json.has("endpoint")) {
20245      JsonArray array = json.getAsJsonArray("endpoint");
20246      for (int i = 0; i < array.size(); i++) {
20247        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
20248      }
20249    };
20250  }
20251
20252  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
20253    Patient res = new Patient();
20254    parsePatientProperties(json, res);
20255    return res;
20256  }
20257
20258  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
20259    parseDomainResourceProperties(json, res);
20260    if (json.has("identifier")) {
20261      JsonArray array = json.getAsJsonArray("identifier");
20262      for (int i = 0; i < array.size(); i++) {
20263        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20264      }
20265    };
20266    if (json.has("active"))
20267      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20268    if (json.has("_active"))
20269      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
20270    if (json.has("name")) {
20271      JsonArray array = json.getAsJsonArray("name");
20272      for (int i = 0; i < array.size(); i++) {
20273        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20274      }
20275    };
20276    if (json.has("telecom")) {
20277      JsonArray array = json.getAsJsonArray("telecom");
20278      for (int i = 0; i < array.size(); i++) {
20279        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20280      }
20281    };
20282    if (json.has("gender"))
20283      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20284    if (json.has("_gender"))
20285      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
20286    if (json.has("birthDate"))
20287      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20288    if (json.has("_birthDate"))
20289      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
20290    Type deceased = parseType("deceased", json);
20291    if (deceased != null)
20292      res.setDeceased(deceased);
20293    if (json.has("address")) {
20294      JsonArray array = json.getAsJsonArray("address");
20295      for (int i = 0; i < array.size(); i++) {
20296        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20297      }
20298    };
20299    if (json.has("maritalStatus"))
20300      res.setMaritalStatus(parseCodeableConcept(getJObject(json, "maritalStatus")));
20301    Type multipleBirth = parseType("multipleBirth", json);
20302    if (multipleBirth != null)
20303      res.setMultipleBirth(multipleBirth);
20304    if (json.has("photo")) {
20305      JsonArray array = json.getAsJsonArray("photo");
20306      for (int i = 0; i < array.size(); i++) {
20307        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
20308      }
20309    };
20310    if (json.has("contact")) {
20311      JsonArray array = json.getAsJsonArray("contact");
20312      for (int i = 0; i < array.size(); i++) {
20313        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
20314      }
20315    };
20316    if (json.has("communication")) {
20317      JsonArray array = json.getAsJsonArray("communication");
20318      for (int i = 0; i < array.size(); i++) {
20319        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
20320      }
20321    };
20322    if (json.has("generalPractitioner")) {
20323      JsonArray array = json.getAsJsonArray("generalPractitioner");
20324      for (int i = 0; i < array.size(); i++) {
20325        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
20326      }
20327    };
20328    if (json.has("managingOrganization"))
20329      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
20330    if (json.has("link")) {
20331      JsonArray array = json.getAsJsonArray("link");
20332      for (int i = 0; i < array.size(); i++) {
20333        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
20334      }
20335    };
20336  }
20337
20338  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
20339    Patient.ContactComponent res = new Patient.ContactComponent();
20340    parsePatientContactComponentProperties(json, owner, res);
20341    return res;
20342  }
20343
20344  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res) throws IOException, FHIRFormatError {
20345    parseBackboneElementProperties(json, res);
20346    if (json.has("relationship")) {
20347      JsonArray array = json.getAsJsonArray("relationship");
20348      for (int i = 0; i < array.size(); i++) {
20349        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20350      }
20351    };
20352    if (json.has("name"))
20353      res.setName(parseHumanName(getJObject(json, "name")));
20354    if (json.has("telecom")) {
20355      JsonArray array = json.getAsJsonArray("telecom");
20356      for (int i = 0; i < array.size(); i++) {
20357        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20358      }
20359    };
20360    if (json.has("address"))
20361      res.setAddress(parseAddress(getJObject(json, "address")));
20362    if (json.has("gender"))
20363      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20364    if (json.has("_gender"))
20365      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
20366    if (json.has("organization"))
20367      res.setOrganization(parseReference(getJObject(json, "organization")));
20368    if (json.has("period"))
20369      res.setPeriod(parsePeriod(getJObject(json, "period")));
20370  }
20371
20372  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
20373    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
20374    parsePatientPatientCommunicationComponentProperties(json, owner, res);
20375    return res;
20376  }
20377
20378  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
20379    parseBackboneElementProperties(json, res);
20380    if (json.has("language"))
20381      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
20382    if (json.has("preferred"))
20383      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
20384    if (json.has("_preferred"))
20385      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
20386  }
20387
20388  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
20389    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
20390    parsePatientPatientLinkComponentProperties(json, owner, res);
20391    return res;
20392  }
20393
20394  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
20395    parseBackboneElementProperties(json, res);
20396    if (json.has("other"))
20397      res.setOther(parseReference(getJObject(json, "other")));
20398    if (json.has("type"))
20399      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
20400    if (json.has("_type"))
20401      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
20402  }
20403
20404  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
20405    PaymentNotice res = new PaymentNotice();
20406    parsePaymentNoticeProperties(json, res);
20407    return res;
20408  }
20409
20410  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
20411    parseDomainResourceProperties(json, res);
20412    if (json.has("identifier")) {
20413      JsonArray array = json.getAsJsonArray("identifier");
20414      for (int i = 0; i < array.size(); i++) {
20415        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20416      }
20417    };
20418    if (json.has("status"))
20419      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
20420    if (json.has("_status"))
20421      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20422    if (json.has("request"))
20423      res.setRequest(parseReference(getJObject(json, "request")));
20424    if (json.has("response"))
20425      res.setResponse(parseReference(getJObject(json, "response")));
20426    if (json.has("created"))
20427      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
20428    if (json.has("_created"))
20429      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
20430    if (json.has("provider"))
20431      res.setProvider(parseReference(getJObject(json, "provider")));
20432    if (json.has("payment"))
20433      res.setPayment(parseReference(getJObject(json, "payment")));
20434    if (json.has("paymentDate"))
20435      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
20436    if (json.has("_paymentDate"))
20437      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
20438    if (json.has("payee"))
20439      res.setPayee(parseReference(getJObject(json, "payee")));
20440    if (json.has("recipient"))
20441      res.setRecipient(parseReference(getJObject(json, "recipient")));
20442    if (json.has("amount"))
20443      res.setAmount(parseMoney(getJObject(json, "amount")));
20444    if (json.has("paymentStatus"))
20445      res.setPaymentStatus(parseCodeableConcept(getJObject(json, "paymentStatus")));
20446  }
20447
20448  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
20449    PaymentReconciliation res = new PaymentReconciliation();
20450    parsePaymentReconciliationProperties(json, res);
20451    return res;
20452  }
20453
20454  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
20455    parseDomainResourceProperties(json, res);
20456    if (json.has("identifier")) {
20457      JsonArray array = json.getAsJsonArray("identifier");
20458      for (int i = 0; i < array.size(); i++) {
20459        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20460      }
20461    };
20462    if (json.has("status"))
20463      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
20464    if (json.has("_status"))
20465      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20466    if (json.has("period"))
20467      res.setPeriod(parsePeriod(getJObject(json, "period")));
20468    if (json.has("created"))
20469      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
20470    if (json.has("_created"))
20471      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
20472    if (json.has("paymentIssuer"))
20473      res.setPaymentIssuer(parseReference(getJObject(json, "paymentIssuer")));
20474    if (json.has("request"))
20475      res.setRequest(parseReference(getJObject(json, "request")));
20476    if (json.has("requestor"))
20477      res.setRequestor(parseReference(getJObject(json, "requestor")));
20478    if (json.has("outcome"))
20479      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
20480    if (json.has("_outcome"))
20481      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
20482    if (json.has("disposition"))
20483      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
20484    if (json.has("_disposition"))
20485      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
20486    if (json.has("paymentDate"))
20487      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
20488    if (json.has("_paymentDate"))
20489      parseElementProperties(getJObject(json, "_paymentDate"), res.getPaymentDateElement());
20490    if (json.has("paymentAmount"))
20491      res.setPaymentAmount(parseMoney(getJObject(json, "paymentAmount")));
20492    if (json.has("paymentIdentifier"))
20493      res.setPaymentIdentifier(parseIdentifier(getJObject(json, "paymentIdentifier")));
20494    if (json.has("detail")) {
20495      JsonArray array = json.getAsJsonArray("detail");
20496      for (int i = 0; i < array.size(); i++) {
20497        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
20498      }
20499    };
20500    if (json.has("formCode"))
20501      res.setFormCode(parseCodeableConcept(getJObject(json, "formCode")));
20502    if (json.has("processNote")) {
20503      JsonArray array = json.getAsJsonArray("processNote");
20504      for (int i = 0; i < array.size(); i++) {
20505        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
20506      }
20507    };
20508  }
20509
20510  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
20511    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
20512    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
20513    return res;
20514  }
20515
20516  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
20517    parseBackboneElementProperties(json, res);
20518    if (json.has("identifier"))
20519      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
20520    if (json.has("predecessor"))
20521      res.setPredecessor(parseIdentifier(getJObject(json, "predecessor")));
20522    if (json.has("type"))
20523      res.setType(parseCodeableConcept(getJObject(json, "type")));
20524    if (json.has("request"))
20525      res.setRequest(parseReference(getJObject(json, "request")));
20526    if (json.has("submitter"))
20527      res.setSubmitter(parseReference(getJObject(json, "submitter")));
20528    if (json.has("response"))
20529      res.setResponse(parseReference(getJObject(json, "response")));
20530    if (json.has("date"))
20531      res.setDateElement(parseDate(json.get("date").getAsString()));
20532    if (json.has("_date"))
20533      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
20534    if (json.has("responsible"))
20535      res.setResponsible(parseReference(getJObject(json, "responsible")));
20536    if (json.has("payee"))
20537      res.setPayee(parseReference(getJObject(json, "payee")));
20538    if (json.has("amount"))
20539      res.setAmount(parseMoney(getJObject(json, "amount")));
20540  }
20541
20542  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
20543    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
20544    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
20545    return res;
20546  }
20547
20548  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
20549    parseBackboneElementProperties(json, res);
20550    if (json.has("type"))
20551      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
20552    if (json.has("_type"))
20553      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
20554    if (json.has("text"))
20555      res.setTextElement(parseString(json.get("text").getAsString()));
20556    if (json.has("_text"))
20557      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
20558  }
20559
20560  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
20561    Person res = new Person();
20562    parsePersonProperties(json, res);
20563    return res;
20564  }
20565
20566  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
20567    parseDomainResourceProperties(json, res);
20568    if (json.has("identifier")) {
20569      JsonArray array = json.getAsJsonArray("identifier");
20570      for (int i = 0; i < array.size(); i++) {
20571        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20572      }
20573    };
20574    if (json.has("name")) {
20575      JsonArray array = json.getAsJsonArray("name");
20576      for (int i = 0; i < array.size(); i++) {
20577        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20578      }
20579    };
20580    if (json.has("telecom")) {
20581      JsonArray array = json.getAsJsonArray("telecom");
20582      for (int i = 0; i < array.size(); i++) {
20583        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20584      }
20585    };
20586    if (json.has("gender"))
20587      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20588    if (json.has("_gender"))
20589      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
20590    if (json.has("birthDate"))
20591      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20592    if (json.has("_birthDate"))
20593      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
20594    if (json.has("address")) {
20595      JsonArray array = json.getAsJsonArray("address");
20596      for (int i = 0; i < array.size(); i++) {
20597        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20598      }
20599    };
20600    if (json.has("photo"))
20601      res.setPhoto(parseAttachment(getJObject(json, "photo")));
20602    if (json.has("managingOrganization"))
20603      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
20604    if (json.has("active"))
20605      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20606    if (json.has("_active"))
20607      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
20608    if (json.has("link")) {
20609      JsonArray array = json.getAsJsonArray("link");
20610      for (int i = 0; i < array.size(); i++) {
20611        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
20612      }
20613    };
20614  }
20615
20616  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
20617    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
20618    parsePersonPersonLinkComponentProperties(json, owner, res);
20619    return res;
20620  }
20621
20622  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
20623    parseBackboneElementProperties(json, res);
20624    if (json.has("target"))
20625      res.setTarget(parseReference(getJObject(json, "target")));
20626    if (json.has("assurance"))
20627      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
20628    if (json.has("_assurance"))
20629      parseElementProperties(getJObject(json, "_assurance"), res.getAssuranceElement());
20630  }
20631
20632  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
20633    PlanDefinition res = new PlanDefinition();
20634    parsePlanDefinitionProperties(json, res);
20635    return res;
20636  }
20637
20638  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
20639    parseDomainResourceProperties(json, res);
20640    if (json.has("url"))
20641      res.setUrlElement(parseUri(json.get("url").getAsString()));
20642    if (json.has("_url"))
20643      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
20644    if (json.has("identifier")) {
20645      JsonArray array = json.getAsJsonArray("identifier");
20646      for (int i = 0; i < array.size(); i++) {
20647        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20648      }
20649    };
20650    if (json.has("version"))
20651      res.setVersionElement(parseString(json.get("version").getAsString()));
20652    if (json.has("_version"))
20653      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
20654    if (json.has("name"))
20655      res.setNameElement(parseString(json.get("name").getAsString()));
20656    if (json.has("_name"))
20657      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
20658    if (json.has("title"))
20659      res.setTitleElement(parseString(json.get("title").getAsString()));
20660    if (json.has("_title"))
20661      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
20662    if (json.has("subtitle"))
20663      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
20664    if (json.has("_subtitle"))
20665      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
20666    if (json.has("type"))
20667      res.setType(parseCodeableConcept(getJObject(json, "type")));
20668    if (json.has("status"))
20669      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20670    if (json.has("_status"))
20671      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
20672    if (json.has("experimental"))
20673      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20674    if (json.has("_experimental"))
20675      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
20676    Type subject = parseType("subject", json);
20677    if (subject != null)
20678      res.setSubject(subject);
20679    if (json.has("date"))
20680      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20681    if (json.has("_date"))
20682      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
20683    if (json.has("publisher"))
20684      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20685    if (json.has("_publisher"))
20686      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
20687    if (json.has("contact")) {
20688      JsonArray array = json.getAsJsonArray("contact");
20689      for (int i = 0; i < array.size(); i++) {
20690        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20691      }
20692    };
20693    if (json.has("description"))
20694      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20695    if (json.has("_description"))
20696      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20697    if (json.has("useContext")) {
20698      JsonArray array = json.getAsJsonArray("useContext");
20699      for (int i = 0; i < array.size(); i++) {
20700        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20701      }
20702    };
20703    if (json.has("jurisdiction")) {
20704      JsonArray array = json.getAsJsonArray("jurisdiction");
20705      for (int i = 0; i < array.size(); i++) {
20706        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20707      }
20708    };
20709    if (json.has("purpose"))
20710      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20711    if (json.has("_purpose"))
20712      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
20713    if (json.has("usage"))
20714      res.setUsageElement(parseString(json.get("usage").getAsString()));
20715    if (json.has("_usage"))
20716      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
20717    if (json.has("copyright"))
20718      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20719    if (json.has("_copyright"))
20720      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
20721    if (json.has("approvalDate"))
20722      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
20723    if (json.has("_approvalDate"))
20724      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
20725    if (json.has("lastReviewDate"))
20726      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
20727    if (json.has("_lastReviewDate"))
20728      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
20729    if (json.has("effectivePeriod"))
20730      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
20731    if (json.has("topic")) {
20732      JsonArray array = json.getAsJsonArray("topic");
20733      for (int i = 0; i < array.size(); i++) {
20734        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20735      }
20736    };
20737    if (json.has("author")) {
20738      JsonArray array = json.getAsJsonArray("author");
20739      for (int i = 0; i < array.size(); i++) {
20740        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20741      }
20742    };
20743    if (json.has("editor")) {
20744      JsonArray array = json.getAsJsonArray("editor");
20745      for (int i = 0; i < array.size(); i++) {
20746        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20747      }
20748    };
20749    if (json.has("reviewer")) {
20750      JsonArray array = json.getAsJsonArray("reviewer");
20751      for (int i = 0; i < array.size(); i++) {
20752        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
20753      }
20754    };
20755    if (json.has("endorser")) {
20756      JsonArray array = json.getAsJsonArray("endorser");
20757      for (int i = 0; i < array.size(); i++) {
20758        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
20759      }
20760    };
20761    if (json.has("relatedArtifact")) {
20762      JsonArray array = json.getAsJsonArray("relatedArtifact");
20763      for (int i = 0; i < array.size(); i++) {
20764        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20765      }
20766    };
20767    if (json.has("library")) {
20768      JsonArray array = json.getAsJsonArray("library");
20769      for (int i = 0; i < array.size(); i++) {
20770        if (array.get(i).isJsonNull()) {
20771          res.getLibrary().add(new CanonicalType());
20772        } else {
20773          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
20774        }
20775      }
20776    };
20777    if (json.has("_library")) {
20778      JsonArray array = json.getAsJsonArray("_library");
20779      for (int i = 0; i < array.size(); i++) {
20780        if (i == res.getLibrary().size())
20781          res.getLibrary().add(parseCanonical(null));
20782        if (array.get(i) instanceof JsonObject) 
20783          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
20784      }
20785    };
20786    if (json.has("goal")) {
20787      JsonArray array = json.getAsJsonArray("goal");
20788      for (int i = 0; i < array.size(); i++) {
20789        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
20790      }
20791    };
20792    if (json.has("action")) {
20793      JsonArray array = json.getAsJsonArray("action");
20794      for (int i = 0; i < array.size(); i++) {
20795        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
20796      }
20797    };
20798  }
20799
20800  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20801    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
20802    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
20803    return res;
20804  }
20805
20806  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
20807    parseBackboneElementProperties(json, res);
20808    if (json.has("category"))
20809      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
20810    if (json.has("description"))
20811      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
20812    if (json.has("priority"))
20813      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
20814    if (json.has("start"))
20815      res.setStart(parseCodeableConcept(getJObject(json, "start")));
20816    if (json.has("addresses")) {
20817      JsonArray array = json.getAsJsonArray("addresses");
20818      for (int i = 0; i < array.size(); i++) {
20819        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20820      }
20821    };
20822    if (json.has("documentation")) {
20823      JsonArray array = json.getAsJsonArray("documentation");
20824      for (int i = 0; i < array.size(); i++) {
20825        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20826      }
20827    };
20828    if (json.has("target")) {
20829      JsonArray array = json.getAsJsonArray("target");
20830      for (int i = 0; i < array.size(); i++) {
20831        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
20832      }
20833    };
20834  }
20835
20836  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20837    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
20838    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
20839    return res;
20840  }
20841
20842  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
20843    parseBackboneElementProperties(json, res);
20844    if (json.has("measure"))
20845      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
20846    Type detail = parseType("detail", json);
20847    if (detail != null)
20848      res.setDetail(detail);
20849    if (json.has("due"))
20850      res.setDue(parseDuration(getJObject(json, "due")));
20851  }
20852
20853  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20854    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
20855    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
20856    return res;
20857  }
20858
20859  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
20860    parseBackboneElementProperties(json, res);
20861    if (json.has("prefix"))
20862      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
20863    if (json.has("_prefix"))
20864      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
20865    if (json.has("title"))
20866      res.setTitleElement(parseString(json.get("title").getAsString()));
20867    if (json.has("_title"))
20868      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
20869    if (json.has("description"))
20870      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20871    if (json.has("_description"))
20872      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
20873    if (json.has("textEquivalent"))
20874      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
20875    if (json.has("_textEquivalent"))
20876      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
20877    if (json.has("priority"))
20878      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), PlanDefinition.RequestPriority.NULL, new PlanDefinition.RequestPriorityEnumFactory()));
20879    if (json.has("_priority"))
20880      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
20881    if (json.has("code")) {
20882      JsonArray array = json.getAsJsonArray("code");
20883      for (int i = 0; i < array.size(); i++) {
20884        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20885      }
20886    };
20887    if (json.has("reason")) {
20888      JsonArray array = json.getAsJsonArray("reason");
20889      for (int i = 0; i < array.size(); i++) {
20890        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20891      }
20892    };
20893    if (json.has("documentation")) {
20894      JsonArray array = json.getAsJsonArray("documentation");
20895      for (int i = 0; i < array.size(); i++) {
20896        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20897      }
20898    };
20899    if (json.has("goalId")) {
20900      JsonArray array = json.getAsJsonArray("goalId");
20901      for (int i = 0; i < array.size(); i++) {
20902        if (array.get(i).isJsonNull()) {
20903          res.getGoalId().add(new IdType());
20904        } else {
20905          res.getGoalId().add(parseId(array.get(i).getAsString()));
20906        }
20907      }
20908    };
20909    if (json.has("_goalId")) {
20910      JsonArray array = json.getAsJsonArray("_goalId");
20911      for (int i = 0; i < array.size(); i++) {
20912        if (i == res.getGoalId().size())
20913          res.getGoalId().add(parseId(null));
20914        if (array.get(i) instanceof JsonObject) 
20915          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
20916      }
20917    };
20918    Type subject = parseType("subject", json);
20919    if (subject != null)
20920      res.setSubject(subject);
20921    if (json.has("trigger")) {
20922      JsonArray array = json.getAsJsonArray("trigger");
20923      for (int i = 0; i < array.size(); i++) {
20924        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
20925      }
20926    };
20927    if (json.has("condition")) {
20928      JsonArray array = json.getAsJsonArray("condition");
20929      for (int i = 0; i < array.size(); i++) {
20930        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
20931      }
20932    };
20933    if (json.has("input")) {
20934      JsonArray array = json.getAsJsonArray("input");
20935      for (int i = 0; i < array.size(); i++) {
20936        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
20937      }
20938    };
20939    if (json.has("output")) {
20940      JsonArray array = json.getAsJsonArray("output");
20941      for (int i = 0; i < array.size(); i++) {
20942        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
20943      }
20944    };
20945    if (json.has("relatedAction")) {
20946      JsonArray array = json.getAsJsonArray("relatedAction");
20947      for (int i = 0; i < array.size(); i++) {
20948        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
20949      }
20950    };
20951    Type timing = parseType("timing", json);
20952    if (timing != null)
20953      res.setTiming(timing);
20954    if (json.has("participant")) {
20955      JsonArray array = json.getAsJsonArray("participant");
20956      for (int i = 0; i < array.size(); i++) {
20957        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
20958      }
20959    };
20960    if (json.has("type"))
20961      res.setType(parseCodeableConcept(getJObject(json, "type")));
20962    if (json.has("groupingBehavior"))
20963      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
20964    if (json.has("_groupingBehavior"))
20965      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
20966    if (json.has("selectionBehavior"))
20967      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
20968    if (json.has("_selectionBehavior"))
20969      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
20970    if (json.has("requiredBehavior"))
20971      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
20972    if (json.has("_requiredBehavior"))
20973      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
20974    if (json.has("precheckBehavior"))
20975      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
20976    if (json.has("_precheckBehavior"))
20977      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
20978    if (json.has("cardinalityBehavior"))
20979      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
20980    if (json.has("_cardinalityBehavior"))
20981      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
20982    Type definition = parseType("definition", json);
20983    if (definition != null)
20984      res.setDefinition(definition);
20985    if (json.has("transform"))
20986      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
20987    if (json.has("_transform"))
20988      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
20989    if (json.has("dynamicValue")) {
20990      JsonArray array = json.getAsJsonArray("dynamicValue");
20991      for (int i = 0; i < array.size(); i++) {
20992        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
20993      }
20994    };
20995    if (json.has("action")) {
20996      JsonArray array = json.getAsJsonArray("action");
20997      for (int i = 0; i < array.size(); i++) {
20998        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
20999      }
21000    };
21001  }
21002
21003  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21004    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
21005    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
21006    return res;
21007  }
21008
21009  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
21010    parseBackboneElementProperties(json, res);
21011    if (json.has("kind"))
21012      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
21013    if (json.has("_kind"))
21014      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
21015    if (json.has("expression"))
21016      res.setExpression(parseExpression(getJObject(json, "expression")));
21017  }
21018
21019  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21020    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
21021    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
21022    return res;
21023  }
21024
21025  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
21026    parseBackboneElementProperties(json, res);
21027    if (json.has("actionId"))
21028      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
21029    if (json.has("_actionId"))
21030      parseElementProperties(getJObject(json, "_actionId"), res.getActionIdElement());
21031    if (json.has("relationship"))
21032      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
21033    if (json.has("_relationship"))
21034      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
21035    Type offset = parseType("offset", json);
21036    if (offset != null)
21037      res.setOffset(offset);
21038  }
21039
21040  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21041    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
21042    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
21043    return res;
21044  }
21045
21046  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
21047    parseBackboneElementProperties(json, res);
21048    if (json.has("type"))
21049      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
21050    if (json.has("_type"))
21051      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
21052    if (json.has("role"))
21053      res.setRole(parseCodeableConcept(getJObject(json, "role")));
21054  }
21055
21056  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
21057    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
21058    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
21059    return res;
21060  }
21061
21062  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
21063    parseBackboneElementProperties(json, res);
21064    if (json.has("path"))
21065      res.setPathElement(parseString(json.get("path").getAsString()));
21066    if (json.has("_path"))
21067      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
21068    if (json.has("expression"))
21069      res.setExpression(parseExpression(getJObject(json, "expression")));
21070  }
21071
21072  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
21073    Practitioner res = new Practitioner();
21074    parsePractitionerProperties(json, res);
21075    return res;
21076  }
21077
21078  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
21079    parseDomainResourceProperties(json, res);
21080    if (json.has("identifier")) {
21081      JsonArray array = json.getAsJsonArray("identifier");
21082      for (int i = 0; i < array.size(); i++) {
21083        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21084      }
21085    };
21086    if (json.has("active"))
21087      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21088    if (json.has("_active"))
21089      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
21090    if (json.has("name")) {
21091      JsonArray array = json.getAsJsonArray("name");
21092      for (int i = 0; i < array.size(); i++) {
21093        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
21094      }
21095    };
21096    if (json.has("telecom")) {
21097      JsonArray array = json.getAsJsonArray("telecom");
21098      for (int i = 0; i < array.size(); i++) {
21099        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21100      }
21101    };
21102    if (json.has("address")) {
21103      JsonArray array = json.getAsJsonArray("address");
21104      for (int i = 0; i < array.size(); i++) {
21105        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
21106      }
21107    };
21108    if (json.has("gender"))
21109      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21110    if (json.has("_gender"))
21111      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
21112    if (json.has("birthDate"))
21113      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
21114    if (json.has("_birthDate"))
21115      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
21116    if (json.has("photo")) {
21117      JsonArray array = json.getAsJsonArray("photo");
21118      for (int i = 0; i < array.size(); i++) {
21119        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
21120      }
21121    };
21122    if (json.has("qualification")) {
21123      JsonArray array = json.getAsJsonArray("qualification");
21124      for (int i = 0; i < array.size(); i++) {
21125        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
21126      }
21127    };
21128    if (json.has("communication")) {
21129      JsonArray array = json.getAsJsonArray("communication");
21130      for (int i = 0; i < array.size(); i++) {
21131        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21132      }
21133    };
21134  }
21135
21136  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
21137    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
21138    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
21139    return res;
21140  }
21141
21142  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
21143    parseBackboneElementProperties(json, res);
21144    if (json.has("identifier")) {
21145      JsonArray array = json.getAsJsonArray("identifier");
21146      for (int i = 0; i < array.size(); i++) {
21147        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21148      }
21149    };
21150    if (json.has("code"))
21151      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21152    if (json.has("period"))
21153      res.setPeriod(parsePeriod(getJObject(json, "period")));
21154    if (json.has("issuer"))
21155      res.setIssuer(parseReference(getJObject(json, "issuer")));
21156  }
21157
21158  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
21159    PractitionerRole res = new PractitionerRole();
21160    parsePractitionerRoleProperties(json, res);
21161    return res;
21162  }
21163
21164  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
21165    parseDomainResourceProperties(json, res);
21166    if (json.has("identifier")) {
21167      JsonArray array = json.getAsJsonArray("identifier");
21168      for (int i = 0; i < array.size(); i++) {
21169        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21170      }
21171    };
21172    if (json.has("active"))
21173      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21174    if (json.has("_active"))
21175      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
21176    if (json.has("period"))
21177      res.setPeriod(parsePeriod(getJObject(json, "period")));
21178    if (json.has("practitioner"))
21179      res.setPractitioner(parseReference(getJObject(json, "practitioner")));
21180    if (json.has("organization"))
21181      res.setOrganization(parseReference(getJObject(json, "organization")));
21182    if (json.has("code")) {
21183      JsonArray array = json.getAsJsonArray("code");
21184      for (int i = 0; i < array.size(); i++) {
21185        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21186      }
21187    };
21188    if (json.has("specialty")) {
21189      JsonArray array = json.getAsJsonArray("specialty");
21190      for (int i = 0; i < array.size(); i++) {
21191        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21192      }
21193    };
21194    if (json.has("location")) {
21195      JsonArray array = json.getAsJsonArray("location");
21196      for (int i = 0; i < array.size(); i++) {
21197        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
21198      }
21199    };
21200    if (json.has("healthcareService")) {
21201      JsonArray array = json.getAsJsonArray("healthcareService");
21202      for (int i = 0; i < array.size(); i++) {
21203        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
21204      }
21205    };
21206    if (json.has("telecom")) {
21207      JsonArray array = json.getAsJsonArray("telecom");
21208      for (int i = 0; i < array.size(); i++) {
21209        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21210      }
21211    };
21212    if (json.has("availableTime")) {
21213      JsonArray array = json.getAsJsonArray("availableTime");
21214      for (int i = 0; i < array.size(); i++) {
21215        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
21216      }
21217    };
21218    if (json.has("notAvailable")) {
21219      JsonArray array = json.getAsJsonArray("notAvailable");
21220      for (int i = 0; i < array.size(); i++) {
21221        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
21222      }
21223    };
21224    if (json.has("availabilityExceptions"))
21225      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
21226    if (json.has("_availabilityExceptions"))
21227      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
21228    if (json.has("endpoint")) {
21229      JsonArray array = json.getAsJsonArray("endpoint");
21230      for (int i = 0; i < array.size(); i++) {
21231        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
21232      }
21233    };
21234  }
21235
21236  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
21237    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
21238    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
21239    return res;
21240  }
21241
21242  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
21243    parseBackboneElementProperties(json, res);
21244    if (json.has("daysOfWeek")) {
21245      JsonArray array = json.getAsJsonArray("daysOfWeek");
21246      for (int i = 0; i < array.size(); i++) {
21247        if (array.get(i).isJsonNull()) {
21248          res.getDaysOfWeek().add(new Enumeration<PractitionerRole.DaysOfWeek>());
21249        } else {
21250          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
21251        }
21252      }
21253    };
21254    if (json.has("_daysOfWeek")) {
21255      JsonArray array = json.getAsJsonArray("_daysOfWeek");
21256      for (int i = 0; i < array.size(); i++) {
21257        if (i == res.getDaysOfWeek().size())
21258          res.getDaysOfWeek().add(parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
21259        if (array.get(i) instanceof JsonObject) 
21260          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
21261      }
21262    };
21263    if (json.has("allDay"))
21264      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
21265    if (json.has("_allDay"))
21266      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
21267    if (json.has("availableStartTime"))
21268      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
21269    if (json.has("_availableStartTime"))
21270      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
21271    if (json.has("availableEndTime"))
21272      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
21273    if (json.has("_availableEndTime"))
21274      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
21275  }
21276
21277  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
21278    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
21279    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
21280    return res;
21281  }
21282
21283  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
21284    parseBackboneElementProperties(json, res);
21285    if (json.has("description"))
21286      res.setDescriptionElement(parseString(json.get("description").getAsString()));
21287    if (json.has("_description"))
21288      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21289    if (json.has("during"))
21290      res.setDuring(parsePeriod(getJObject(json, "during")));
21291  }
21292
21293  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
21294    Procedure res = new Procedure();
21295    parseProcedureProperties(json, res);
21296    return res;
21297  }
21298
21299  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
21300    parseDomainResourceProperties(json, res);
21301    if (json.has("identifier")) {
21302      JsonArray array = json.getAsJsonArray("identifier");
21303      for (int i = 0; i < array.size(); i++) {
21304        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21305      }
21306    };
21307    if (json.has("instantiatesCanonical")) {
21308      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
21309      for (int i = 0; i < array.size(); i++) {
21310        if (array.get(i).isJsonNull()) {
21311          res.getInstantiatesCanonical().add(new CanonicalType());
21312        } else {
21313          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
21314        }
21315      }
21316    };
21317    if (json.has("_instantiatesCanonical")) {
21318      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
21319      for (int i = 0; i < array.size(); i++) {
21320        if (i == res.getInstantiatesCanonical().size())
21321          res.getInstantiatesCanonical().add(parseCanonical(null));
21322        if (array.get(i) instanceof JsonObject) 
21323          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
21324      }
21325    };
21326    if (json.has("instantiatesUri")) {
21327      JsonArray array = json.getAsJsonArray("instantiatesUri");
21328      for (int i = 0; i < array.size(); i++) {
21329        if (array.get(i).isJsonNull()) {
21330          res.getInstantiatesUri().add(new UriType());
21331        } else {
21332          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
21333        }
21334      }
21335    };
21336    if (json.has("_instantiatesUri")) {
21337      JsonArray array = json.getAsJsonArray("_instantiatesUri");
21338      for (int i = 0; i < array.size(); i++) {
21339        if (i == res.getInstantiatesUri().size())
21340          res.getInstantiatesUri().add(parseUri(null));
21341        if (array.get(i) instanceof JsonObject) 
21342          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
21343      }
21344    };
21345    if (json.has("basedOn")) {
21346      JsonArray array = json.getAsJsonArray("basedOn");
21347      for (int i = 0; i < array.size(); i++) {
21348        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21349      }
21350    };
21351    if (json.has("partOf")) {
21352      JsonArray array = json.getAsJsonArray("partOf");
21353      for (int i = 0; i < array.size(); i++) {
21354        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
21355      }
21356    };
21357    if (json.has("status"))
21358      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
21359    if (json.has("_status"))
21360      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21361    if (json.has("statusReason"))
21362      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
21363    if (json.has("category"))
21364      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
21365    if (json.has("code"))
21366      res.setCode(parseCodeableConcept(getJObject(json, "code")));
21367    if (json.has("subject"))
21368      res.setSubject(parseReference(getJObject(json, "subject")));
21369    if (json.has("encounter"))
21370      res.setEncounter(parseReference(getJObject(json, "encounter")));
21371    Type performed = parseType("performed", json);
21372    if (performed != null)
21373      res.setPerformed(performed);
21374    if (json.has("recorder"))
21375      res.setRecorder(parseReference(getJObject(json, "recorder")));
21376    if (json.has("asserter"))
21377      res.setAsserter(parseReference(getJObject(json, "asserter")));
21378    if (json.has("performer")) {
21379      JsonArray array = json.getAsJsonArray("performer");
21380      for (int i = 0; i < array.size(); i++) {
21381        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
21382      }
21383    };
21384    if (json.has("location"))
21385      res.setLocation(parseReference(getJObject(json, "location")));
21386    if (json.has("reasonCode")) {
21387      JsonArray array = json.getAsJsonArray("reasonCode");
21388      for (int i = 0; i < array.size(); i++) {
21389        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21390      }
21391    };
21392    if (json.has("reasonReference")) {
21393      JsonArray array = json.getAsJsonArray("reasonReference");
21394      for (int i = 0; i < array.size(); i++) {
21395        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
21396      }
21397    };
21398    if (json.has("bodySite")) {
21399      JsonArray array = json.getAsJsonArray("bodySite");
21400      for (int i = 0; i < array.size(); i++) {
21401        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21402      }
21403    };
21404    if (json.has("outcome"))
21405      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
21406    if (json.has("report")) {
21407      JsonArray array = json.getAsJsonArray("report");
21408      for (int i = 0; i < array.size(); i++) {
21409        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
21410      }
21411    };
21412    if (json.has("complication")) {
21413      JsonArray array = json.getAsJsonArray("complication");
21414      for (int i = 0; i < array.size(); i++) {
21415        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21416      }
21417    };
21418    if (json.has("complicationDetail")) {
21419      JsonArray array = json.getAsJsonArray("complicationDetail");
21420      for (int i = 0; i < array.size(); i++) {
21421        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
21422      }
21423    };
21424    if (json.has("followUp")) {
21425      JsonArray array = json.getAsJsonArray("followUp");
21426      for (int i = 0; i < array.size(); i++) {
21427        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21428      }
21429    };
21430    if (json.has("note")) {
21431      JsonArray array = json.getAsJsonArray("note");
21432      for (int i = 0; i < array.size(); i++) {
21433        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21434      }
21435    };
21436    if (json.has("focalDevice")) {
21437      JsonArray array = json.getAsJsonArray("focalDevice");
21438      for (int i = 0; i < array.size(); i++) {
21439        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
21440      }
21441    };
21442    if (json.has("usedReference")) {
21443      JsonArray array = json.getAsJsonArray("usedReference");
21444      for (int i = 0; i < array.size(); i++) {
21445        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
21446      }
21447    };
21448    if (json.has("usedCode")) {
21449      JsonArray array = json.getAsJsonArray("usedCode");
21450      for (int i = 0; i < array.size(); i++) {
21451        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21452      }
21453    };
21454  }
21455
21456  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
21457    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
21458    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
21459    return res;
21460  }
21461
21462  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
21463    parseBackboneElementProperties(json, res);
21464    if (json.has("function"))
21465      res.setFunction(parseCodeableConcept(getJObject(json, "function")));
21466    if (json.has("actor"))
21467      res.setActor(parseReference(getJObject(json, "actor")));
21468    if (json.has("onBehalfOf"))
21469      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
21470  }
21471
21472  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
21473    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
21474    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
21475    return res;
21476  }
21477
21478  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
21479    parseBackboneElementProperties(json, res);
21480    if (json.has("action"))
21481      res.setAction(parseCodeableConcept(getJObject(json, "action")));
21482    if (json.has("manipulated"))
21483      res.setManipulated(parseReference(getJObject(json, "manipulated")));
21484  }
21485
21486  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
21487    Provenance res = new Provenance();
21488    parseProvenanceProperties(json, res);
21489    return res;
21490  }
21491
21492  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
21493    parseDomainResourceProperties(json, res);
21494    if (json.has("target")) {
21495      JsonArray array = json.getAsJsonArray("target");
21496      for (int i = 0; i < array.size(); i++) {
21497        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
21498      }
21499    };
21500    Type occurred = parseType("occurred", json);
21501    if (occurred != null)
21502      res.setOccurred(occurred);
21503    if (json.has("recorded"))
21504      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
21505    if (json.has("_recorded"))
21506      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
21507    if (json.has("policy")) {
21508      JsonArray array = json.getAsJsonArray("policy");
21509      for (int i = 0; i < array.size(); i++) {
21510        if (array.get(i).isJsonNull()) {
21511          res.getPolicy().add(new UriType());
21512        } else {
21513          res.getPolicy().add(parseUri(array.get(i).getAsString()));
21514        }
21515      }
21516    };
21517    if (json.has("_policy")) {
21518      JsonArray array = json.getAsJsonArray("_policy");
21519      for (int i = 0; i < array.size(); i++) {
21520        if (i == res.getPolicy().size())
21521          res.getPolicy().add(parseUri(null));
21522        if (array.get(i) instanceof JsonObject) 
21523          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
21524      }
21525    };
21526    if (json.has("location"))
21527      res.setLocation(parseReference(getJObject(json, "location")));
21528    if (json.has("reason")) {
21529      JsonArray array = json.getAsJsonArray("reason");
21530      for (int i = 0; i < array.size(); i++) {
21531        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21532      }
21533    };
21534    if (json.has("activity"))
21535      res.setActivity(parseCodeableConcept(getJObject(json, "activity")));
21536    if (json.has("agent")) {
21537      JsonArray array = json.getAsJsonArray("agent");
21538      for (int i = 0; i < array.size(); i++) {
21539        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
21540      }
21541    };
21542    if (json.has("entity")) {
21543      JsonArray array = json.getAsJsonArray("entity");
21544      for (int i = 0; i < array.size(); i++) {
21545        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
21546      }
21547    };
21548    if (json.has("signature")) {
21549      JsonArray array = json.getAsJsonArray("signature");
21550      for (int i = 0; i < array.size(); i++) {
21551        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
21552      }
21553    };
21554  }
21555
21556  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
21557    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
21558    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
21559    return res;
21560  }
21561
21562  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
21563    parseBackboneElementProperties(json, res);
21564    if (json.has("type"))
21565      res.setType(parseCodeableConcept(getJObject(json, "type")));
21566    if (json.has("role")) {
21567      JsonArray array = json.getAsJsonArray("role");
21568      for (int i = 0; i < array.size(); i++) {
21569        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21570      }
21571    };
21572    if (json.has("who"))
21573      res.setWho(parseReference(getJObject(json, "who")));
21574    if (json.has("onBehalfOf"))
21575      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
21576  }
21577
21578  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
21579    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
21580    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
21581    return res;
21582  }
21583
21584  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
21585    parseBackboneElementProperties(json, res);
21586    if (json.has("role"))
21587      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
21588    if (json.has("_role"))
21589      parseElementProperties(getJObject(json, "_role"), res.getRoleElement());
21590    if (json.has("what"))
21591      res.setWhat(parseReference(getJObject(json, "what")));
21592    if (json.has("agent")) {
21593      JsonArray array = json.getAsJsonArray("agent");
21594      for (int i = 0; i < array.size(); i++) {
21595        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
21596      }
21597    };
21598  }
21599
21600  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
21601    Questionnaire res = new Questionnaire();
21602    parseQuestionnaireProperties(json, res);
21603    return res;
21604  }
21605
21606  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
21607    parseDomainResourceProperties(json, res);
21608    if (json.has("url"))
21609      res.setUrlElement(parseUri(json.get("url").getAsString()));
21610    if (json.has("_url"))
21611      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
21612    if (json.has("identifier")) {
21613      JsonArray array = json.getAsJsonArray("identifier");
21614      for (int i = 0; i < array.size(); i++) {
21615        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21616      }
21617    };
21618    if (json.has("version"))
21619      res.setVersionElement(parseString(json.get("version").getAsString()));
21620    if (json.has("_version"))
21621      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
21622    if (json.has("name"))
21623      res.setNameElement(parseString(json.get("name").getAsString()));
21624    if (json.has("_name"))
21625      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
21626    if (json.has("title"))
21627      res.setTitleElement(parseString(json.get("title").getAsString()));
21628    if (json.has("_title"))
21629      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
21630    if (json.has("derivedFrom")) {
21631      JsonArray array = json.getAsJsonArray("derivedFrom");
21632      for (int i = 0; i < array.size(); i++) {
21633        if (array.get(i).isJsonNull()) {
21634          res.getDerivedFrom().add(new CanonicalType());
21635        } else {
21636          res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
21637        }
21638      }
21639    };
21640    if (json.has("_derivedFrom")) {
21641      JsonArray array = json.getAsJsonArray("_derivedFrom");
21642      for (int i = 0; i < array.size(); i++) {
21643        if (i == res.getDerivedFrom().size())
21644          res.getDerivedFrom().add(parseCanonical(null));
21645        if (array.get(i) instanceof JsonObject) 
21646          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
21647      }
21648    };
21649    if (json.has("status"))
21650      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21651    if (json.has("_status"))
21652      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21653    if (json.has("experimental"))
21654      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21655    if (json.has("_experimental"))
21656      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
21657    if (json.has("subjectType")) {
21658      JsonArray array = json.getAsJsonArray("subjectType");
21659      for (int i = 0; i < array.size(); i++) {
21660        if (array.get(i).isJsonNull()) {
21661          res.getSubjectType().add(new CodeType());
21662        } else {
21663          res.getSubjectType().add(parseCode(array.get(i).getAsString()));
21664        }
21665      }
21666    };
21667    if (json.has("_subjectType")) {
21668      JsonArray array = json.getAsJsonArray("_subjectType");
21669      for (int i = 0; i < array.size(); i++) {
21670        if (i == res.getSubjectType().size())
21671          res.getSubjectType().add(parseCode(null));
21672        if (array.get(i) instanceof JsonObject) 
21673          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
21674      }
21675    };
21676    if (json.has("date"))
21677      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21678    if (json.has("_date"))
21679      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
21680    if (json.has("publisher"))
21681      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21682    if (json.has("_publisher"))
21683      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
21684    if (json.has("contact")) {
21685      JsonArray array = json.getAsJsonArray("contact");
21686      for (int i = 0; i < array.size(); i++) {
21687        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21688      }
21689    };
21690    if (json.has("description"))
21691      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21692    if (json.has("_description"))
21693      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
21694    if (json.has("useContext")) {
21695      JsonArray array = json.getAsJsonArray("useContext");
21696      for (int i = 0; i < array.size(); i++) {
21697        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21698      }
21699    };
21700    if (json.has("jurisdiction")) {
21701      JsonArray array = json.getAsJsonArray("jurisdiction");
21702      for (int i = 0; i < array.size(); i++) {
21703        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21704      }
21705    };
21706    if (json.has("purpose"))
21707      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21708    if (json.has("_purpose"))
21709      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
21710    if (json.has("copyright"))
21711      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21712    if (json.has("_copyright"))
21713      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
21714    if (json.has("approvalDate"))
21715      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21716    if (json.has("_approvalDate"))
21717      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
21718    if (json.has("lastReviewDate"))
21719      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
21720    if (json.has("_lastReviewDate"))
21721      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
21722    if (json.has("effectivePeriod"))
21723      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
21724    if (json.has("code")) {
21725      JsonArray array = json.getAsJsonArray("code");
21726      for (int i = 0; i < array.size(); i++) {
21727        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
21728      }
21729    };
21730    if (json.has("item")) {
21731      JsonArray array = json.getAsJsonArray("item");
21732      for (int i = 0; i < array.size(); i++) {
21733        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
21734      }
21735    };
21736  }
21737
21738  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21739    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
21740    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
21741    return res;
21742  }
21743
21744  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
21745    parseBackboneElementProperties(json, res);
21746    if (json.has("linkId"))
21747      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21748    if (json.has("_linkId"))
21749      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21750    if (json.has("definition"))
21751      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
21752    if (json.has("_definition"))
21753      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
21754    if (json.has("code")) {
21755      JsonArray array = json.getAsJsonArray("code");
21756      for (int i = 0; i < array.size(); i++) {
21757        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
21758      }
21759    };
21760    if (json.has("prefix"))
21761      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
21762    if (json.has("_prefix"))
21763      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
21764    if (json.has("text"))
21765      res.setTextElement(parseString(json.get("text").getAsString()));
21766    if (json.has("_text"))
21767      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
21768    if (json.has("type"))
21769      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
21770    if (json.has("_type"))
21771      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
21772    if (json.has("enableWhen")) {
21773      JsonArray array = json.getAsJsonArray("enableWhen");
21774      for (int i = 0; i < array.size(); i++) {
21775        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
21776      }
21777    };
21778    if (json.has("enableBehavior"))
21779      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(), Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
21780    if (json.has("_enableBehavior"))
21781      parseElementProperties(getJObject(json, "_enableBehavior"), res.getEnableBehaviorElement());
21782    if (json.has("required"))
21783      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
21784    if (json.has("_required"))
21785      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
21786    if (json.has("repeats"))
21787      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
21788    if (json.has("_repeats"))
21789      parseElementProperties(getJObject(json, "_repeats"), res.getRepeatsElement());
21790    if (json.has("readOnly"))
21791      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
21792    if (json.has("_readOnly"))
21793      parseElementProperties(getJObject(json, "_readOnly"), res.getReadOnlyElement());
21794    if (json.has("maxLength"))
21795      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
21796    if (json.has("_maxLength"))
21797      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
21798    if (json.has("answerValueSet"))
21799      res.setAnswerValueSetElement(parseCanonical(json.get("answerValueSet").getAsString()));
21800    if (json.has("_answerValueSet"))
21801      parseElementProperties(getJObject(json, "_answerValueSet"), res.getAnswerValueSetElement());
21802    if (json.has("answerOption")) {
21803      JsonArray array = json.getAsJsonArray("answerOption");
21804      for (int i = 0; i < array.size(); i++) {
21805        res.getAnswerOption().add(parseQuestionnaireQuestionnaireItemAnswerOptionComponent(array.get(i).getAsJsonObject(), owner));
21806      }
21807    };
21808    if (json.has("initial")) {
21809      JsonArray array = json.getAsJsonArray("initial");
21810      for (int i = 0; i < array.size(); i++) {
21811        res.getInitial().add(parseQuestionnaireQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject(), owner));
21812      }
21813    };
21814    if (json.has("item")) {
21815      JsonArray array = json.getAsJsonArray("item");
21816      for (int i = 0; i < array.size(); i++) {
21817        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
21818      }
21819    };
21820  }
21821
21822  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21823    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
21824    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
21825    return res;
21826  }
21827
21828  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
21829    parseBackboneElementProperties(json, res);
21830    if (json.has("question"))
21831      res.setQuestionElement(parseString(json.get("question").getAsString()));
21832    if (json.has("_question"))
21833      parseElementProperties(getJObject(json, "_question"), res.getQuestionElement());
21834    if (json.has("operator"))
21835      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
21836    if (json.has("_operator"))
21837      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
21838    Type answer = parseType("answer", json);
21839    if (answer != null)
21840      res.setAnswer(answer);
21841  }
21842
21843  protected Questionnaire.QuestionnaireItemAnswerOptionComponent parseQuestionnaireQuestionnaireItemAnswerOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21844    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
21845    parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(json, owner, res);
21846    return res;
21847  }
21848
21849  protected void parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemAnswerOptionComponent res) throws IOException, FHIRFormatError {
21850    parseBackboneElementProperties(json, res);
21851    Type value = parseType("value", json);
21852    if (value != null)
21853      res.setValue(value);
21854    if (json.has("initialSelected"))
21855      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
21856    if (json.has("_initialSelected"))
21857      parseElementProperties(getJObject(json, "_initialSelected"), res.getInitialSelectedElement());
21858  }
21859
21860  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireQuestionnaireItemInitialComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21861    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
21862    parseQuestionnaireQuestionnaireItemInitialComponentProperties(json, owner, res);
21863    return res;
21864  }
21865
21866  protected void parseQuestionnaireQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
21867    parseBackboneElementProperties(json, res);
21868    Type value = parseType("value", json);
21869    if (value != null)
21870      res.setValue(value);
21871  }
21872
21873  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
21874    QuestionnaireResponse res = new QuestionnaireResponse();
21875    parseQuestionnaireResponseProperties(json, res);
21876    return res;
21877  }
21878
21879  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
21880    parseDomainResourceProperties(json, res);
21881    if (json.has("identifier"))
21882      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
21883    if (json.has("basedOn")) {
21884      JsonArray array = json.getAsJsonArray("basedOn");
21885      for (int i = 0; i < array.size(); i++) {
21886        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21887      }
21888    };
21889    if (json.has("partOf")) {
21890      JsonArray array = json.getAsJsonArray("partOf");
21891      for (int i = 0; i < array.size(); i++) {
21892        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
21893      }
21894    };
21895    if (json.has("questionnaire"))
21896      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
21897    if (json.has("_questionnaire"))
21898      parseElementProperties(getJObject(json, "_questionnaire"), res.getQuestionnaireElement());
21899    if (json.has("status"))
21900      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
21901    if (json.has("_status"))
21902      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
21903    if (json.has("subject"))
21904      res.setSubject(parseReference(getJObject(json, "subject")));
21905    if (json.has("encounter"))
21906      res.setEncounter(parseReference(getJObject(json, "encounter")));
21907    if (json.has("authored"))
21908      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
21909    if (json.has("_authored"))
21910      parseElementProperties(getJObject(json, "_authored"), res.getAuthoredElement());
21911    if (json.has("author"))
21912      res.setAuthor(parseReference(getJObject(json, "author")));
21913    if (json.has("source"))
21914      res.setSource(parseReference(getJObject(json, "source")));
21915    if (json.has("item")) {
21916      JsonArray array = json.getAsJsonArray("item");
21917      for (int i = 0; i < array.size(); i++) {
21918        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
21919      }
21920    };
21921  }
21922
21923  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
21924    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
21925    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
21926    return res;
21927  }
21928
21929  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
21930    parseBackboneElementProperties(json, res);
21931    if (json.has("linkId"))
21932      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21933    if (json.has("_linkId"))
21934      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
21935    if (json.has("definition"))
21936      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
21937    if (json.has("_definition"))
21938      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
21939    if (json.has("text"))
21940      res.setTextElement(parseString(json.get("text").getAsString()));
21941    if (json.has("_text"))
21942      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
21943    if (json.has("answer")) {
21944      JsonArray array = json.getAsJsonArray("answer");
21945      for (int i = 0; i < array.size(); i++) {
21946        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
21947      }
21948    };
21949    if (json.has("item")) {
21950      JsonArray array = json.getAsJsonArray("item");
21951      for (int i = 0; i < array.size(); i++) {
21952        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
21953      }
21954    };
21955  }
21956
21957  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
21958    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
21959    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
21960    return res;
21961  }
21962
21963  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
21964    parseBackboneElementProperties(json, res);
21965    Type value = parseType("value", json);
21966    if (value != null)
21967      res.setValue(value);
21968    if (json.has("item")) {
21969      JsonArray array = json.getAsJsonArray("item");
21970      for (int i = 0; i < array.size(); i++) {
21971        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
21972      }
21973    };
21974  }
21975
21976  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
21977    RelatedPerson res = new RelatedPerson();
21978    parseRelatedPersonProperties(json, res);
21979    return res;
21980  }
21981
21982  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
21983    parseDomainResourceProperties(json, res);
21984    if (json.has("identifier")) {
21985      JsonArray array = json.getAsJsonArray("identifier");
21986      for (int i = 0; i < array.size(); i++) {
21987        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21988      }
21989    };
21990    if (json.has("active"))
21991      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21992    if (json.has("_active"))
21993      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
21994    if (json.has("patient"))
21995      res.setPatient(parseReference(getJObject(json, "patient")));
21996    if (json.has("relationship")) {
21997      JsonArray array = json.getAsJsonArray("relationship");
21998      for (int i = 0; i < array.size(); i++) {
21999        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22000      }
22001    };
22002    if (json.has("name")) {
22003      JsonArray array = json.getAsJsonArray("name");
22004      for (int i = 0; i < array.size(); i++) {
22005        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
22006      }
22007    };
22008    if (json.has("telecom")) {
22009      JsonArray array = json.getAsJsonArray("telecom");
22010      for (int i = 0; i < array.size(); i++) {
22011        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
22012      }
22013    };
22014    if (json.has("gender"))
22015      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
22016    if (json.has("_gender"))
22017      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
22018    if (json.has("birthDate"))
22019      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
22020    if (json.has("_birthDate"))
22021      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
22022    if (json.has("address")) {
22023      JsonArray array = json.getAsJsonArray("address");
22024      for (int i = 0; i < array.size(); i++) {
22025        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
22026      }
22027    };
22028    if (json.has("photo")) {
22029      JsonArray array = json.getAsJsonArray("photo");
22030      for (int i = 0; i < array.size(); i++) {
22031        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
22032      }
22033    };
22034    if (json.has("period"))
22035      res.setPeriod(parsePeriod(getJObject(json, "period")));
22036    if (json.has("communication")) {
22037      JsonArray array = json.getAsJsonArray("communication");
22038      for (int i = 0; i < array.size(); i++) {
22039        res.getCommunication().add(parseRelatedPersonRelatedPersonCommunicationComponent(array.get(i).getAsJsonObject(), res));
22040      }
22041    };
22042  }
22043
22044  protected RelatedPerson.RelatedPersonCommunicationComponent parseRelatedPersonRelatedPersonCommunicationComponent(JsonObject json, RelatedPerson owner) throws IOException, FHIRFormatError {
22045    RelatedPerson.RelatedPersonCommunicationComponent res = new RelatedPerson.RelatedPersonCommunicationComponent();
22046    parseRelatedPersonRelatedPersonCommunicationComponentProperties(json, owner, res);
22047    return res;
22048  }
22049
22050  protected void parseRelatedPersonRelatedPersonCommunicationComponentProperties(JsonObject json, RelatedPerson owner, RelatedPerson.RelatedPersonCommunicationComponent res) throws IOException, FHIRFormatError {
22051    parseBackboneElementProperties(json, res);
22052    if (json.has("language"))
22053      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
22054    if (json.has("preferred"))
22055      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
22056    if (json.has("_preferred"))
22057      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
22058  }
22059
22060  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
22061    RequestGroup res = new RequestGroup();
22062    parseRequestGroupProperties(json, res);
22063    return res;
22064  }
22065
22066  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
22067    parseDomainResourceProperties(json, res);
22068    if (json.has("identifier")) {
22069      JsonArray array = json.getAsJsonArray("identifier");
22070      for (int i = 0; i < array.size(); i++) {
22071        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22072      }
22073    };
22074    if (json.has("instantiatesCanonical")) {
22075      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
22076      for (int i = 0; i < array.size(); i++) {
22077        if (array.get(i).isJsonNull()) {
22078          res.getInstantiatesCanonical().add(new CanonicalType());
22079        } else {
22080          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
22081        }
22082      }
22083    };
22084    if (json.has("_instantiatesCanonical")) {
22085      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
22086      for (int i = 0; i < array.size(); i++) {
22087        if (i == res.getInstantiatesCanonical().size())
22088          res.getInstantiatesCanonical().add(parseCanonical(null));
22089        if (array.get(i) instanceof JsonObject) 
22090          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
22091      }
22092    };
22093    if (json.has("instantiatesUri")) {
22094      JsonArray array = json.getAsJsonArray("instantiatesUri");
22095      for (int i = 0; i < array.size(); i++) {
22096        if (array.get(i).isJsonNull()) {
22097          res.getInstantiatesUri().add(new UriType());
22098        } else {
22099          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
22100        }
22101      }
22102    };
22103    if (json.has("_instantiatesUri")) {
22104      JsonArray array = json.getAsJsonArray("_instantiatesUri");
22105      for (int i = 0; i < array.size(); i++) {
22106        if (i == res.getInstantiatesUri().size())
22107          res.getInstantiatesUri().add(parseUri(null));
22108        if (array.get(i) instanceof JsonObject) 
22109          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
22110      }
22111    };
22112    if (json.has("basedOn")) {
22113      JsonArray array = json.getAsJsonArray("basedOn");
22114      for (int i = 0; i < array.size(); i++) {
22115        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22116      }
22117    };
22118    if (json.has("replaces")) {
22119      JsonArray array = json.getAsJsonArray("replaces");
22120      for (int i = 0; i < array.size(); i++) {
22121        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
22122      }
22123    };
22124    if (json.has("groupIdentifier"))
22125      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
22126    if (json.has("status"))
22127      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
22128    if (json.has("_status"))
22129      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22130    if (json.has("intent"))
22131      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
22132    if (json.has("_intent"))
22133      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
22134    if (json.has("priority"))
22135      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
22136    if (json.has("_priority"))
22137      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
22138    if (json.has("code"))
22139      res.setCode(parseCodeableConcept(getJObject(json, "code")));
22140    if (json.has("subject"))
22141      res.setSubject(parseReference(getJObject(json, "subject")));
22142    if (json.has("encounter"))
22143      res.setEncounter(parseReference(getJObject(json, "encounter")));
22144    if (json.has("authoredOn"))
22145      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
22146    if (json.has("_authoredOn"))
22147      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
22148    if (json.has("author"))
22149      res.setAuthor(parseReference(getJObject(json, "author")));
22150    if (json.has("reasonCode")) {
22151      JsonArray array = json.getAsJsonArray("reasonCode");
22152      for (int i = 0; i < array.size(); i++) {
22153        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22154      }
22155    };
22156    if (json.has("reasonReference")) {
22157      JsonArray array = json.getAsJsonArray("reasonReference");
22158      for (int i = 0; i < array.size(); i++) {
22159        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
22160      }
22161    };
22162    if (json.has("note")) {
22163      JsonArray array = json.getAsJsonArray("note");
22164      for (int i = 0; i < array.size(); i++) {
22165        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22166      }
22167    };
22168    if (json.has("action")) {
22169      JsonArray array = json.getAsJsonArray("action");
22170      for (int i = 0; i < array.size(); i++) {
22171        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
22172      }
22173    };
22174  }
22175
22176  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
22177    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
22178    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
22179    return res;
22180  }
22181
22182  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
22183    parseBackboneElementProperties(json, res);
22184    if (json.has("prefix"))
22185      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
22186    if (json.has("_prefix"))
22187      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
22188    if (json.has("title"))
22189      res.setTitleElement(parseString(json.get("title").getAsString()));
22190    if (json.has("_title"))
22191      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
22192    if (json.has("description"))
22193      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22194    if (json.has("_description"))
22195      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22196    if (json.has("textEquivalent"))
22197      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
22198    if (json.has("_textEquivalent"))
22199      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
22200    if (json.has("priority"))
22201      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
22202    if (json.has("_priority"))
22203      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
22204    if (json.has("code")) {
22205      JsonArray array = json.getAsJsonArray("code");
22206      for (int i = 0; i < array.size(); i++) {
22207        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22208      }
22209    };
22210    if (json.has("documentation")) {
22211      JsonArray array = json.getAsJsonArray("documentation");
22212      for (int i = 0; i < array.size(); i++) {
22213        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22214      }
22215    };
22216    if (json.has("condition")) {
22217      JsonArray array = json.getAsJsonArray("condition");
22218      for (int i = 0; i < array.size(); i++) {
22219        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
22220      }
22221    };
22222    if (json.has("relatedAction")) {
22223      JsonArray array = json.getAsJsonArray("relatedAction");
22224      for (int i = 0; i < array.size(); i++) {
22225        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
22226      }
22227    };
22228    Type timing = parseType("timing", json);
22229    if (timing != null)
22230      res.setTiming(timing);
22231    if (json.has("participant")) {
22232      JsonArray array = json.getAsJsonArray("participant");
22233      for (int i = 0; i < array.size(); i++) {
22234        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
22235      }
22236    };
22237    if (json.has("type"))
22238      res.setType(parseCodeableConcept(getJObject(json, "type")));
22239    if (json.has("groupingBehavior"))
22240      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
22241    if (json.has("_groupingBehavior"))
22242      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
22243    if (json.has("selectionBehavior"))
22244      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
22245    if (json.has("_selectionBehavior"))
22246      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
22247    if (json.has("requiredBehavior"))
22248      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
22249    if (json.has("_requiredBehavior"))
22250      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
22251    if (json.has("precheckBehavior"))
22252      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
22253    if (json.has("_precheckBehavior"))
22254      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
22255    if (json.has("cardinalityBehavior"))
22256      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
22257    if (json.has("_cardinalityBehavior"))
22258      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
22259    if (json.has("resource"))
22260      res.setResource(parseReference(getJObject(json, "resource")));
22261    if (json.has("action")) {
22262      JsonArray array = json.getAsJsonArray("action");
22263      for (int i = 0; i < array.size(); i++) {
22264        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
22265      }
22266    };
22267  }
22268
22269  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
22270    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
22271    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
22272    return res;
22273  }
22274
22275  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
22276    parseBackboneElementProperties(json, res);
22277    if (json.has("kind"))
22278      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
22279    if (json.has("_kind"))
22280      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
22281    if (json.has("expression"))
22282      res.setExpression(parseExpression(getJObject(json, "expression")));
22283  }
22284
22285  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
22286    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
22287    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
22288    return res;
22289  }
22290
22291  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
22292    parseBackboneElementProperties(json, res);
22293    if (json.has("actionId"))
22294      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
22295    if (json.has("_actionId"))
22296      parseElementProperties(getJObject(json, "_actionId"), res.getActionIdElement());
22297    if (json.has("relationship"))
22298      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
22299    if (json.has("_relationship"))
22300      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
22301    Type offset = parseType("offset", json);
22302    if (offset != null)
22303      res.setOffset(offset);
22304  }
22305
22306  protected ResearchDefinition parseResearchDefinition(JsonObject json) throws IOException, FHIRFormatError {
22307    ResearchDefinition res = new ResearchDefinition();
22308    parseResearchDefinitionProperties(json, res);
22309    return res;
22310  }
22311
22312  protected void parseResearchDefinitionProperties(JsonObject json, ResearchDefinition res) throws IOException, FHIRFormatError {
22313    parseDomainResourceProperties(json, res);
22314    if (json.has("url"))
22315      res.setUrlElement(parseUri(json.get("url").getAsString()));
22316    if (json.has("_url"))
22317      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
22318    if (json.has("identifier")) {
22319      JsonArray array = json.getAsJsonArray("identifier");
22320      for (int i = 0; i < array.size(); i++) {
22321        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22322      }
22323    };
22324    if (json.has("version"))
22325      res.setVersionElement(parseString(json.get("version").getAsString()));
22326    if (json.has("_version"))
22327      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
22328    if (json.has("name"))
22329      res.setNameElement(parseString(json.get("name").getAsString()));
22330    if (json.has("_name"))
22331      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22332    if (json.has("title"))
22333      res.setTitleElement(parseString(json.get("title").getAsString()));
22334    if (json.has("_title"))
22335      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
22336    if (json.has("shortTitle"))
22337      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
22338    if (json.has("_shortTitle"))
22339      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
22340    if (json.has("subtitle"))
22341      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
22342    if (json.has("_subtitle"))
22343      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
22344    if (json.has("status"))
22345      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22346    if (json.has("_status"))
22347      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22348    if (json.has("experimental"))
22349      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22350    if (json.has("_experimental"))
22351      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
22352    Type subject = parseType("subject", json);
22353    if (subject != null)
22354      res.setSubject(subject);
22355    if (json.has("date"))
22356      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22357    if (json.has("_date"))
22358      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
22359    if (json.has("publisher"))
22360      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22361    if (json.has("_publisher"))
22362      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
22363    if (json.has("contact")) {
22364      JsonArray array = json.getAsJsonArray("contact");
22365      for (int i = 0; i < array.size(); i++) {
22366        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22367      }
22368    };
22369    if (json.has("description"))
22370      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22371    if (json.has("_description"))
22372      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22373    if (json.has("comment")) {
22374      JsonArray array = json.getAsJsonArray("comment");
22375      for (int i = 0; i < array.size(); i++) {
22376        if (array.get(i).isJsonNull()) {
22377          res.getComment().add(new StringType());
22378        } else {
22379          res.getComment().add(parseString(array.get(i).getAsString()));
22380        }
22381      }
22382    };
22383    if (json.has("_comment")) {
22384      JsonArray array = json.getAsJsonArray("_comment");
22385      for (int i = 0; i < array.size(); i++) {
22386        if (i == res.getComment().size())
22387          res.getComment().add(parseString(null));
22388        if (array.get(i) instanceof JsonObject) 
22389          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
22390      }
22391    };
22392    if (json.has("useContext")) {
22393      JsonArray array = json.getAsJsonArray("useContext");
22394      for (int i = 0; i < array.size(); i++) {
22395        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22396      }
22397    };
22398    if (json.has("jurisdiction")) {
22399      JsonArray array = json.getAsJsonArray("jurisdiction");
22400      for (int i = 0; i < array.size(); i++) {
22401        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22402      }
22403    };
22404    if (json.has("purpose"))
22405      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22406    if (json.has("_purpose"))
22407      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
22408    if (json.has("usage"))
22409      res.setUsageElement(parseString(json.get("usage").getAsString()));
22410    if (json.has("_usage"))
22411      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
22412    if (json.has("copyright"))
22413      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22414    if (json.has("_copyright"))
22415      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
22416    if (json.has("approvalDate"))
22417      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
22418    if (json.has("_approvalDate"))
22419      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
22420    if (json.has("lastReviewDate"))
22421      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22422    if (json.has("_lastReviewDate"))
22423      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
22424    if (json.has("effectivePeriod"))
22425      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
22426    if (json.has("topic")) {
22427      JsonArray array = json.getAsJsonArray("topic");
22428      for (int i = 0; i < array.size(); i++) {
22429        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22430      }
22431    };
22432    if (json.has("author")) {
22433      JsonArray array = json.getAsJsonArray("author");
22434      for (int i = 0; i < array.size(); i++) {
22435        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22436      }
22437    };
22438    if (json.has("editor")) {
22439      JsonArray array = json.getAsJsonArray("editor");
22440      for (int i = 0; i < array.size(); i++) {
22441        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22442      }
22443    };
22444    if (json.has("reviewer")) {
22445      JsonArray array = json.getAsJsonArray("reviewer");
22446      for (int i = 0; i < array.size(); i++) {
22447        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
22448      }
22449    };
22450    if (json.has("endorser")) {
22451      JsonArray array = json.getAsJsonArray("endorser");
22452      for (int i = 0; i < array.size(); i++) {
22453        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
22454      }
22455    };
22456    if (json.has("relatedArtifact")) {
22457      JsonArray array = json.getAsJsonArray("relatedArtifact");
22458      for (int i = 0; i < array.size(); i++) {
22459        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22460      }
22461    };
22462    if (json.has("library")) {
22463      JsonArray array = json.getAsJsonArray("library");
22464      for (int i = 0; i < array.size(); i++) {
22465        if (array.get(i).isJsonNull()) {
22466          res.getLibrary().add(new CanonicalType());
22467        } else {
22468          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
22469        }
22470      }
22471    };
22472    if (json.has("_library")) {
22473      JsonArray array = json.getAsJsonArray("_library");
22474      for (int i = 0; i < array.size(); i++) {
22475        if (i == res.getLibrary().size())
22476          res.getLibrary().add(parseCanonical(null));
22477        if (array.get(i) instanceof JsonObject) 
22478          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
22479      }
22480    };
22481    if (json.has("population"))
22482      res.setPopulation(parseReference(getJObject(json, "population")));
22483    if (json.has("exposure"))
22484      res.setExposure(parseReference(getJObject(json, "exposure")));
22485    if (json.has("exposureAlternative"))
22486      res.setExposureAlternative(parseReference(getJObject(json, "exposureAlternative")));
22487    if (json.has("outcome"))
22488      res.setOutcome(parseReference(getJObject(json, "outcome")));
22489  }
22490
22491  protected ResearchElementDefinition parseResearchElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
22492    ResearchElementDefinition res = new ResearchElementDefinition();
22493    parseResearchElementDefinitionProperties(json, res);
22494    return res;
22495  }
22496
22497  protected void parseResearchElementDefinitionProperties(JsonObject json, ResearchElementDefinition res) throws IOException, FHIRFormatError {
22498    parseDomainResourceProperties(json, res);
22499    if (json.has("url"))
22500      res.setUrlElement(parseUri(json.get("url").getAsString()));
22501    if (json.has("_url"))
22502      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
22503    if (json.has("identifier")) {
22504      JsonArray array = json.getAsJsonArray("identifier");
22505      for (int i = 0; i < array.size(); i++) {
22506        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22507      }
22508    };
22509    if (json.has("version"))
22510      res.setVersionElement(parseString(json.get("version").getAsString()));
22511    if (json.has("_version"))
22512      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
22513    if (json.has("name"))
22514      res.setNameElement(parseString(json.get("name").getAsString()));
22515    if (json.has("_name"))
22516      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22517    if (json.has("title"))
22518      res.setTitleElement(parseString(json.get("title").getAsString()));
22519    if (json.has("_title"))
22520      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
22521    if (json.has("shortTitle"))
22522      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
22523    if (json.has("_shortTitle"))
22524      parseElementProperties(getJObject(json, "_shortTitle"), res.getShortTitleElement());
22525    if (json.has("subtitle"))
22526      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
22527    if (json.has("_subtitle"))
22528      parseElementProperties(getJObject(json, "_subtitle"), res.getSubtitleElement());
22529    if (json.has("status"))
22530      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22531    if (json.has("_status"))
22532      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22533    if (json.has("experimental"))
22534      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22535    if (json.has("_experimental"))
22536      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
22537    Type subject = parseType("subject", json);
22538    if (subject != null)
22539      res.setSubject(subject);
22540    if (json.has("date"))
22541      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22542    if (json.has("_date"))
22543      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
22544    if (json.has("publisher"))
22545      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22546    if (json.has("_publisher"))
22547      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
22548    if (json.has("contact")) {
22549      JsonArray array = json.getAsJsonArray("contact");
22550      for (int i = 0; i < array.size(); i++) {
22551        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22552      }
22553    };
22554    if (json.has("description"))
22555      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22556    if (json.has("_description"))
22557      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22558    if (json.has("comment")) {
22559      JsonArray array = json.getAsJsonArray("comment");
22560      for (int i = 0; i < array.size(); i++) {
22561        if (array.get(i).isJsonNull()) {
22562          res.getComment().add(new StringType());
22563        } else {
22564          res.getComment().add(parseString(array.get(i).getAsString()));
22565        }
22566      }
22567    };
22568    if (json.has("_comment")) {
22569      JsonArray array = json.getAsJsonArray("_comment");
22570      for (int i = 0; i < array.size(); i++) {
22571        if (i == res.getComment().size())
22572          res.getComment().add(parseString(null));
22573        if (array.get(i) instanceof JsonObject) 
22574          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
22575      }
22576    };
22577    if (json.has("useContext")) {
22578      JsonArray array = json.getAsJsonArray("useContext");
22579      for (int i = 0; i < array.size(); i++) {
22580        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22581      }
22582    };
22583    if (json.has("jurisdiction")) {
22584      JsonArray array = json.getAsJsonArray("jurisdiction");
22585      for (int i = 0; i < array.size(); i++) {
22586        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22587      }
22588    };
22589    if (json.has("purpose"))
22590      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22591    if (json.has("_purpose"))
22592      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
22593    if (json.has("usage"))
22594      res.setUsageElement(parseString(json.get("usage").getAsString()));
22595    if (json.has("_usage"))
22596      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
22597    if (json.has("copyright"))
22598      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22599    if (json.has("_copyright"))
22600      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
22601    if (json.has("approvalDate"))
22602      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
22603    if (json.has("_approvalDate"))
22604      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
22605    if (json.has("lastReviewDate"))
22606      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22607    if (json.has("_lastReviewDate"))
22608      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
22609    if (json.has("effectivePeriod"))
22610      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
22611    if (json.has("topic")) {
22612      JsonArray array = json.getAsJsonArray("topic");
22613      for (int i = 0; i < array.size(); i++) {
22614        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22615      }
22616    };
22617    if (json.has("author")) {
22618      JsonArray array = json.getAsJsonArray("author");
22619      for (int i = 0; i < array.size(); i++) {
22620        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22621      }
22622    };
22623    if (json.has("editor")) {
22624      JsonArray array = json.getAsJsonArray("editor");
22625      for (int i = 0; i < array.size(); i++) {
22626        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22627      }
22628    };
22629    if (json.has("reviewer")) {
22630      JsonArray array = json.getAsJsonArray("reviewer");
22631      for (int i = 0; i < array.size(); i++) {
22632        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
22633      }
22634    };
22635    if (json.has("endorser")) {
22636      JsonArray array = json.getAsJsonArray("endorser");
22637      for (int i = 0; i < array.size(); i++) {
22638        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
22639      }
22640    };
22641    if (json.has("relatedArtifact")) {
22642      JsonArray array = json.getAsJsonArray("relatedArtifact");
22643      for (int i = 0; i < array.size(); i++) {
22644        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22645      }
22646    };
22647    if (json.has("library")) {
22648      JsonArray array = json.getAsJsonArray("library");
22649      for (int i = 0; i < array.size(); i++) {
22650        if (array.get(i).isJsonNull()) {
22651          res.getLibrary().add(new CanonicalType());
22652        } else {
22653          res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
22654        }
22655      }
22656    };
22657    if (json.has("_library")) {
22658      JsonArray array = json.getAsJsonArray("_library");
22659      for (int i = 0; i < array.size(); i++) {
22660        if (i == res.getLibrary().size())
22661          res.getLibrary().add(parseCanonical(null));
22662        if (array.get(i) instanceof JsonObject) 
22663          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
22664      }
22665    };
22666    if (json.has("type"))
22667      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ResearchElementDefinition.ResearchElementType.NULL, new ResearchElementDefinition.ResearchElementTypeEnumFactory()));
22668    if (json.has("_type"))
22669      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
22670    if (json.has("variableType"))
22671      res.setVariableTypeElement(parseEnumeration(json.get("variableType").getAsString(), ResearchElementDefinition.VariableType.NULL, new ResearchElementDefinition.VariableTypeEnumFactory()));
22672    if (json.has("_variableType"))
22673      parseElementProperties(getJObject(json, "_variableType"), res.getVariableTypeElement());
22674    if (json.has("characteristic")) {
22675      JsonArray array = json.getAsJsonArray("characteristic");
22676      for (int i = 0; i < array.size(); i++) {
22677        res.getCharacteristic().add(parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(array.get(i).getAsJsonObject(), res));
22678      }
22679    };
22680  }
22681
22682  protected ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(JsonObject json, ResearchElementDefinition owner) throws IOException, FHIRFormatError {
22683    ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res = new ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent();
22684    parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentProperties(json, owner, res);
22685    return res;
22686  }
22687
22688  protected void parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentProperties(JsonObject json, ResearchElementDefinition owner, ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res) throws IOException, FHIRFormatError {
22689    parseBackboneElementProperties(json, res);
22690    Type definition = parseType("definition", json);
22691    if (definition != null)
22692      res.setDefinition(definition);
22693    if (json.has("usageContext")) {
22694      JsonArray array = json.getAsJsonArray("usageContext");
22695      for (int i = 0; i < array.size(); i++) {
22696        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22697      }
22698    };
22699    if (json.has("exclude"))
22700      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
22701    if (json.has("_exclude"))
22702      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
22703    if (json.has("unitOfMeasure"))
22704      res.setUnitOfMeasure(parseCodeableConcept(getJObject(json, "unitOfMeasure")));
22705    if (json.has("studyEffectiveDescription"))
22706      res.setStudyEffectiveDescriptionElement(parseString(json.get("studyEffectiveDescription").getAsString()));
22707    if (json.has("_studyEffectiveDescription"))
22708      parseElementProperties(getJObject(json, "_studyEffectiveDescription"), res.getStudyEffectiveDescriptionElement());
22709    Type studyEffective = parseType("studyEffective", json);
22710    if (studyEffective != null)
22711      res.setStudyEffective(studyEffective);
22712    if (json.has("studyEffectiveTimeFromStart"))
22713      res.setStudyEffectiveTimeFromStart(parseDuration(getJObject(json, "studyEffectiveTimeFromStart")));
22714    if (json.has("studyEffectiveGroupMeasure"))
22715      res.setStudyEffectiveGroupMeasureElement(parseEnumeration(json.get("studyEffectiveGroupMeasure").getAsString(), ResearchElementDefinition.GroupMeasure.NULL, new ResearchElementDefinition.GroupMeasureEnumFactory()));
22716    if (json.has("_studyEffectiveGroupMeasure"))
22717      parseElementProperties(getJObject(json, "_studyEffectiveGroupMeasure"), res.getStudyEffectiveGroupMeasureElement());
22718    if (json.has("participantEffectiveDescription"))
22719      res.setParticipantEffectiveDescriptionElement(parseString(json.get("participantEffectiveDescription").getAsString()));
22720    if (json.has("_participantEffectiveDescription"))
22721      parseElementProperties(getJObject(json, "_participantEffectiveDescription"), res.getParticipantEffectiveDescriptionElement());
22722    Type participantEffective = parseType("participantEffective", json);
22723    if (participantEffective != null)
22724      res.setParticipantEffective(participantEffective);
22725    if (json.has("participantEffectiveTimeFromStart"))
22726      res.setParticipantEffectiveTimeFromStart(parseDuration(getJObject(json, "participantEffectiveTimeFromStart")));
22727    if (json.has("participantEffectiveGroupMeasure"))
22728      res.setParticipantEffectiveGroupMeasureElement(parseEnumeration(json.get("participantEffectiveGroupMeasure").getAsString(), ResearchElementDefinition.GroupMeasure.NULL, new ResearchElementDefinition.GroupMeasureEnumFactory()));
22729    if (json.has("_participantEffectiveGroupMeasure"))
22730      parseElementProperties(getJObject(json, "_participantEffectiveGroupMeasure"), res.getParticipantEffectiveGroupMeasureElement());
22731  }
22732
22733  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
22734    ResearchStudy res = new ResearchStudy();
22735    parseResearchStudyProperties(json, res);
22736    return res;
22737  }
22738
22739  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
22740    parseDomainResourceProperties(json, res);
22741    if (json.has("identifier")) {
22742      JsonArray array = json.getAsJsonArray("identifier");
22743      for (int i = 0; i < array.size(); i++) {
22744        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22745      }
22746    };
22747    if (json.has("title"))
22748      res.setTitleElement(parseString(json.get("title").getAsString()));
22749    if (json.has("_title"))
22750      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
22751    if (json.has("protocol")) {
22752      JsonArray array = json.getAsJsonArray("protocol");
22753      for (int i = 0; i < array.size(); i++) {
22754        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
22755      }
22756    };
22757    if (json.has("partOf")) {
22758      JsonArray array = json.getAsJsonArray("partOf");
22759      for (int i = 0; i < array.size(); i++) {
22760        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22761      }
22762    };
22763    if (json.has("status"))
22764      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
22765    if (json.has("_status"))
22766      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22767    if (json.has("primaryPurposeType"))
22768      res.setPrimaryPurposeType(parseCodeableConcept(getJObject(json, "primaryPurposeType")));
22769    if (json.has("phase"))
22770      res.setPhase(parseCodeableConcept(getJObject(json, "phase")));
22771    if (json.has("category")) {
22772      JsonArray array = json.getAsJsonArray("category");
22773      for (int i = 0; i < array.size(); i++) {
22774        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22775      }
22776    };
22777    if (json.has("focus")) {
22778      JsonArray array = json.getAsJsonArray("focus");
22779      for (int i = 0; i < array.size(); i++) {
22780        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22781      }
22782    };
22783    if (json.has("condition")) {
22784      JsonArray array = json.getAsJsonArray("condition");
22785      for (int i = 0; i < array.size(); i++) {
22786        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22787      }
22788    };
22789    if (json.has("contact")) {
22790      JsonArray array = json.getAsJsonArray("contact");
22791      for (int i = 0; i < array.size(); i++) {
22792        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22793      }
22794    };
22795    if (json.has("relatedArtifact")) {
22796      JsonArray array = json.getAsJsonArray("relatedArtifact");
22797      for (int i = 0; i < array.size(); i++) {
22798        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22799      }
22800    };
22801    if (json.has("keyword")) {
22802      JsonArray array = json.getAsJsonArray("keyword");
22803      for (int i = 0; i < array.size(); i++) {
22804        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22805      }
22806    };
22807    if (json.has("location")) {
22808      JsonArray array = json.getAsJsonArray("location");
22809      for (int i = 0; i < array.size(); i++) {
22810        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22811      }
22812    };
22813    if (json.has("description"))
22814      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22815    if (json.has("_description"))
22816      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22817    if (json.has("enrollment")) {
22818      JsonArray array = json.getAsJsonArray("enrollment");
22819      for (int i = 0; i < array.size(); i++) {
22820        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
22821      }
22822    };
22823    if (json.has("period"))
22824      res.setPeriod(parsePeriod(getJObject(json, "period")));
22825    if (json.has("sponsor"))
22826      res.setSponsor(parseReference(getJObject(json, "sponsor")));
22827    if (json.has("principalInvestigator"))
22828      res.setPrincipalInvestigator(parseReference(getJObject(json, "principalInvestigator")));
22829    if (json.has("site")) {
22830      JsonArray array = json.getAsJsonArray("site");
22831      for (int i = 0; i < array.size(); i++) {
22832        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
22833      }
22834    };
22835    if (json.has("reasonStopped"))
22836      res.setReasonStopped(parseCodeableConcept(getJObject(json, "reasonStopped")));
22837    if (json.has("note")) {
22838      JsonArray array = json.getAsJsonArray("note");
22839      for (int i = 0; i < array.size(); i++) {
22840        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22841      }
22842    };
22843    if (json.has("arm")) {
22844      JsonArray array = json.getAsJsonArray("arm");
22845      for (int i = 0; i < array.size(); i++) {
22846        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
22847      }
22848    };
22849    if (json.has("objective")) {
22850      JsonArray array = json.getAsJsonArray("objective");
22851      for (int i = 0; i < array.size(); i++) {
22852        res.getObjective().add(parseResearchStudyResearchStudyObjectiveComponent(array.get(i).getAsJsonObject(), res));
22853      }
22854    };
22855  }
22856
22857  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
22858    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
22859    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
22860    return res;
22861  }
22862
22863  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
22864    parseBackboneElementProperties(json, res);
22865    if (json.has("name"))
22866      res.setNameElement(parseString(json.get("name").getAsString()));
22867    if (json.has("_name"))
22868      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22869    if (json.has("type"))
22870      res.setType(parseCodeableConcept(getJObject(json, "type")));
22871    if (json.has("description"))
22872      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22873    if (json.has("_description"))
22874      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
22875  }
22876
22877  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyResearchStudyObjectiveComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
22878    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
22879    parseResearchStudyResearchStudyObjectiveComponentProperties(json, owner, res);
22880    return res;
22881  }
22882
22883  protected void parseResearchStudyResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
22884    parseBackboneElementProperties(json, res);
22885    if (json.has("name"))
22886      res.setNameElement(parseString(json.get("name").getAsString()));
22887    if (json.has("_name"))
22888      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
22889    if (json.has("type"))
22890      res.setType(parseCodeableConcept(getJObject(json, "type")));
22891  }
22892
22893  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
22894    ResearchSubject res = new ResearchSubject();
22895    parseResearchSubjectProperties(json, res);
22896    return res;
22897  }
22898
22899  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
22900    parseDomainResourceProperties(json, res);
22901    if (json.has("identifier")) {
22902      JsonArray array = json.getAsJsonArray("identifier");
22903      for (int i = 0; i < array.size(); i++) {
22904        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22905      }
22906    };
22907    if (json.has("status"))
22908      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
22909    if (json.has("_status"))
22910      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22911    if (json.has("period"))
22912      res.setPeriod(parsePeriod(getJObject(json, "period")));
22913    if (json.has("study"))
22914      res.setStudy(parseReference(getJObject(json, "study")));
22915    if (json.has("individual"))
22916      res.setIndividual(parseReference(getJObject(json, "individual")));
22917    if (json.has("assignedArm"))
22918      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
22919    if (json.has("_assignedArm"))
22920      parseElementProperties(getJObject(json, "_assignedArm"), res.getAssignedArmElement());
22921    if (json.has("actualArm"))
22922      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
22923    if (json.has("_actualArm"))
22924      parseElementProperties(getJObject(json, "_actualArm"), res.getActualArmElement());
22925    if (json.has("consent"))
22926      res.setConsent(parseReference(getJObject(json, "consent")));
22927  }
22928
22929  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
22930    RiskAssessment res = new RiskAssessment();
22931    parseRiskAssessmentProperties(json, res);
22932    return res;
22933  }
22934
22935  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
22936    parseDomainResourceProperties(json, res);
22937    if (json.has("identifier")) {
22938      JsonArray array = json.getAsJsonArray("identifier");
22939      for (int i = 0; i < array.size(); i++) {
22940        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22941      }
22942    };
22943    if (json.has("basedOn"))
22944      res.setBasedOn(parseReference(getJObject(json, "basedOn")));
22945    if (json.has("parent"))
22946      res.setParent(parseReference(getJObject(json, "parent")));
22947    if (json.has("status"))
22948      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
22949    if (json.has("_status"))
22950      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
22951    if (json.has("method"))
22952      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
22953    if (json.has("code"))
22954      res.setCode(parseCodeableConcept(getJObject(json, "code")));
22955    if (json.has("subject"))
22956      res.setSubject(parseReference(getJObject(json, "subject")));
22957    if (json.has("encounter"))
22958      res.setEncounter(parseReference(getJObject(json, "encounter")));
22959    Type occurrence = parseType("occurrence", json);
22960    if (occurrence != null)
22961      res.setOccurrence(occurrence);
22962    if (json.has("condition"))
22963      res.setCondition(parseReference(getJObject(json, "condition")));
22964    if (json.has("performer"))
22965      res.setPerformer(parseReference(getJObject(json, "performer")));
22966    if (json.has("reasonCode")) {
22967      JsonArray array = json.getAsJsonArray("reasonCode");
22968      for (int i = 0; i < array.size(); i++) {
22969        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22970      }
22971    };
22972    if (json.has("reasonReference")) {
22973      JsonArray array = json.getAsJsonArray("reasonReference");
22974      for (int i = 0; i < array.size(); i++) {
22975        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
22976      }
22977    };
22978    if (json.has("basis")) {
22979      JsonArray array = json.getAsJsonArray("basis");
22980      for (int i = 0; i < array.size(); i++) {
22981        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
22982      }
22983    };
22984    if (json.has("prediction")) {
22985      JsonArray array = json.getAsJsonArray("prediction");
22986      for (int i = 0; i < array.size(); i++) {
22987        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
22988      }
22989    };
22990    if (json.has("mitigation"))
22991      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
22992    if (json.has("_mitigation"))
22993      parseElementProperties(getJObject(json, "_mitigation"), res.getMitigationElement());
22994    if (json.has("note")) {
22995      JsonArray array = json.getAsJsonArray("note");
22996      for (int i = 0; i < array.size(); i++) {
22997        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22998      }
22999    };
23000  }
23001
23002  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
23003    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
23004    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
23005    return res;
23006  }
23007
23008  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
23009    parseBackboneElementProperties(json, res);
23010    if (json.has("outcome"))
23011      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
23012    Type probability = parseType("probability", json);
23013    if (probability != null)
23014      res.setProbability(probability);
23015    if (json.has("qualitativeRisk"))
23016      res.setQualitativeRisk(parseCodeableConcept(getJObject(json, "qualitativeRisk")));
23017    if (json.has("relativeRisk"))
23018      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
23019    if (json.has("_relativeRisk"))
23020      parseElementProperties(getJObject(json, "_relativeRisk"), res.getRelativeRiskElement());
23021    Type when = parseType("when", json);
23022    if (when != null)
23023      res.setWhen(when);
23024    if (json.has("rationale"))
23025      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
23026    if (json.has("_rationale"))
23027      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
23028  }
23029
23030  protected RiskEvidenceSynthesis parseRiskEvidenceSynthesis(JsonObject json) throws IOException, FHIRFormatError {
23031    RiskEvidenceSynthesis res = new RiskEvidenceSynthesis();
23032    parseRiskEvidenceSynthesisProperties(json, res);
23033    return res;
23034  }
23035
23036  protected void parseRiskEvidenceSynthesisProperties(JsonObject json, RiskEvidenceSynthesis res) throws IOException, FHIRFormatError {
23037    parseDomainResourceProperties(json, res);
23038    if (json.has("url"))
23039      res.setUrlElement(parseUri(json.get("url").getAsString()));
23040    if (json.has("_url"))
23041      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
23042    if (json.has("identifier")) {
23043      JsonArray array = json.getAsJsonArray("identifier");
23044      for (int i = 0; i < array.size(); i++) {
23045        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23046      }
23047    };
23048    if (json.has("version"))
23049      res.setVersionElement(parseString(json.get("version").getAsString()));
23050    if (json.has("_version"))
23051      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
23052    if (json.has("name"))
23053      res.setNameElement(parseString(json.get("name").getAsString()));
23054    if (json.has("_name"))
23055      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23056    if (json.has("title"))
23057      res.setTitleElement(parseString(json.get("title").getAsString()));
23058    if (json.has("_title"))
23059      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
23060    if (json.has("status"))
23061      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23062    if (json.has("_status"))
23063      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23064    if (json.has("date"))
23065      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23066    if (json.has("_date"))
23067      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
23068    if (json.has("publisher"))
23069      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23070    if (json.has("_publisher"))
23071      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
23072    if (json.has("contact")) {
23073      JsonArray array = json.getAsJsonArray("contact");
23074      for (int i = 0; i < array.size(); i++) {
23075        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23076      }
23077    };
23078    if (json.has("description"))
23079      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23080    if (json.has("_description"))
23081      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23082    if (json.has("note")) {
23083      JsonArray array = json.getAsJsonArray("note");
23084      for (int i = 0; i < array.size(); i++) {
23085        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23086      }
23087    };
23088    if (json.has("useContext")) {
23089      JsonArray array = json.getAsJsonArray("useContext");
23090      for (int i = 0; i < array.size(); i++) {
23091        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23092      }
23093    };
23094    if (json.has("jurisdiction")) {
23095      JsonArray array = json.getAsJsonArray("jurisdiction");
23096      for (int i = 0; i < array.size(); i++) {
23097        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23098      }
23099    };
23100    if (json.has("copyright"))
23101      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23102    if (json.has("_copyright"))
23103      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
23104    if (json.has("approvalDate"))
23105      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
23106    if (json.has("_approvalDate"))
23107      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
23108    if (json.has("lastReviewDate"))
23109      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
23110    if (json.has("_lastReviewDate"))
23111      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
23112    if (json.has("effectivePeriod"))
23113      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
23114    if (json.has("topic")) {
23115      JsonArray array = json.getAsJsonArray("topic");
23116      for (int i = 0; i < array.size(); i++) {
23117        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23118      }
23119    };
23120    if (json.has("author")) {
23121      JsonArray array = json.getAsJsonArray("author");
23122      for (int i = 0; i < array.size(); i++) {
23123        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
23124      }
23125    };
23126    if (json.has("editor")) {
23127      JsonArray array = json.getAsJsonArray("editor");
23128      for (int i = 0; i < array.size(); i++) {
23129        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
23130      }
23131    };
23132    if (json.has("reviewer")) {
23133      JsonArray array = json.getAsJsonArray("reviewer");
23134      for (int i = 0; i < array.size(); i++) {
23135        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
23136      }
23137    };
23138    if (json.has("endorser")) {
23139      JsonArray array = json.getAsJsonArray("endorser");
23140      for (int i = 0; i < array.size(); i++) {
23141        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
23142      }
23143    };
23144    if (json.has("relatedArtifact")) {
23145      JsonArray array = json.getAsJsonArray("relatedArtifact");
23146      for (int i = 0; i < array.size(); i++) {
23147        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
23148      }
23149    };
23150    if (json.has("synthesisType"))
23151      res.setSynthesisType(parseCodeableConcept(getJObject(json, "synthesisType")));
23152    if (json.has("studyType"))
23153      res.setStudyType(parseCodeableConcept(getJObject(json, "studyType")));
23154    if (json.has("population"))
23155      res.setPopulation(parseReference(getJObject(json, "population")));
23156    if (json.has("exposure"))
23157      res.setExposure(parseReference(getJObject(json, "exposure")));
23158    if (json.has("outcome"))
23159      res.setOutcome(parseReference(getJObject(json, "outcome")));
23160    if (json.has("sampleSize"))
23161      res.setSampleSize(parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(getJObject(json, "sampleSize"), res));
23162    if (json.has("riskEstimate"))
23163      res.setRiskEstimate(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(getJObject(json, "riskEstimate"), res));
23164    if (json.has("certainty")) {
23165      JsonArray array = json.getAsJsonArray("certainty");
23166      for (int i = 0; i < array.size(); i++) {
23167        res.getCertainty().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(array.get(i).getAsJsonObject(), res));
23168      }
23169    };
23170  }
23171
23172  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
23173    RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent();
23174    parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentProperties(json, owner, res);
23175    return res;
23176  }
23177
23178  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res) throws IOException, FHIRFormatError {
23179    parseBackboneElementProperties(json, res);
23180    if (json.has("description"))
23181      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23182    if (json.has("_description"))
23183      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23184    if (json.has("numberOfStudies"))
23185      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
23186    if (json.has("_numberOfStudies"))
23187      parseElementProperties(getJObject(json, "_numberOfStudies"), res.getNumberOfStudiesElement());
23188    if (json.has("numberOfParticipants"))
23189      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
23190    if (json.has("_numberOfParticipants"))
23191      parseElementProperties(getJObject(json, "_numberOfParticipants"), res.getNumberOfParticipantsElement());
23192  }
23193
23194  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
23195    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent();
23196    parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentProperties(json, owner, res);
23197    return res;
23198  }
23199
23200  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res) throws IOException, FHIRFormatError {
23201    parseBackboneElementProperties(json, res);
23202    if (json.has("description"))
23203      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23204    if (json.has("_description"))
23205      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23206    if (json.has("type"))
23207      res.setType(parseCodeableConcept(getJObject(json, "type")));
23208    if (json.has("value"))
23209      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
23210    if (json.has("_value"))
23211      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
23212    if (json.has("unitOfMeasure"))
23213      res.setUnitOfMeasure(parseCodeableConcept(getJObject(json, "unitOfMeasure")));
23214    if (json.has("denominatorCount"))
23215      res.setDenominatorCountElement(parseInteger(json.get("denominatorCount").getAsLong()));
23216    if (json.has("_denominatorCount"))
23217      parseElementProperties(getJObject(json, "_denominatorCount"), res.getDenominatorCountElement());
23218    if (json.has("numeratorCount"))
23219      res.setNumeratorCountElement(parseInteger(json.get("numeratorCount").getAsLong()));
23220    if (json.has("_numeratorCount"))
23221      parseElementProperties(getJObject(json, "_numeratorCount"), res.getNumeratorCountElement());
23222    if (json.has("precisionEstimate")) {
23223      JsonArray array = json.getAsJsonArray("precisionEstimate");
23224      for (int i = 0; i < array.size(); i++) {
23225        res.getPrecisionEstimate().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(array.get(i).getAsJsonObject(), owner));
23226      }
23227    };
23228  }
23229
23230  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
23231    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent();
23232    parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentProperties(json, owner, res);
23233    return res;
23234  }
23235
23236  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res) throws IOException, FHIRFormatError {
23237    parseBackboneElementProperties(json, res);
23238    if (json.has("type"))
23239      res.setType(parseCodeableConcept(getJObject(json, "type")));
23240    if (json.has("level"))
23241      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
23242    if (json.has("_level"))
23243      parseElementProperties(getJObject(json, "_level"), res.getLevelElement());
23244    if (json.has("from"))
23245      res.setFromElement(parseDecimal(json.get("from").getAsBigDecimal()));
23246    if (json.has("_from"))
23247      parseElementProperties(getJObject(json, "_from"), res.getFromElement());
23248    if (json.has("to"))
23249      res.setToElement(parseDecimal(json.get("to").getAsBigDecimal()));
23250    if (json.has("_to"))
23251      parseElementProperties(getJObject(json, "_to"), res.getToElement());
23252  }
23253
23254  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
23255    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent();
23256    parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentProperties(json, owner, res);
23257    return res;
23258  }
23259
23260  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res) throws IOException, FHIRFormatError {
23261    parseBackboneElementProperties(json, res);
23262    if (json.has("rating")) {
23263      JsonArray array = json.getAsJsonArray("rating");
23264      for (int i = 0; i < array.size(); i++) {
23265        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23266      }
23267    };
23268    if (json.has("note")) {
23269      JsonArray array = json.getAsJsonArray("note");
23270      for (int i = 0; i < array.size(); i++) {
23271        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23272      }
23273    };
23274    if (json.has("certaintySubcomponent")) {
23275      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
23276      for (int i = 0; i < array.size(); i++) {
23277        res.getCertaintySubcomponent().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(array.get(i).getAsJsonObject(), owner));
23278      }
23279    };
23280  }
23281
23282  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
23283    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
23284    parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(json, owner, res);
23285    return res;
23286  }
23287
23288  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res) throws IOException, FHIRFormatError {
23289    parseBackboneElementProperties(json, res);
23290    if (json.has("type"))
23291      res.setType(parseCodeableConcept(getJObject(json, "type")));
23292    if (json.has("rating")) {
23293      JsonArray array = json.getAsJsonArray("rating");
23294      for (int i = 0; i < array.size(); i++) {
23295        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23296      }
23297    };
23298    if (json.has("note")) {
23299      JsonArray array = json.getAsJsonArray("note");
23300      for (int i = 0; i < array.size(); i++) {
23301        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23302      }
23303    };
23304  }
23305
23306  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
23307    Schedule res = new Schedule();
23308    parseScheduleProperties(json, res);
23309    return res;
23310  }
23311
23312  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
23313    parseDomainResourceProperties(json, res);
23314    if (json.has("identifier")) {
23315      JsonArray array = json.getAsJsonArray("identifier");
23316      for (int i = 0; i < array.size(); i++) {
23317        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23318      }
23319    };
23320    if (json.has("active"))
23321      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
23322    if (json.has("_active"))
23323      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
23324    if (json.has("serviceCategory")) {
23325      JsonArray array = json.getAsJsonArray("serviceCategory");
23326      for (int i = 0; i < array.size(); i++) {
23327        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23328      }
23329    };
23330    if (json.has("serviceType")) {
23331      JsonArray array = json.getAsJsonArray("serviceType");
23332      for (int i = 0; i < array.size(); i++) {
23333        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23334      }
23335    };
23336    if (json.has("specialty")) {
23337      JsonArray array = json.getAsJsonArray("specialty");
23338      for (int i = 0; i < array.size(); i++) {
23339        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23340      }
23341    };
23342    if (json.has("actor")) {
23343      JsonArray array = json.getAsJsonArray("actor");
23344      for (int i = 0; i < array.size(); i++) {
23345        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
23346      }
23347    };
23348    if (json.has("planningHorizon"))
23349      res.setPlanningHorizon(parsePeriod(getJObject(json, "planningHorizon")));
23350    if (json.has("comment"))
23351      res.setCommentElement(parseString(json.get("comment").getAsString()));
23352    if (json.has("_comment"))
23353      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
23354  }
23355
23356  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
23357    SearchParameter res = new SearchParameter();
23358    parseSearchParameterProperties(json, res);
23359    return res;
23360  }
23361
23362  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
23363    parseDomainResourceProperties(json, res);
23364    if (json.has("url"))
23365      res.setUrlElement(parseUri(json.get("url").getAsString()));
23366    if (json.has("_url"))
23367      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
23368    if (json.has("version"))
23369      res.setVersionElement(parseString(json.get("version").getAsString()));
23370    if (json.has("_version"))
23371      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
23372    if (json.has("name"))
23373      res.setNameElement(parseString(json.get("name").getAsString()));
23374    if (json.has("_name"))
23375      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
23376    if (json.has("derivedFrom"))
23377      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
23378    if (json.has("_derivedFrom"))
23379      parseElementProperties(getJObject(json, "_derivedFrom"), res.getDerivedFromElement());
23380    if (json.has("status"))
23381      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23382    if (json.has("_status"))
23383      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23384    if (json.has("experimental"))
23385      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23386    if (json.has("_experimental"))
23387      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
23388    if (json.has("date"))
23389      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23390    if (json.has("_date"))
23391      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
23392    if (json.has("publisher"))
23393      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23394    if (json.has("_publisher"))
23395      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
23396    if (json.has("contact")) {
23397      JsonArray array = json.getAsJsonArray("contact");
23398      for (int i = 0; i < array.size(); i++) {
23399        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23400      }
23401    };
23402    if (json.has("description"))
23403      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23404    if (json.has("_description"))
23405      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23406    if (json.has("useContext")) {
23407      JsonArray array = json.getAsJsonArray("useContext");
23408      for (int i = 0; i < array.size(); i++) {
23409        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23410      }
23411    };
23412    if (json.has("jurisdiction")) {
23413      JsonArray array = json.getAsJsonArray("jurisdiction");
23414      for (int i = 0; i < array.size(); i++) {
23415        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23416      }
23417    };
23418    if (json.has("purpose"))
23419      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23420    if (json.has("_purpose"))
23421      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
23422    if (json.has("code"))
23423      res.setCodeElement(parseCode(json.get("code").getAsString()));
23424    if (json.has("_code"))
23425      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
23426    if (json.has("base")) {
23427      JsonArray array = json.getAsJsonArray("base");
23428      for (int i = 0; i < array.size(); i++) {
23429        if (array.get(i).isJsonNull()) {
23430          res.getBase().add(new CodeType());
23431        } else {
23432          res.getBase().add(parseCode(array.get(i).getAsString()));
23433        }
23434      }
23435    };
23436    if (json.has("_base")) {
23437      JsonArray array = json.getAsJsonArray("_base");
23438      for (int i = 0; i < array.size(); i++) {
23439        if (i == res.getBase().size())
23440          res.getBase().add(parseCode(null));
23441        if (array.get(i) instanceof JsonObject) 
23442          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
23443      }
23444    };
23445    if (json.has("type"))
23446      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
23447    if (json.has("_type"))
23448      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
23449    if (json.has("expression"))
23450      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23451    if (json.has("_expression"))
23452      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
23453    if (json.has("xpath"))
23454      res.setXpathElement(parseString(json.get("xpath").getAsString()));
23455    if (json.has("_xpath"))
23456      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
23457    if (json.has("xpathUsage"))
23458      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
23459    if (json.has("_xpathUsage"))
23460      parseElementProperties(getJObject(json, "_xpathUsage"), res.getXpathUsageElement());
23461    if (json.has("target")) {
23462      JsonArray array = json.getAsJsonArray("target");
23463      for (int i = 0; i < array.size(); i++) {
23464        if (array.get(i).isJsonNull()) {
23465          res.getTarget().add(new CodeType());
23466        } else {
23467          res.getTarget().add(parseCode(array.get(i).getAsString()));
23468        }
23469      }
23470    };
23471    if (json.has("_target")) {
23472      JsonArray array = json.getAsJsonArray("_target");
23473      for (int i = 0; i < array.size(); i++) {
23474        if (i == res.getTarget().size())
23475          res.getTarget().add(parseCode(null));
23476        if (array.get(i) instanceof JsonObject) 
23477          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
23478      }
23479    };
23480    if (json.has("multipleOr"))
23481      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
23482    if (json.has("_multipleOr"))
23483      parseElementProperties(getJObject(json, "_multipleOr"), res.getMultipleOrElement());
23484    if (json.has("multipleAnd"))
23485      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
23486    if (json.has("_multipleAnd"))
23487      parseElementProperties(getJObject(json, "_multipleAnd"), res.getMultipleAndElement());
23488    if (json.has("comparator")) {
23489      JsonArray array = json.getAsJsonArray("comparator");
23490      for (int i = 0; i < array.size(); i++) {
23491        if (array.get(i).isJsonNull()) {
23492          res.getComparator().add(new Enumeration<SearchParameter.SearchComparator>());
23493        } else {
23494          res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
23495        }
23496      }
23497    };
23498    if (json.has("_comparator")) {
23499      JsonArray array = json.getAsJsonArray("_comparator");
23500      for (int i = 0; i < array.size(); i++) {
23501        if (i == res.getComparator().size())
23502          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
23503        if (array.get(i) instanceof JsonObject) 
23504          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
23505      }
23506    };
23507    if (json.has("modifier")) {
23508      JsonArray array = json.getAsJsonArray("modifier");
23509      for (int i = 0; i < array.size(); i++) {
23510        if (array.get(i).isJsonNull()) {
23511          res.getModifier().add(new Enumeration<SearchParameter.SearchModifierCode>());
23512        } else {
23513          res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
23514        }
23515      }
23516    };
23517    if (json.has("_modifier")) {
23518      JsonArray array = json.getAsJsonArray("_modifier");
23519      for (int i = 0; i < array.size(); i++) {
23520        if (i == res.getModifier().size())
23521          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
23522        if (array.get(i) instanceof JsonObject) 
23523          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
23524      }
23525    };
23526    if (json.has("chain")) {
23527      JsonArray array = json.getAsJsonArray("chain");
23528      for (int i = 0; i < array.size(); i++) {
23529        if (array.get(i).isJsonNull()) {
23530          res.getChain().add(new StringType());
23531        } else {
23532          res.getChain().add(parseString(array.get(i).getAsString()));
23533        }
23534      }
23535    };
23536    if (json.has("_chain")) {
23537      JsonArray array = json.getAsJsonArray("_chain");
23538      for (int i = 0; i < array.size(); i++) {
23539        if (i == res.getChain().size())
23540          res.getChain().add(parseString(null));
23541        if (array.get(i) instanceof JsonObject) 
23542          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
23543      }
23544    };
23545    if (json.has("component")) {
23546      JsonArray array = json.getAsJsonArray("component");
23547      for (int i = 0; i < array.size(); i++) {
23548        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
23549      }
23550    };
23551  }
23552
23553  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
23554    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
23555    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
23556    return res;
23557  }
23558
23559  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
23560    parseBackboneElementProperties(json, res);
23561    if (json.has("definition"))
23562      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
23563    if (json.has("_definition"))
23564      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
23565    if (json.has("expression"))
23566      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23567    if (json.has("_expression"))
23568      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
23569  }
23570
23571  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
23572    ServiceRequest res = new ServiceRequest();
23573    parseServiceRequestProperties(json, res);
23574    return res;
23575  }
23576
23577  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res) throws IOException, FHIRFormatError {
23578    parseDomainResourceProperties(json, res);
23579    if (json.has("identifier")) {
23580      JsonArray array = json.getAsJsonArray("identifier");
23581      for (int i = 0; i < array.size(); i++) {
23582        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23583      }
23584    };
23585    if (json.has("instantiatesCanonical")) {
23586      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
23587      for (int i = 0; i < array.size(); i++) {
23588        if (array.get(i).isJsonNull()) {
23589          res.getInstantiatesCanonical().add(new CanonicalType());
23590        } else {
23591          res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
23592        }
23593      }
23594    };
23595    if (json.has("_instantiatesCanonical")) {
23596      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
23597      for (int i = 0; i < array.size(); i++) {
23598        if (i == res.getInstantiatesCanonical().size())
23599          res.getInstantiatesCanonical().add(parseCanonical(null));
23600        if (array.get(i) instanceof JsonObject) 
23601          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
23602      }
23603    };
23604    if (json.has("instantiatesUri")) {
23605      JsonArray array = json.getAsJsonArray("instantiatesUri");
23606      for (int i = 0; i < array.size(); i++) {
23607        if (array.get(i).isJsonNull()) {
23608          res.getInstantiatesUri().add(new UriType());
23609        } else {
23610          res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
23611        }
23612      }
23613    };
23614    if (json.has("_instantiatesUri")) {
23615      JsonArray array = json.getAsJsonArray("_instantiatesUri");
23616      for (int i = 0; i < array.size(); i++) {
23617        if (i == res.getInstantiatesUri().size())
23618          res.getInstantiatesUri().add(parseUri(null));
23619        if (array.get(i) instanceof JsonObject) 
23620          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
23621      }
23622    };
23623    if (json.has("basedOn")) {
23624      JsonArray array = json.getAsJsonArray("basedOn");
23625      for (int i = 0; i < array.size(); i++) {
23626        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
23627      }
23628    };
23629    if (json.has("replaces")) {
23630      JsonArray array = json.getAsJsonArray("replaces");
23631      for (int i = 0; i < array.size(); i++) {
23632        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
23633      }
23634    };
23635    if (json.has("requisition"))
23636      res.setRequisition(parseIdentifier(getJObject(json, "requisition")));
23637    if (json.has("status"))
23638      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ServiceRequest.ServiceRequestStatus.NULL, new ServiceRequest.ServiceRequestStatusEnumFactory()));
23639    if (json.has("_status"))
23640      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23641    if (json.has("intent"))
23642      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ServiceRequest.ServiceRequestIntent.NULL, new ServiceRequest.ServiceRequestIntentEnumFactory()));
23643    if (json.has("_intent"))
23644      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
23645    if (json.has("category")) {
23646      JsonArray array = json.getAsJsonArray("category");
23647      for (int i = 0; i < array.size(); i++) {
23648        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23649      }
23650    };
23651    if (json.has("priority"))
23652      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ServiceRequest.ServiceRequestPriority.NULL, new ServiceRequest.ServiceRequestPriorityEnumFactory()));
23653    if (json.has("_priority"))
23654      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
23655    if (json.has("doNotPerform"))
23656      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
23657    if (json.has("_doNotPerform"))
23658      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
23659    if (json.has("code"))
23660      res.setCode(parseCodeableConcept(getJObject(json, "code")));
23661    if (json.has("orderDetail")) {
23662      JsonArray array = json.getAsJsonArray("orderDetail");
23663      for (int i = 0; i < array.size(); i++) {
23664        res.getOrderDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23665      }
23666    };
23667    Type quantity = parseType("quantity", json);
23668    if (quantity != null)
23669      res.setQuantity(quantity);
23670    if (json.has("subject"))
23671      res.setSubject(parseReference(getJObject(json, "subject")));
23672    if (json.has("encounter"))
23673      res.setEncounter(parseReference(getJObject(json, "encounter")));
23674    Type occurrence = parseType("occurrence", json);
23675    if (occurrence != null)
23676      res.setOccurrence(occurrence);
23677    Type asNeeded = parseType("asNeeded", json);
23678    if (asNeeded != null)
23679      res.setAsNeeded(asNeeded);
23680    if (json.has("authoredOn"))
23681      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
23682    if (json.has("_authoredOn"))
23683      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
23684    if (json.has("requester"))
23685      res.setRequester(parseReference(getJObject(json, "requester")));
23686    if (json.has("performerType"))
23687      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
23688    if (json.has("performer")) {
23689      JsonArray array = json.getAsJsonArray("performer");
23690      for (int i = 0; i < array.size(); i++) {
23691        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
23692      }
23693    };
23694    if (json.has("locationCode")) {
23695      JsonArray array = json.getAsJsonArray("locationCode");
23696      for (int i = 0; i < array.size(); i++) {
23697        res.getLocationCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23698      }
23699    };
23700    if (json.has("locationReference")) {
23701      JsonArray array = json.getAsJsonArray("locationReference");
23702      for (int i = 0; i < array.size(); i++) {
23703        res.getLocationReference().add(parseReference(array.get(i).getAsJsonObject()));
23704      }
23705    };
23706    if (json.has("reasonCode")) {
23707      JsonArray array = json.getAsJsonArray("reasonCode");
23708      for (int i = 0; i < array.size(); i++) {
23709        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23710      }
23711    };
23712    if (json.has("reasonReference")) {
23713      JsonArray array = json.getAsJsonArray("reasonReference");
23714      for (int i = 0; i < array.size(); i++) {
23715        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
23716      }
23717    };
23718    if (json.has("insurance")) {
23719      JsonArray array = json.getAsJsonArray("insurance");
23720      for (int i = 0; i < array.size(); i++) {
23721        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
23722      }
23723    };
23724    if (json.has("supportingInfo")) {
23725      JsonArray array = json.getAsJsonArray("supportingInfo");
23726      for (int i = 0; i < array.size(); i++) {
23727        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
23728      }
23729    };
23730    if (json.has("specimen")) {
23731      JsonArray array = json.getAsJsonArray("specimen");
23732      for (int i = 0; i < array.size(); i++) {
23733        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
23734      }
23735    };
23736    if (json.has("bodySite")) {
23737      JsonArray array = json.getAsJsonArray("bodySite");
23738      for (int i = 0; i < array.size(); i++) {
23739        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23740      }
23741    };
23742    if (json.has("note")) {
23743      JsonArray array = json.getAsJsonArray("note");
23744      for (int i = 0; i < array.size(); i++) {
23745        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23746      }
23747    };
23748    if (json.has("patientInstruction"))
23749      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
23750    if (json.has("_patientInstruction"))
23751      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
23752    if (json.has("relevantHistory")) {
23753      JsonArray array = json.getAsJsonArray("relevantHistory");
23754      for (int i = 0; i < array.size(); i++) {
23755        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
23756      }
23757    };
23758  }
23759
23760  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
23761    Slot res = new Slot();
23762    parseSlotProperties(json, res);
23763    return res;
23764  }
23765
23766  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
23767    parseDomainResourceProperties(json, res);
23768    if (json.has("identifier")) {
23769      JsonArray array = json.getAsJsonArray("identifier");
23770      for (int i = 0; i < array.size(); i++) {
23771        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23772      }
23773    };
23774    if (json.has("serviceCategory")) {
23775      JsonArray array = json.getAsJsonArray("serviceCategory");
23776      for (int i = 0; i < array.size(); i++) {
23777        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23778      }
23779    };
23780    if (json.has("serviceType")) {
23781      JsonArray array = json.getAsJsonArray("serviceType");
23782      for (int i = 0; i < array.size(); i++) {
23783        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23784      }
23785    };
23786    if (json.has("specialty")) {
23787      JsonArray array = json.getAsJsonArray("specialty");
23788      for (int i = 0; i < array.size(); i++) {
23789        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23790      }
23791    };
23792    if (json.has("appointmentType"))
23793      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
23794    if (json.has("schedule"))
23795      res.setSchedule(parseReference(getJObject(json, "schedule")));
23796    if (json.has("status"))
23797      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
23798    if (json.has("_status"))
23799      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23800    if (json.has("start"))
23801      res.setStartElement(parseInstant(json.get("start").getAsString()));
23802    if (json.has("_start"))
23803      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
23804    if (json.has("end"))
23805      res.setEndElement(parseInstant(json.get("end").getAsString()));
23806    if (json.has("_end"))
23807      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
23808    if (json.has("overbooked"))
23809      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
23810    if (json.has("_overbooked"))
23811      parseElementProperties(getJObject(json, "_overbooked"), res.getOverbookedElement());
23812    if (json.has("comment"))
23813      res.setCommentElement(parseString(json.get("comment").getAsString()));
23814    if (json.has("_comment"))
23815      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
23816  }
23817
23818  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
23819    Specimen res = new Specimen();
23820    parseSpecimenProperties(json, res);
23821    return res;
23822  }
23823
23824  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
23825    parseDomainResourceProperties(json, res);
23826    if (json.has("identifier")) {
23827      JsonArray array = json.getAsJsonArray("identifier");
23828      for (int i = 0; i < array.size(); i++) {
23829        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23830      }
23831    };
23832    if (json.has("accessionIdentifier"))
23833      res.setAccessionIdentifier(parseIdentifier(getJObject(json, "accessionIdentifier")));
23834    if (json.has("status"))
23835      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
23836    if (json.has("_status"))
23837      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
23838    if (json.has("type"))
23839      res.setType(parseCodeableConcept(getJObject(json, "type")));
23840    if (json.has("subject"))
23841      res.setSubject(parseReference(getJObject(json, "subject")));
23842    if (json.has("receivedTime"))
23843      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
23844    if (json.has("_receivedTime"))
23845      parseElementProperties(getJObject(json, "_receivedTime"), res.getReceivedTimeElement());
23846    if (json.has("parent")) {
23847      JsonArray array = json.getAsJsonArray("parent");
23848      for (int i = 0; i < array.size(); i++) {
23849        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
23850      }
23851    };
23852    if (json.has("request")) {
23853      JsonArray array = json.getAsJsonArray("request");
23854      for (int i = 0; i < array.size(); i++) {
23855        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
23856      }
23857    };
23858    if (json.has("collection"))
23859      res.setCollection(parseSpecimenSpecimenCollectionComponent(getJObject(json, "collection"), res));
23860    if (json.has("processing")) {
23861      JsonArray array = json.getAsJsonArray("processing");
23862      for (int i = 0; i < array.size(); i++) {
23863        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
23864      }
23865    };
23866    if (json.has("container")) {
23867      JsonArray array = json.getAsJsonArray("container");
23868      for (int i = 0; i < array.size(); i++) {
23869        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
23870      }
23871    };
23872    if (json.has("condition")) {
23873      JsonArray array = json.getAsJsonArray("condition");
23874      for (int i = 0; i < array.size(); i++) {
23875        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23876      }
23877    };
23878    if (json.has("note")) {
23879      JsonArray array = json.getAsJsonArray("note");
23880      for (int i = 0; i < array.size(); i++) {
23881        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23882      }
23883    };
23884  }
23885
23886  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23887    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
23888    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
23889    return res;
23890  }
23891
23892  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
23893    parseBackboneElementProperties(json, res);
23894    if (json.has("collector"))
23895      res.setCollector(parseReference(getJObject(json, "collector")));
23896    Type collected = parseType("collected", json);
23897    if (collected != null)
23898      res.setCollected(collected);
23899    if (json.has("duration"))
23900      res.setDuration(parseDuration(getJObject(json, "duration")));
23901    if (json.has("quantity"))
23902      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
23903    if (json.has("method"))
23904      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
23905    if (json.has("bodySite"))
23906      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
23907    Type fastingStatus = parseType("fastingStatus", json);
23908    if (fastingStatus != null)
23909      res.setFastingStatus(fastingStatus);
23910  }
23911
23912  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23913    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
23914    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
23915    return res;
23916  }
23917
23918  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
23919    parseBackboneElementProperties(json, res);
23920    if (json.has("description"))
23921      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23922    if (json.has("_description"))
23923      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23924    if (json.has("procedure"))
23925      res.setProcedure(parseCodeableConcept(getJObject(json, "procedure")));
23926    if (json.has("additive")) {
23927      JsonArray array = json.getAsJsonArray("additive");
23928      for (int i = 0; i < array.size(); i++) {
23929        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
23930      }
23931    };
23932    Type time = parseType("time", json);
23933    if (time != null)
23934      res.setTime(time);
23935  }
23936
23937  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23938    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
23939    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
23940    return res;
23941  }
23942
23943  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
23944    parseBackboneElementProperties(json, res);
23945    if (json.has("identifier")) {
23946      JsonArray array = json.getAsJsonArray("identifier");
23947      for (int i = 0; i < array.size(); i++) {
23948        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23949      }
23950    };
23951    if (json.has("description"))
23952      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23953    if (json.has("_description"))
23954      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
23955    if (json.has("type"))
23956      res.setType(parseCodeableConcept(getJObject(json, "type")));
23957    if (json.has("capacity"))
23958      res.setCapacity(parseQuantity(getJObject(json, "capacity")));
23959    if (json.has("specimenQuantity"))
23960      res.setSpecimenQuantity(parseQuantity(getJObject(json, "specimenQuantity")));
23961    Type additive = parseType("additive", json);
23962    if (additive != null)
23963      res.setAdditive(additive);
23964  }
23965
23966  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
23967    SpecimenDefinition res = new SpecimenDefinition();
23968    parseSpecimenDefinitionProperties(json, res);
23969    return res;
23970  }
23971
23972  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res) throws IOException, FHIRFormatError {
23973    parseDomainResourceProperties(json, res);
23974    if (json.has("identifier"))
23975      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
23976    if (json.has("typeCollected"))
23977      res.setTypeCollected(parseCodeableConcept(getJObject(json, "typeCollected")));
23978    if (json.has("patientPreparation")) {
23979      JsonArray array = json.getAsJsonArray("patientPreparation");
23980      for (int i = 0; i < array.size(); i++) {
23981        res.getPatientPreparation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23982      }
23983    };
23984    if (json.has("timeAspect"))
23985      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
23986    if (json.has("_timeAspect"))
23987      parseElementProperties(getJObject(json, "_timeAspect"), res.getTimeAspectElement());
23988    if (json.has("collection")) {
23989      JsonArray array = json.getAsJsonArray("collection");
23990      for (int i = 0; i < array.size(); i++) {
23991        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23992      }
23993    };
23994    if (json.has("typeTested")) {
23995      JsonArray array = json.getAsJsonArray("typeTested");
23996      for (int i = 0; i < array.size(); i++) {
23997        res.getTypeTested().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(array.get(i).getAsJsonObject(), res));
23998      }
23999    };
24000  }
24001
24002  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
24003    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
24004    parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(json, owner, res);
24005    return res;
24006  }
24007
24008  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res) throws IOException, FHIRFormatError {
24009    parseBackboneElementProperties(json, res);
24010    if (json.has("isDerived"))
24011      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
24012    if (json.has("_isDerived"))
24013      parseElementProperties(getJObject(json, "_isDerived"), res.getIsDerivedElement());
24014    if (json.has("type"))
24015      res.setType(parseCodeableConcept(getJObject(json, "type")));
24016    if (json.has("preference"))
24017      res.setPreferenceElement(parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL, new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
24018    if (json.has("_preference"))
24019      parseElementProperties(getJObject(json, "_preference"), res.getPreferenceElement());
24020    if (json.has("container"))
24021      res.setContainer(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(getJObject(json, "container"), owner));
24022    if (json.has("requirement"))
24023      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
24024    if (json.has("_requirement"))
24025      parseElementProperties(getJObject(json, "_requirement"), res.getRequirementElement());
24026    if (json.has("retentionTime"))
24027      res.setRetentionTime(parseDuration(getJObject(json, "retentionTime")));
24028    if (json.has("rejectionCriterion")) {
24029      JsonArray array = json.getAsJsonArray("rejectionCriterion");
24030      for (int i = 0; i < array.size(); i++) {
24031        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24032      }
24033    };
24034    if (json.has("handling")) {
24035      JsonArray array = json.getAsJsonArray("handling");
24036      for (int i = 0; i < array.size(); i++) {
24037        res.getHandling().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(array.get(i).getAsJsonObject(), owner));
24038      }
24039    };
24040  }
24041
24042  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
24043    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
24044    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(json, owner, res);
24045    return res;
24046  }
24047
24048  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res) throws IOException, FHIRFormatError {
24049    parseBackboneElementProperties(json, res);
24050    if (json.has("material"))
24051      res.setMaterial(parseCodeableConcept(getJObject(json, "material")));
24052    if (json.has("type"))
24053      res.setType(parseCodeableConcept(getJObject(json, "type")));
24054    if (json.has("cap"))
24055      res.setCap(parseCodeableConcept(getJObject(json, "cap")));
24056    if (json.has("description"))
24057      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24058    if (json.has("_description"))
24059      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24060    if (json.has("capacity"))
24061      res.setCapacity(parseQuantity(getJObject(json, "capacity")));
24062    Type minimumVolume = parseType("minimumVolume", json);
24063    if (minimumVolume != null)
24064      res.setMinimumVolume(minimumVolume);
24065    if (json.has("additive")) {
24066      JsonArray array = json.getAsJsonArray("additive");
24067      for (int i = 0; i < array.size(); i++) {
24068        res.getAdditive().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(array.get(i).getAsJsonObject(), owner));
24069      }
24070    };
24071    if (json.has("preparation"))
24072      res.setPreparationElement(parseString(json.get("preparation").getAsString()));
24073    if (json.has("_preparation"))
24074      parseElementProperties(getJObject(json, "_preparation"), res.getPreparationElement());
24075  }
24076
24077  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
24078    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
24079    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(json, owner, res);
24080    return res;
24081  }
24082
24083  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res) throws IOException, FHIRFormatError {
24084    parseBackboneElementProperties(json, res);
24085    Type additive = parseType("additive", json);
24086    if (additive != null)
24087      res.setAdditive(additive);
24088  }
24089
24090  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
24091    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
24092    parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(json, owner, res);
24093    return res;
24094  }
24095
24096  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res) throws IOException, FHIRFormatError {
24097    parseBackboneElementProperties(json, res);
24098    if (json.has("temperatureQualifier"))
24099      res.setTemperatureQualifier(parseCodeableConcept(getJObject(json, "temperatureQualifier")));
24100    if (json.has("temperatureRange"))
24101      res.setTemperatureRange(parseRange(getJObject(json, "temperatureRange")));
24102    if (json.has("maxDuration"))
24103      res.setMaxDuration(parseDuration(getJObject(json, "maxDuration")));
24104    if (json.has("instruction"))
24105      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
24106    if (json.has("_instruction"))
24107      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
24108  }
24109
24110  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
24111    StructureDefinition res = new StructureDefinition();
24112    parseStructureDefinitionProperties(json, res);
24113    return res;
24114  }
24115
24116  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
24117    parseDomainResourceProperties(json, res);
24118    if (json.has("url"))
24119      res.setUrlElement(parseUri(json.get("url").getAsString()));
24120    if (json.has("_url"))
24121      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
24122    if (json.has("identifier")) {
24123      JsonArray array = json.getAsJsonArray("identifier");
24124      for (int i = 0; i < array.size(); i++) {
24125        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24126      }
24127    };
24128    if (json.has("version"))
24129      res.setVersionElement(parseString(json.get("version").getAsString()));
24130    if (json.has("_version"))
24131      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
24132    if (json.has("name"))
24133      res.setNameElement(parseString(json.get("name").getAsString()));
24134    if (json.has("_name"))
24135      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24136    if (json.has("title"))
24137      res.setTitleElement(parseString(json.get("title").getAsString()));
24138    if (json.has("_title"))
24139      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
24140    if (json.has("status"))
24141      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24142    if (json.has("_status"))
24143      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24144    if (json.has("experimental"))
24145      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24146    if (json.has("_experimental"))
24147      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
24148    if (json.has("date"))
24149      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24150    if (json.has("_date"))
24151      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
24152    if (json.has("publisher"))
24153      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24154    if (json.has("_publisher"))
24155      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
24156    if (json.has("contact")) {
24157      JsonArray array = json.getAsJsonArray("contact");
24158      for (int i = 0; i < array.size(); i++) {
24159        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24160      }
24161    };
24162    if (json.has("description"))
24163      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24164    if (json.has("_description"))
24165      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24166    if (json.has("useContext")) {
24167      JsonArray array = json.getAsJsonArray("useContext");
24168      for (int i = 0; i < array.size(); i++) {
24169        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24170      }
24171    };
24172    if (json.has("jurisdiction")) {
24173      JsonArray array = json.getAsJsonArray("jurisdiction");
24174      for (int i = 0; i < array.size(); i++) {
24175        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24176      }
24177    };
24178    if (json.has("purpose"))
24179      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24180    if (json.has("_purpose"))
24181      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
24182    if (json.has("copyright"))
24183      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24184    if (json.has("_copyright"))
24185      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
24186    if (json.has("keyword")) {
24187      JsonArray array = json.getAsJsonArray("keyword");
24188      for (int i = 0; i < array.size(); i++) {
24189        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
24190      }
24191    };
24192    if (json.has("fhirVersion"))
24193      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
24194    if (json.has("_fhirVersion"))
24195      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
24196    if (json.has("mapping")) {
24197      JsonArray array = json.getAsJsonArray("mapping");
24198      for (int i = 0; i < array.size(); i++) {
24199        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
24200      }
24201    };
24202    if (json.has("kind"))
24203      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
24204    if (json.has("_kind"))
24205      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
24206    if (json.has("abstract"))
24207      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
24208    if (json.has("_abstract"))
24209      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
24210    if (json.has("context")) {
24211      JsonArray array = json.getAsJsonArray("context");
24212      for (int i = 0; i < array.size(); i++) {
24213        res.getContext().add(parseStructureDefinitionStructureDefinitionContextComponent(array.get(i).getAsJsonObject(), res));
24214      }
24215    };
24216    if (json.has("contextInvariant")) {
24217      JsonArray array = json.getAsJsonArray("contextInvariant");
24218      for (int i = 0; i < array.size(); i++) {
24219        if (array.get(i).isJsonNull()) {
24220          res.getContextInvariant().add(new StringType());
24221        } else {
24222          res.getContextInvariant().add(parseString(array.get(i).getAsString()));
24223        }
24224      }
24225    };
24226    if (json.has("_contextInvariant")) {
24227      JsonArray array = json.getAsJsonArray("_contextInvariant");
24228      for (int i = 0; i < array.size(); i++) {
24229        if (i == res.getContextInvariant().size())
24230          res.getContextInvariant().add(parseString(null));
24231        if (array.get(i) instanceof JsonObject) 
24232          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
24233      }
24234    };
24235    if (json.has("type"))
24236      res.setTypeElement(parseUri(json.get("type").getAsString()));
24237    if (json.has("_type"))
24238      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24239    if (json.has("baseDefinition"))
24240      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
24241    if (json.has("_baseDefinition"))
24242      parseElementProperties(getJObject(json, "_baseDefinition"), res.getBaseDefinitionElement());
24243    if (json.has("derivation"))
24244      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
24245    if (json.has("_derivation"))
24246      parseElementProperties(getJObject(json, "_derivation"), res.getDerivationElement());
24247    if (json.has("snapshot"))
24248      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(getJObject(json, "snapshot"), res));
24249    if (json.has("differential"))
24250      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(getJObject(json, "differential"), res));
24251  }
24252
24253  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
24254    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
24255    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
24256    return res;
24257  }
24258
24259  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
24260    parseBackboneElementProperties(json, res);
24261    if (json.has("identity"))
24262      res.setIdentityElement(parseId(json.get("identity").getAsString()));
24263    if (json.has("_identity"))
24264      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
24265    if (json.has("uri"))
24266      res.setUriElement(parseUri(json.get("uri").getAsString()));
24267    if (json.has("_uri"))
24268      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
24269    if (json.has("name"))
24270      res.setNameElement(parseString(json.get("name").getAsString()));
24271    if (json.has("_name"))
24272      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24273    if (json.has("comment"))
24274      res.setCommentElement(parseString(json.get("comment").getAsString()));
24275    if (json.has("_comment"))
24276      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
24277  }
24278
24279  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionStructureDefinitionContextComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
24280    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
24281    parseStructureDefinitionStructureDefinitionContextComponentProperties(json, owner, res);
24282    return res;
24283  }
24284
24285  protected void parseStructureDefinitionStructureDefinitionContextComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionContextComponent res) throws IOException, FHIRFormatError {
24286    parseBackboneElementProperties(json, res);
24287    if (json.has("type"))
24288      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL, new StructureDefinition.ExtensionContextTypeEnumFactory()));
24289    if (json.has("_type"))
24290      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24291    if (json.has("expression"))
24292      res.setExpressionElement(parseString(json.get("expression").getAsString()));
24293    if (json.has("_expression"))
24294      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
24295  }
24296
24297  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
24298    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
24299    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
24300    return res;
24301  }
24302
24303  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
24304    parseBackboneElementProperties(json, res);
24305    if (json.has("element")) {
24306      JsonArray array = json.getAsJsonArray("element");
24307      for (int i = 0; i < array.size(); i++) {
24308        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
24309      }
24310    };
24311  }
24312
24313  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
24314    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
24315    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
24316    return res;
24317  }
24318
24319  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
24320    parseBackboneElementProperties(json, res);
24321    if (json.has("element")) {
24322      JsonArray array = json.getAsJsonArray("element");
24323      for (int i = 0; i < array.size(); i++) {
24324        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
24325      }
24326    };
24327  }
24328
24329  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
24330    StructureMap res = new StructureMap();
24331    parseStructureMapProperties(json, res);
24332    return res;
24333  }
24334
24335  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
24336    parseDomainResourceProperties(json, res);
24337    if (json.has("url"))
24338      res.setUrlElement(parseUri(json.get("url").getAsString()));
24339    if (json.has("_url"))
24340      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
24341    if (json.has("identifier")) {
24342      JsonArray array = json.getAsJsonArray("identifier");
24343      for (int i = 0; i < array.size(); i++) {
24344        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24345      }
24346    };
24347    if (json.has("version"))
24348      res.setVersionElement(parseString(json.get("version").getAsString()));
24349    if (json.has("_version"))
24350      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
24351    if (json.has("name"))
24352      res.setNameElement(parseString(json.get("name").getAsString()));
24353    if (json.has("_name"))
24354      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24355    if (json.has("title"))
24356      res.setTitleElement(parseString(json.get("title").getAsString()));
24357    if (json.has("_title"))
24358      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
24359    if (json.has("status"))
24360      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24361    if (json.has("_status"))
24362      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24363    if (json.has("experimental"))
24364      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24365    if (json.has("_experimental"))
24366      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
24367    if (json.has("date"))
24368      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24369    if (json.has("_date"))
24370      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
24371    if (json.has("publisher"))
24372      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24373    if (json.has("_publisher"))
24374      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
24375    if (json.has("contact")) {
24376      JsonArray array = json.getAsJsonArray("contact");
24377      for (int i = 0; i < array.size(); i++) {
24378        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24379      }
24380    };
24381    if (json.has("description"))
24382      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24383    if (json.has("_description"))
24384      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24385    if (json.has("useContext")) {
24386      JsonArray array = json.getAsJsonArray("useContext");
24387      for (int i = 0; i < array.size(); i++) {
24388        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24389      }
24390    };
24391    if (json.has("jurisdiction")) {
24392      JsonArray array = json.getAsJsonArray("jurisdiction");
24393      for (int i = 0; i < array.size(); i++) {
24394        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24395      }
24396    };
24397    if (json.has("purpose"))
24398      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24399    if (json.has("_purpose"))
24400      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
24401    if (json.has("copyright"))
24402      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24403    if (json.has("_copyright"))
24404      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
24405    if (json.has("structure")) {
24406      JsonArray array = json.getAsJsonArray("structure");
24407      for (int i = 0; i < array.size(); i++) {
24408        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
24409      }
24410    };
24411    if (json.has("import")) {
24412      JsonArray array = json.getAsJsonArray("import");
24413      for (int i = 0; i < array.size(); i++) {
24414        if (array.get(i).isJsonNull()) {
24415          res.getImport().add(new CanonicalType());
24416        } else {
24417          res.getImport().add(parseCanonical(array.get(i).getAsString()));
24418        }
24419      }
24420    };
24421    if (json.has("_import")) {
24422      JsonArray array = json.getAsJsonArray("_import");
24423      for (int i = 0; i < array.size(); i++) {
24424        if (i == res.getImport().size())
24425          res.getImport().add(parseCanonical(null));
24426        if (array.get(i) instanceof JsonObject) 
24427          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
24428      }
24429    };
24430    if (json.has("group")) {
24431      JsonArray array = json.getAsJsonArray("group");
24432      for (int i = 0; i < array.size(); i++) {
24433        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
24434      }
24435    };
24436  }
24437
24438  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24439    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
24440    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
24441    return res;
24442  }
24443
24444  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
24445    parseBackboneElementProperties(json, res);
24446    if (json.has("url"))
24447      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
24448    if (json.has("_url"))
24449      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
24450    if (json.has("mode"))
24451      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
24452    if (json.has("_mode"))
24453      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
24454    if (json.has("alias"))
24455      res.setAliasElement(parseString(json.get("alias").getAsString()));
24456    if (json.has("_alias"))
24457      parseElementProperties(getJObject(json, "_alias"), res.getAliasElement());
24458    if (json.has("documentation"))
24459      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24460    if (json.has("_documentation"))
24461      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
24462  }
24463
24464  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24465    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
24466    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
24467    return res;
24468  }
24469
24470  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
24471    parseBackboneElementProperties(json, res);
24472    if (json.has("name"))
24473      res.setNameElement(parseId(json.get("name").getAsString()));
24474    if (json.has("_name"))
24475      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24476    if (json.has("extends"))
24477      res.setExtendsElement(parseId(json.get("extends").getAsString()));
24478    if (json.has("_extends"))
24479      parseElementProperties(getJObject(json, "_extends"), res.getExtendsElement());
24480    if (json.has("typeMode"))
24481      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
24482    if (json.has("_typeMode"))
24483      parseElementProperties(getJObject(json, "_typeMode"), res.getTypeModeElement());
24484    if (json.has("documentation"))
24485      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24486    if (json.has("_documentation"))
24487      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
24488    if (json.has("input")) {
24489      JsonArray array = json.getAsJsonArray("input");
24490      for (int i = 0; i < array.size(); i++) {
24491        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
24492      }
24493    };
24494    if (json.has("rule")) {
24495      JsonArray array = json.getAsJsonArray("rule");
24496      for (int i = 0; i < array.size(); i++) {
24497        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
24498      }
24499    };
24500  }
24501
24502  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24503    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
24504    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
24505    return res;
24506  }
24507
24508  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
24509    parseBackboneElementProperties(json, res);
24510    if (json.has("name"))
24511      res.setNameElement(parseId(json.get("name").getAsString()));
24512    if (json.has("_name"))
24513      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24514    if (json.has("type"))
24515      res.setTypeElement(parseString(json.get("type").getAsString()));
24516    if (json.has("_type"))
24517      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24518    if (json.has("mode"))
24519      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
24520    if (json.has("_mode"))
24521      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
24522    if (json.has("documentation"))
24523      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24524    if (json.has("_documentation"))
24525      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
24526  }
24527
24528  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24529    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
24530    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
24531    return res;
24532  }
24533
24534  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
24535    parseBackboneElementProperties(json, res);
24536    if (json.has("name"))
24537      res.setNameElement(parseId(json.get("name").getAsString()));
24538    if (json.has("_name"))
24539      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24540    if (json.has("source")) {
24541      JsonArray array = json.getAsJsonArray("source");
24542      for (int i = 0; i < array.size(); i++) {
24543        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
24544      }
24545    };
24546    if (json.has("target")) {
24547      JsonArray array = json.getAsJsonArray("target");
24548      for (int i = 0; i < array.size(); i++) {
24549        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
24550      }
24551    };
24552    if (json.has("rule")) {
24553      JsonArray array = json.getAsJsonArray("rule");
24554      for (int i = 0; i < array.size(); i++) {
24555        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
24556      }
24557    };
24558    if (json.has("dependent")) {
24559      JsonArray array = json.getAsJsonArray("dependent");
24560      for (int i = 0; i < array.size(); i++) {
24561        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
24562      }
24563    };
24564    if (json.has("documentation"))
24565      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24566    if (json.has("_documentation"))
24567      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
24568  }
24569
24570  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24571    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
24572    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
24573    return res;
24574  }
24575
24576  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
24577    parseBackboneElementProperties(json, res);
24578    if (json.has("context"))
24579      res.setContextElement(parseId(json.get("context").getAsString()));
24580    if (json.has("_context"))
24581      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
24582    if (json.has("min"))
24583      res.setMinElement(parseInteger(json.get("min").getAsLong()));
24584    if (json.has("_min"))
24585      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
24586    if (json.has("max"))
24587      res.setMaxElement(parseString(json.get("max").getAsString()));
24588    if (json.has("_max"))
24589      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
24590    if (json.has("type"))
24591      res.setTypeElement(parseString(json.get("type").getAsString()));
24592    if (json.has("_type"))
24593      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24594    Type defaultValue = parseType("defaultValue", json);
24595    if (defaultValue != null)
24596      res.setDefaultValue(defaultValue);
24597    if (json.has("element"))
24598      res.setElementElement(parseString(json.get("element").getAsString()));
24599    if (json.has("_element"))
24600      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
24601    if (json.has("listMode"))
24602      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
24603    if (json.has("_listMode"))
24604      parseElementProperties(getJObject(json, "_listMode"), res.getListModeElement());
24605    if (json.has("variable"))
24606      res.setVariableElement(parseId(json.get("variable").getAsString()));
24607    if (json.has("_variable"))
24608      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
24609    if (json.has("condition"))
24610      res.setConditionElement(parseString(json.get("condition").getAsString()));
24611    if (json.has("_condition"))
24612      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
24613    if (json.has("check"))
24614      res.setCheckElement(parseString(json.get("check").getAsString()));
24615    if (json.has("_check"))
24616      parseElementProperties(getJObject(json, "_check"), res.getCheckElement());
24617    if (json.has("logMessage"))
24618      res.setLogMessageElement(parseString(json.get("logMessage").getAsString()));
24619    if (json.has("_logMessage"))
24620      parseElementProperties(getJObject(json, "_logMessage"), res.getLogMessageElement());
24621  }
24622
24623  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24624    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
24625    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
24626    return res;
24627  }
24628
24629  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
24630    parseBackboneElementProperties(json, res);
24631    if (json.has("context"))
24632      res.setContextElement(parseId(json.get("context").getAsString()));
24633    if (json.has("_context"))
24634      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
24635    if (json.has("contextType"))
24636      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
24637    if (json.has("_contextType"))
24638      parseElementProperties(getJObject(json, "_contextType"), res.getContextTypeElement());
24639    if (json.has("element"))
24640      res.setElementElement(parseString(json.get("element").getAsString()));
24641    if (json.has("_element"))
24642      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
24643    if (json.has("variable"))
24644      res.setVariableElement(parseId(json.get("variable").getAsString()));
24645    if (json.has("_variable"))
24646      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
24647    if (json.has("listMode")) {
24648      JsonArray array = json.getAsJsonArray("listMode");
24649      for (int i = 0; i < array.size(); i++) {
24650        if (array.get(i).isJsonNull()) {
24651          res.getListMode().add(new Enumeration<StructureMap.StructureMapTargetListMode>());
24652        } else {
24653          res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
24654        }
24655      }
24656    };
24657    if (json.has("_listMode")) {
24658      JsonArray array = json.getAsJsonArray("_listMode");
24659      for (int i = 0; i < array.size(); i++) {
24660        if (i == res.getListMode().size())
24661          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
24662        if (array.get(i) instanceof JsonObject) 
24663          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
24664      }
24665    };
24666    if (json.has("listRuleId"))
24667      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
24668    if (json.has("_listRuleId"))
24669      parseElementProperties(getJObject(json, "_listRuleId"), res.getListRuleIdElement());
24670    if (json.has("transform"))
24671      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
24672    if (json.has("_transform"))
24673      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
24674    if (json.has("parameter")) {
24675      JsonArray array = json.getAsJsonArray("parameter");
24676      for (int i = 0; i < array.size(); i++) {
24677        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
24678      }
24679    };
24680  }
24681
24682  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24683    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
24684    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
24685    return res;
24686  }
24687
24688  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
24689    parseBackboneElementProperties(json, res);
24690    Type value = parseType("value", json);
24691    if (value != null)
24692      res.setValue(value);
24693  }
24694
24695  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24696    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
24697    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
24698    return res;
24699  }
24700
24701  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
24702    parseBackboneElementProperties(json, res);
24703    if (json.has("name"))
24704      res.setNameElement(parseId(json.get("name").getAsString()));
24705    if (json.has("_name"))
24706      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24707    if (json.has("variable")) {
24708      JsonArray array = json.getAsJsonArray("variable");
24709      for (int i = 0; i < array.size(); i++) {
24710        if (array.get(i).isJsonNull()) {
24711          res.getVariable().add(new StringType());
24712        } else {
24713          res.getVariable().add(parseString(array.get(i).getAsString()));
24714        }
24715      }
24716    };
24717    if (json.has("_variable")) {
24718      JsonArray array = json.getAsJsonArray("_variable");
24719      for (int i = 0; i < array.size(); i++) {
24720        if (i == res.getVariable().size())
24721          res.getVariable().add(parseString(null));
24722        if (array.get(i) instanceof JsonObject) 
24723          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
24724      }
24725    };
24726  }
24727
24728  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
24729    Subscription res = new Subscription();
24730    parseSubscriptionProperties(json, res);
24731    return res;
24732  }
24733
24734  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
24735    parseDomainResourceProperties(json, res);
24736    if (json.has("status"))
24737      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
24738    if (json.has("_status"))
24739      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24740    if (json.has("contact")) {
24741      JsonArray array = json.getAsJsonArray("contact");
24742      for (int i = 0; i < array.size(); i++) {
24743        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
24744      }
24745    };
24746    if (json.has("end"))
24747      res.setEndElement(parseInstant(json.get("end").getAsString()));
24748    if (json.has("_end"))
24749      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
24750    if (json.has("reason"))
24751      res.setReasonElement(parseString(json.get("reason").getAsString()));
24752    if (json.has("_reason"))
24753      parseElementProperties(getJObject(json, "_reason"), res.getReasonElement());
24754    if (json.has("criteria"))
24755      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
24756    if (json.has("_criteria"))
24757      parseElementProperties(getJObject(json, "_criteria"), res.getCriteriaElement());
24758    if (json.has("error"))
24759      res.setErrorElement(parseString(json.get("error").getAsString()));
24760    if (json.has("_error"))
24761      parseElementProperties(getJObject(json, "_error"), res.getErrorElement());
24762    if (json.has("channel"))
24763      res.setChannel(parseSubscriptionSubscriptionChannelComponent(getJObject(json, "channel"), res));
24764  }
24765
24766  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
24767    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
24768    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
24769    return res;
24770  }
24771
24772  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
24773    parseBackboneElementProperties(json, res);
24774    if (json.has("type"))
24775      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
24776    if (json.has("_type"))
24777      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
24778    if (json.has("endpoint"))
24779      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
24780    if (json.has("_endpoint"))
24781      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
24782    if (json.has("payload"))
24783      res.setPayloadElement(parseCode(json.get("payload").getAsString()));
24784    if (json.has("_payload"))
24785      parseElementProperties(getJObject(json, "_payload"), res.getPayloadElement());
24786    if (json.has("header")) {
24787      JsonArray array = json.getAsJsonArray("header");
24788      for (int i = 0; i < array.size(); i++) {
24789        if (array.get(i).isJsonNull()) {
24790          res.getHeader().add(new StringType());
24791        } else {
24792          res.getHeader().add(parseString(array.get(i).getAsString()));
24793        }
24794      }
24795    };
24796    if (json.has("_header")) {
24797      JsonArray array = json.getAsJsonArray("_header");
24798      for (int i = 0; i < array.size(); i++) {
24799        if (i == res.getHeader().size())
24800          res.getHeader().add(parseString(null));
24801        if (array.get(i) instanceof JsonObject) 
24802          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
24803      }
24804    };
24805  }
24806
24807  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
24808    Substance res = new Substance();
24809    parseSubstanceProperties(json, res);
24810    return res;
24811  }
24812
24813  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
24814    parseDomainResourceProperties(json, res);
24815    if (json.has("identifier")) {
24816      JsonArray array = json.getAsJsonArray("identifier");
24817      for (int i = 0; i < array.size(); i++) {
24818        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24819      }
24820    };
24821    if (json.has("status"))
24822      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
24823    if (json.has("_status"))
24824      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
24825    if (json.has("category")) {
24826      JsonArray array = json.getAsJsonArray("category");
24827      for (int i = 0; i < array.size(); i++) {
24828        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24829      }
24830    };
24831    if (json.has("code"))
24832      res.setCode(parseCodeableConcept(getJObject(json, "code")));
24833    if (json.has("description"))
24834      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24835    if (json.has("_description"))
24836      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
24837    if (json.has("instance")) {
24838      JsonArray array = json.getAsJsonArray("instance");
24839      for (int i = 0; i < array.size(); i++) {
24840        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
24841      }
24842    };
24843    if (json.has("ingredient")) {
24844      JsonArray array = json.getAsJsonArray("ingredient");
24845      for (int i = 0; i < array.size(); i++) {
24846        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
24847      }
24848    };
24849  }
24850
24851  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
24852    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
24853    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
24854    return res;
24855  }
24856
24857  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
24858    parseBackboneElementProperties(json, res);
24859    if (json.has("identifier"))
24860      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
24861    if (json.has("expiry"))
24862      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
24863    if (json.has("_expiry"))
24864      parseElementProperties(getJObject(json, "_expiry"), res.getExpiryElement());
24865    if (json.has("quantity"))
24866      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
24867  }
24868
24869  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
24870    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
24871    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
24872    return res;
24873  }
24874
24875  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
24876    parseBackboneElementProperties(json, res);
24877    if (json.has("quantity"))
24878      res.setQuantity(parseRatio(getJObject(json, "quantity")));
24879    Type substance = parseType("substance", json);
24880    if (substance != null)
24881      res.setSubstance(substance);
24882  }
24883
24884  protected SubstanceNucleicAcid parseSubstanceNucleicAcid(JsonObject json) throws IOException, FHIRFormatError {
24885    SubstanceNucleicAcid res = new SubstanceNucleicAcid();
24886    parseSubstanceNucleicAcidProperties(json, res);
24887    return res;
24888  }
24889
24890  protected void parseSubstanceNucleicAcidProperties(JsonObject json, SubstanceNucleicAcid res) throws IOException, FHIRFormatError {
24891    parseDomainResourceProperties(json, res);
24892    if (json.has("sequenceType"))
24893      res.setSequenceType(parseCodeableConcept(getJObject(json, "sequenceType")));
24894    if (json.has("numberOfSubunits"))
24895      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
24896    if (json.has("_numberOfSubunits"))
24897      parseElementProperties(getJObject(json, "_numberOfSubunits"), res.getNumberOfSubunitsElement());
24898    if (json.has("areaOfHybridisation"))
24899      res.setAreaOfHybridisationElement(parseString(json.get("areaOfHybridisation").getAsString()));
24900    if (json.has("_areaOfHybridisation"))
24901      parseElementProperties(getJObject(json, "_areaOfHybridisation"), res.getAreaOfHybridisationElement());
24902    if (json.has("oligoNucleotideType"))
24903      res.setOligoNucleotideType(parseCodeableConcept(getJObject(json, "oligoNucleotideType")));
24904    if (json.has("subunit")) {
24905      JsonArray array = json.getAsJsonArray("subunit");
24906      for (int i = 0; i < array.size(); i++) {
24907        res.getSubunit().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(array.get(i).getAsJsonObject(), res));
24908      }
24909    };
24910  }
24911
24912  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24913    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
24914    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(json, owner, res);
24915    return res;
24916  }
24917
24918  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res) throws IOException, FHIRFormatError {
24919    parseBackboneElementProperties(json, res);
24920    if (json.has("subunit"))
24921      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
24922    if (json.has("_subunit"))
24923      parseElementProperties(getJObject(json, "_subunit"), res.getSubunitElement());
24924    if (json.has("sequence"))
24925      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
24926    if (json.has("_sequence"))
24927      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
24928    if (json.has("length"))
24929      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
24930    if (json.has("_length"))
24931      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
24932    if (json.has("sequenceAttachment"))
24933      res.setSequenceAttachment(parseAttachment(getJObject(json, "sequenceAttachment")));
24934    if (json.has("fivePrime"))
24935      res.setFivePrime(parseCodeableConcept(getJObject(json, "fivePrime")));
24936    if (json.has("threePrime"))
24937      res.setThreePrime(parseCodeableConcept(getJObject(json, "threePrime")));
24938    if (json.has("linkage")) {
24939      JsonArray array = json.getAsJsonArray("linkage");
24940      for (int i = 0; i < array.size(); i++) {
24941        res.getLinkage().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(array.get(i).getAsJsonObject(), owner));
24942      }
24943    };
24944    if (json.has("sugar")) {
24945      JsonArray array = json.getAsJsonArray("sugar");
24946      for (int i = 0; i < array.size(); i++) {
24947        res.getSugar().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(array.get(i).getAsJsonObject(), owner));
24948      }
24949    };
24950  }
24951
24952  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24953    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
24954    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(json, owner, res);
24955    return res;
24956  }
24957
24958  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res) throws IOException, FHIRFormatError {
24959    parseBackboneElementProperties(json, res);
24960    if (json.has("connectivity"))
24961      res.setConnectivityElement(parseString(json.get("connectivity").getAsString()));
24962    if (json.has("_connectivity"))
24963      parseElementProperties(getJObject(json, "_connectivity"), res.getConnectivityElement());
24964    if (json.has("identifier"))
24965      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
24966    if (json.has("name"))
24967      res.setNameElement(parseString(json.get("name").getAsString()));
24968    if (json.has("_name"))
24969      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24970    if (json.has("residueSite"))
24971      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
24972    if (json.has("_residueSite"))
24973      parseElementProperties(getJObject(json, "_residueSite"), res.getResidueSiteElement());
24974  }
24975
24976  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24977    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
24978    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(json, owner, res);
24979    return res;
24980  }
24981
24982  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res) throws IOException, FHIRFormatError {
24983    parseBackboneElementProperties(json, res);
24984    if (json.has("identifier"))
24985      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
24986    if (json.has("name"))
24987      res.setNameElement(parseString(json.get("name").getAsString()));
24988    if (json.has("_name"))
24989      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
24990    if (json.has("residueSite"))
24991      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
24992    if (json.has("_residueSite"))
24993      parseElementProperties(getJObject(json, "_residueSite"), res.getResidueSiteElement());
24994  }
24995
24996  protected SubstancePolymer parseSubstancePolymer(JsonObject json) throws IOException, FHIRFormatError {
24997    SubstancePolymer res = new SubstancePolymer();
24998    parseSubstancePolymerProperties(json, res);
24999    return res;
25000  }
25001
25002  protected void parseSubstancePolymerProperties(JsonObject json, SubstancePolymer res) throws IOException, FHIRFormatError {
25003    parseDomainResourceProperties(json, res);
25004    if (json.has("class"))
25005      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
25006    if (json.has("geometry"))
25007      res.setGeometry(parseCodeableConcept(getJObject(json, "geometry")));
25008    if (json.has("copolymerConnectivity")) {
25009      JsonArray array = json.getAsJsonArray("copolymerConnectivity");
25010      for (int i = 0; i < array.size(); i++) {
25011        res.getCopolymerConnectivity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25012      }
25013    };
25014    if (json.has("modification")) {
25015      JsonArray array = json.getAsJsonArray("modification");
25016      for (int i = 0; i < array.size(); i++) {
25017        if (array.get(i).isJsonNull()) {
25018          res.getModification().add(new StringType());
25019        } else {
25020          res.getModification().add(parseString(array.get(i).getAsString()));
25021        }
25022      }
25023    };
25024    if (json.has("_modification")) {
25025      JsonArray array = json.getAsJsonArray("_modification");
25026      for (int i = 0; i < array.size(); i++) {
25027        if (i == res.getModification().size())
25028          res.getModification().add(parseString(null));
25029        if (array.get(i) instanceof JsonObject) 
25030          parseElementProperties(array.get(i).getAsJsonObject(), res.getModification().get(i));
25031      }
25032    };
25033    if (json.has("monomerSet")) {
25034      JsonArray array = json.getAsJsonArray("monomerSet");
25035      for (int i = 0; i < array.size(); i++) {
25036        res.getMonomerSet().add(parseSubstancePolymerSubstancePolymerMonomerSetComponent(array.get(i).getAsJsonObject(), res));
25037      }
25038    };
25039    if (json.has("repeat")) {
25040      JsonArray array = json.getAsJsonArray("repeat");
25041      for (int i = 0; i < array.size(); i++) {
25042        res.getRepeat().add(parseSubstancePolymerSubstancePolymerRepeatComponent(array.get(i).getAsJsonObject(), res));
25043      }
25044    };
25045  }
25046
25047  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerSubstancePolymerMonomerSetComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25048    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
25049    parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(json, owner, res);
25050    return res;
25051  }
25052
25053  protected void parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetComponent res) throws IOException, FHIRFormatError {
25054    parseBackboneElementProperties(json, res);
25055    if (json.has("ratioType"))
25056      res.setRatioType(parseCodeableConcept(getJObject(json, "ratioType")));
25057    if (json.has("startingMaterial")) {
25058      JsonArray array = json.getAsJsonArray("startingMaterial");
25059      for (int i = 0; i < array.size(); i++) {
25060        res.getStartingMaterial().add(parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(array.get(i).getAsJsonObject(), owner));
25061      }
25062    };
25063  }
25064
25065  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25066    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
25067    parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(json, owner, res);
25068    return res;
25069  }
25070
25071  protected void parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res) throws IOException, FHIRFormatError {
25072    parseBackboneElementProperties(json, res);
25073    if (json.has("material"))
25074      res.setMaterial(parseCodeableConcept(getJObject(json, "material")));
25075    if (json.has("type"))
25076      res.setType(parseCodeableConcept(getJObject(json, "type")));
25077    if (json.has("isDefining"))
25078      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
25079    if (json.has("_isDefining"))
25080      parseElementProperties(getJObject(json, "_isDefining"), res.getIsDefiningElement());
25081    if (json.has("amount"))
25082      res.setAmount(parseSubstanceAmount(getJObject(json, "amount")));
25083  }
25084
25085  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerSubstancePolymerRepeatComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25086    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
25087    parseSubstancePolymerSubstancePolymerRepeatComponentProperties(json, owner, res);
25088    return res;
25089  }
25090
25091  protected void parseSubstancePolymerSubstancePolymerRepeatComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatComponent res) throws IOException, FHIRFormatError {
25092    parseBackboneElementProperties(json, res);
25093    if (json.has("numberOfUnits"))
25094      res.setNumberOfUnitsElement(parseInteger(json.get("numberOfUnits").getAsLong()));
25095    if (json.has("_numberOfUnits"))
25096      parseElementProperties(getJObject(json, "_numberOfUnits"), res.getNumberOfUnitsElement());
25097    if (json.has("averageMolecularFormula"))
25098      res.setAverageMolecularFormulaElement(parseString(json.get("averageMolecularFormula").getAsString()));
25099    if (json.has("_averageMolecularFormula"))
25100      parseElementProperties(getJObject(json, "_averageMolecularFormula"), res.getAverageMolecularFormulaElement());
25101    if (json.has("repeatUnitAmountType"))
25102      res.setRepeatUnitAmountType(parseCodeableConcept(getJObject(json, "repeatUnitAmountType")));
25103    if (json.has("repeatUnit")) {
25104      JsonArray array = json.getAsJsonArray("repeatUnit");
25105      for (int i = 0; i < array.size(); i++) {
25106        res.getRepeatUnit().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(array.get(i).getAsJsonObject(), owner));
25107      }
25108    };
25109  }
25110
25111  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25112    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
25113    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(json, owner, res);
25114    return res;
25115  }
25116
25117  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res) throws IOException, FHIRFormatError {
25118    parseBackboneElementProperties(json, res);
25119    if (json.has("orientationOfPolymerisation"))
25120      res.setOrientationOfPolymerisation(parseCodeableConcept(getJObject(json, "orientationOfPolymerisation")));
25121    if (json.has("repeatUnit"))
25122      res.setRepeatUnitElement(parseString(json.get("repeatUnit").getAsString()));
25123    if (json.has("_repeatUnit"))
25124      parseElementProperties(getJObject(json, "_repeatUnit"), res.getRepeatUnitElement());
25125    if (json.has("amount"))
25126      res.setAmount(parseSubstanceAmount(getJObject(json, "amount")));
25127    if (json.has("degreeOfPolymerisation")) {
25128      JsonArray array = json.getAsJsonArray("degreeOfPolymerisation");
25129      for (int i = 0; i < array.size(); i++) {
25130        res.getDegreeOfPolymerisation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(array.get(i).getAsJsonObject(), owner));
25131      }
25132    };
25133    if (json.has("structuralRepresentation")) {
25134      JsonArray array = json.getAsJsonArray("structuralRepresentation");
25135      for (int i = 0; i < array.size(); i++) {
25136        res.getStructuralRepresentation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(array.get(i).getAsJsonObject(), owner));
25137      }
25138    };
25139  }
25140
25141  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25142    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
25143    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(json, owner, res);
25144    return res;
25145  }
25146
25147  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res) throws IOException, FHIRFormatError {
25148    parseBackboneElementProperties(json, res);
25149    if (json.has("degree"))
25150      res.setDegree(parseCodeableConcept(getJObject(json, "degree")));
25151    if (json.has("amount"))
25152      res.setAmount(parseSubstanceAmount(getJObject(json, "amount")));
25153  }
25154
25155  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
25156    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
25157    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(json, owner, res);
25158    return res;
25159  }
25160
25161  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
25162    parseBackboneElementProperties(json, res);
25163    if (json.has("type"))
25164      res.setType(parseCodeableConcept(getJObject(json, "type")));
25165    if (json.has("representation"))
25166      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
25167    if (json.has("_representation"))
25168      parseElementProperties(getJObject(json, "_representation"), res.getRepresentationElement());
25169    if (json.has("attachment"))
25170      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
25171  }
25172
25173  protected SubstanceProtein parseSubstanceProtein(JsonObject json) throws IOException, FHIRFormatError {
25174    SubstanceProtein res = new SubstanceProtein();
25175    parseSubstanceProteinProperties(json, res);
25176    return res;
25177  }
25178
25179  protected void parseSubstanceProteinProperties(JsonObject json, SubstanceProtein res) throws IOException, FHIRFormatError {
25180    parseDomainResourceProperties(json, res);
25181    if (json.has("sequenceType"))
25182      res.setSequenceType(parseCodeableConcept(getJObject(json, "sequenceType")));
25183    if (json.has("numberOfSubunits"))
25184      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
25185    if (json.has("_numberOfSubunits"))
25186      parseElementProperties(getJObject(json, "_numberOfSubunits"), res.getNumberOfSubunitsElement());
25187    if (json.has("disulfideLinkage")) {
25188      JsonArray array = json.getAsJsonArray("disulfideLinkage");
25189      for (int i = 0; i < array.size(); i++) {
25190        if (array.get(i).isJsonNull()) {
25191          res.getDisulfideLinkage().add(new StringType());
25192        } else {
25193          res.getDisulfideLinkage().add(parseString(array.get(i).getAsString()));
25194        }
25195      }
25196    };
25197    if (json.has("_disulfideLinkage")) {
25198      JsonArray array = json.getAsJsonArray("_disulfideLinkage");
25199      for (int i = 0; i < array.size(); i++) {
25200        if (i == res.getDisulfideLinkage().size())
25201          res.getDisulfideLinkage().add(parseString(null));
25202        if (array.get(i) instanceof JsonObject) 
25203          parseElementProperties(array.get(i).getAsJsonObject(), res.getDisulfideLinkage().get(i));
25204      }
25205    };
25206    if (json.has("subunit")) {
25207      JsonArray array = json.getAsJsonArray("subunit");
25208      for (int i = 0; i < array.size(); i++) {
25209        res.getSubunit().add(parseSubstanceProteinSubstanceProteinSubunitComponent(array.get(i).getAsJsonObject(), res));
25210      }
25211    };
25212  }
25213
25214  protected SubstanceProtein.SubstanceProteinSubunitComponent parseSubstanceProteinSubstanceProteinSubunitComponent(JsonObject json, SubstanceProtein owner) throws IOException, FHIRFormatError {
25215    SubstanceProtein.SubstanceProteinSubunitComponent res = new SubstanceProtein.SubstanceProteinSubunitComponent();
25216    parseSubstanceProteinSubstanceProteinSubunitComponentProperties(json, owner, res);
25217    return res;
25218  }
25219
25220  protected void parseSubstanceProteinSubstanceProteinSubunitComponentProperties(JsonObject json, SubstanceProtein owner, SubstanceProtein.SubstanceProteinSubunitComponent res) throws IOException, FHIRFormatError {
25221    parseBackboneElementProperties(json, res);
25222    if (json.has("subunit"))
25223      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
25224    if (json.has("_subunit"))
25225      parseElementProperties(getJObject(json, "_subunit"), res.getSubunitElement());
25226    if (json.has("sequence"))
25227      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
25228    if (json.has("_sequence"))
25229      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
25230    if (json.has("length"))
25231      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
25232    if (json.has("_length"))
25233      parseElementProperties(getJObject(json, "_length"), res.getLengthElement());
25234    if (json.has("sequenceAttachment"))
25235      res.setSequenceAttachment(parseAttachment(getJObject(json, "sequenceAttachment")));
25236    if (json.has("nTerminalModificationId"))
25237      res.setNTerminalModificationId(parseIdentifier(getJObject(json, "nTerminalModificationId")));
25238    if (json.has("nTerminalModification"))
25239      res.setNTerminalModificationElement(parseString(json.get("nTerminalModification").getAsString()));
25240    if (json.has("_nTerminalModification"))
25241      parseElementProperties(getJObject(json, "_nTerminalModification"), res.getNTerminalModificationElement());
25242    if (json.has("cTerminalModificationId"))
25243      res.setCTerminalModificationId(parseIdentifier(getJObject(json, "cTerminalModificationId")));
25244    if (json.has("cTerminalModification"))
25245      res.setCTerminalModificationElement(parseString(json.get("cTerminalModification").getAsString()));
25246    if (json.has("_cTerminalModification"))
25247      parseElementProperties(getJObject(json, "_cTerminalModification"), res.getCTerminalModificationElement());
25248  }
25249
25250  protected SubstanceReferenceInformation parseSubstanceReferenceInformation(JsonObject json) throws IOException, FHIRFormatError {
25251    SubstanceReferenceInformation res = new SubstanceReferenceInformation();
25252    parseSubstanceReferenceInformationProperties(json, res);
25253    return res;
25254  }
25255
25256  protected void parseSubstanceReferenceInformationProperties(JsonObject json, SubstanceReferenceInformation res) throws IOException, FHIRFormatError {
25257    parseDomainResourceProperties(json, res);
25258    if (json.has("comment"))
25259      res.setCommentElement(parseString(json.get("comment").getAsString()));
25260    if (json.has("_comment"))
25261      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
25262    if (json.has("gene")) {
25263      JsonArray array = json.getAsJsonArray("gene");
25264      for (int i = 0; i < array.size(); i++) {
25265        res.getGene().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(array.get(i).getAsJsonObject(), res));
25266      }
25267    };
25268    if (json.has("geneElement")) {
25269      JsonArray array = json.getAsJsonArray("geneElement");
25270      for (int i = 0; i < array.size(); i++) {
25271        res.getGeneElement().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(array.get(i).getAsJsonObject(), res));
25272      }
25273    };
25274    if (json.has("classification")) {
25275      JsonArray array = json.getAsJsonArray("classification");
25276      for (int i = 0; i < array.size(); i++) {
25277        res.getClassification().add(parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(array.get(i).getAsJsonObject(), res));
25278      }
25279    };
25280    if (json.has("target")) {
25281      JsonArray array = json.getAsJsonArray("target");
25282      for (int i = 0; i < array.size(); i++) {
25283        res.getTarget().add(parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(array.get(i).getAsJsonObject(), res));
25284      }
25285    };
25286  }
25287
25288  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
25289    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
25290    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(json, owner, res);
25291    return res;
25292  }
25293
25294  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res) throws IOException, FHIRFormatError {
25295    parseBackboneElementProperties(json, res);
25296    if (json.has("geneSequenceOrigin"))
25297      res.setGeneSequenceOrigin(parseCodeableConcept(getJObject(json, "geneSequenceOrigin")));
25298    if (json.has("gene"))
25299      res.setGene(parseCodeableConcept(getJObject(json, "gene")));
25300    if (json.has("source")) {
25301      JsonArray array = json.getAsJsonArray("source");
25302      for (int i = 0; i < array.size(); i++) {
25303        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25304      }
25305    };
25306  }
25307
25308  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
25309    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
25310    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(json, owner, res);
25311    return res;
25312  }
25313
25314  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res) throws IOException, FHIRFormatError {
25315    parseBackboneElementProperties(json, res);
25316    if (json.has("type"))
25317      res.setType(parseCodeableConcept(getJObject(json, "type")));
25318    if (json.has("element"))
25319      res.setElement(parseIdentifier(getJObject(json, "element")));
25320    if (json.has("source")) {
25321      JsonArray array = json.getAsJsonArray("source");
25322      for (int i = 0; i < array.size(); i++) {
25323        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25324      }
25325    };
25326  }
25327
25328  protected SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
25329    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
25330    parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(json, owner, res);
25331    return res;
25332  }
25333
25334  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res) throws IOException, FHIRFormatError {
25335    parseBackboneElementProperties(json, res);
25336    if (json.has("domain"))
25337      res.setDomain(parseCodeableConcept(getJObject(json, "domain")));
25338    if (json.has("classification"))
25339      res.setClassification(parseCodeableConcept(getJObject(json, "classification")));
25340    if (json.has("subtype")) {
25341      JsonArray array = json.getAsJsonArray("subtype");
25342      for (int i = 0; i < array.size(); i++) {
25343        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25344      }
25345    };
25346    if (json.has("source")) {
25347      JsonArray array = json.getAsJsonArray("source");
25348      for (int i = 0; i < array.size(); i++) {
25349        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25350      }
25351    };
25352  }
25353
25354  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
25355    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
25356    parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(json, owner, res);
25357    return res;
25358  }
25359
25360  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res) throws IOException, FHIRFormatError {
25361    parseBackboneElementProperties(json, res);
25362    if (json.has("target"))
25363      res.setTarget(parseIdentifier(getJObject(json, "target")));
25364    if (json.has("type"))
25365      res.setType(parseCodeableConcept(getJObject(json, "type")));
25366    if (json.has("interaction"))
25367      res.setInteraction(parseCodeableConcept(getJObject(json, "interaction")));
25368    if (json.has("organism"))
25369      res.setOrganism(parseCodeableConcept(getJObject(json, "organism")));
25370    if (json.has("organismType"))
25371      res.setOrganismType(parseCodeableConcept(getJObject(json, "organismType")));
25372    Type amount = parseType("amount", json);
25373    if (amount != null)
25374      res.setAmount(amount);
25375    if (json.has("amountType"))
25376      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
25377    if (json.has("source")) {
25378      JsonArray array = json.getAsJsonArray("source");
25379      for (int i = 0; i < array.size(); i++) {
25380        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25381      }
25382    };
25383  }
25384
25385  protected SubstanceSourceMaterial parseSubstanceSourceMaterial(JsonObject json) throws IOException, FHIRFormatError {
25386    SubstanceSourceMaterial res = new SubstanceSourceMaterial();
25387    parseSubstanceSourceMaterialProperties(json, res);
25388    return res;
25389  }
25390
25391  protected void parseSubstanceSourceMaterialProperties(JsonObject json, SubstanceSourceMaterial res) throws IOException, FHIRFormatError {
25392    parseDomainResourceProperties(json, res);
25393    if (json.has("sourceMaterialClass"))
25394      res.setSourceMaterialClass(parseCodeableConcept(getJObject(json, "sourceMaterialClass")));
25395    if (json.has("sourceMaterialType"))
25396      res.setSourceMaterialType(parseCodeableConcept(getJObject(json, "sourceMaterialType")));
25397    if (json.has("sourceMaterialState"))
25398      res.setSourceMaterialState(parseCodeableConcept(getJObject(json, "sourceMaterialState")));
25399    if (json.has("organismId"))
25400      res.setOrganismId(parseIdentifier(getJObject(json, "organismId")));
25401    if (json.has("organismName"))
25402      res.setOrganismNameElement(parseString(json.get("organismName").getAsString()));
25403    if (json.has("_organismName"))
25404      parseElementProperties(getJObject(json, "_organismName"), res.getOrganismNameElement());
25405    if (json.has("parentSubstanceId")) {
25406      JsonArray array = json.getAsJsonArray("parentSubstanceId");
25407      for (int i = 0; i < array.size(); i++) {
25408        res.getParentSubstanceId().add(parseIdentifier(array.get(i).getAsJsonObject()));
25409      }
25410    };
25411    if (json.has("parentSubstanceName")) {
25412      JsonArray array = json.getAsJsonArray("parentSubstanceName");
25413      for (int i = 0; i < array.size(); i++) {
25414        if (array.get(i).isJsonNull()) {
25415          res.getParentSubstanceName().add(new StringType());
25416        } else {
25417          res.getParentSubstanceName().add(parseString(array.get(i).getAsString()));
25418        }
25419      }
25420    };
25421    if (json.has("_parentSubstanceName")) {
25422      JsonArray array = json.getAsJsonArray("_parentSubstanceName");
25423      for (int i = 0; i < array.size(); i++) {
25424        if (i == res.getParentSubstanceName().size())
25425          res.getParentSubstanceName().add(parseString(null));
25426        if (array.get(i) instanceof JsonObject) 
25427          parseElementProperties(array.get(i).getAsJsonObject(), res.getParentSubstanceName().get(i));
25428      }
25429    };
25430    if (json.has("countryOfOrigin")) {
25431      JsonArray array = json.getAsJsonArray("countryOfOrigin");
25432      for (int i = 0; i < array.size(); i++) {
25433        res.getCountryOfOrigin().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25434      }
25435    };
25436    if (json.has("geographicalLocation")) {
25437      JsonArray array = json.getAsJsonArray("geographicalLocation");
25438      for (int i = 0; i < array.size(); i++) {
25439        if (array.get(i).isJsonNull()) {
25440          res.getGeographicalLocation().add(new StringType());
25441        } else {
25442          res.getGeographicalLocation().add(parseString(array.get(i).getAsString()));
25443        }
25444      }
25445    };
25446    if (json.has("_geographicalLocation")) {
25447      JsonArray array = json.getAsJsonArray("_geographicalLocation");
25448      for (int i = 0; i < array.size(); i++) {
25449        if (i == res.getGeographicalLocation().size())
25450          res.getGeographicalLocation().add(parseString(null));
25451        if (array.get(i) instanceof JsonObject) 
25452          parseElementProperties(array.get(i).getAsJsonObject(), res.getGeographicalLocation().get(i));
25453      }
25454    };
25455    if (json.has("developmentStage"))
25456      res.setDevelopmentStage(parseCodeableConcept(getJObject(json, "developmentStage")));
25457    if (json.has("fractionDescription")) {
25458      JsonArray array = json.getAsJsonArray("fractionDescription");
25459      for (int i = 0; i < array.size(); i++) {
25460        res.getFractionDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(array.get(i).getAsJsonObject(), res));
25461      }
25462    };
25463    if (json.has("organism"))
25464      res.setOrganism(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(getJObject(json, "organism"), res));
25465    if (json.has("partDescription")) {
25466      JsonArray array = json.getAsJsonArray("partDescription");
25467      for (int i = 0; i < array.size(); i++) {
25468        res.getPartDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(array.get(i).getAsJsonObject(), res));
25469      }
25470    };
25471  }
25472
25473  protected SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25474    SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent();
25475    parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(json, owner, res);
25476    return res;
25477  }
25478
25479  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res) throws IOException, FHIRFormatError {
25480    parseBackboneElementProperties(json, res);
25481    if (json.has("fraction"))
25482      res.setFractionElement(parseString(json.get("fraction").getAsString()));
25483    if (json.has("_fraction"))
25484      parseElementProperties(getJObject(json, "_fraction"), res.getFractionElement());
25485    if (json.has("materialType"))
25486      res.setMaterialType(parseCodeableConcept(getJObject(json, "materialType")));
25487  }
25488
25489  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25490    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent();
25491    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(json, owner, res);
25492    return res;
25493  }
25494
25495  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res) throws IOException, FHIRFormatError {
25496    parseBackboneElementProperties(json, res);
25497    if (json.has("family"))
25498      res.setFamily(parseCodeableConcept(getJObject(json, "family")));
25499    if (json.has("genus"))
25500      res.setGenus(parseCodeableConcept(getJObject(json, "genus")));
25501    if (json.has("species"))
25502      res.setSpecies(parseCodeableConcept(getJObject(json, "species")));
25503    if (json.has("intraspecificType"))
25504      res.setIntraspecificType(parseCodeableConcept(getJObject(json, "intraspecificType")));
25505    if (json.has("intraspecificDescription"))
25506      res.setIntraspecificDescriptionElement(parseString(json.get("intraspecificDescription").getAsString()));
25507    if (json.has("_intraspecificDescription"))
25508      parseElementProperties(getJObject(json, "_intraspecificDescription"), res.getIntraspecificDescriptionElement());
25509    if (json.has("author")) {
25510      JsonArray array = json.getAsJsonArray("author");
25511      for (int i = 0; i < array.size(); i++) {
25512        res.getAuthor().add(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(array.get(i).getAsJsonObject(), owner));
25513      }
25514    };
25515    if (json.has("hybrid"))
25516      res.setHybrid(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(getJObject(json, "hybrid"), owner));
25517    if (json.has("organismGeneral"))
25518      res.setOrganismGeneral(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(getJObject(json, "organismGeneral"), owner));
25519  }
25520
25521  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25522    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent();
25523    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(json, owner, res);
25524    return res;
25525  }
25526
25527  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res) throws IOException, FHIRFormatError {
25528    parseBackboneElementProperties(json, res);
25529    if (json.has("authorType"))
25530      res.setAuthorType(parseCodeableConcept(getJObject(json, "authorType")));
25531    if (json.has("authorDescription"))
25532      res.setAuthorDescriptionElement(parseString(json.get("authorDescription").getAsString()));
25533    if (json.has("_authorDescription"))
25534      parseElementProperties(getJObject(json, "_authorDescription"), res.getAuthorDescriptionElement());
25535  }
25536
25537  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25538    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent();
25539    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(json, owner, res);
25540    return res;
25541  }
25542
25543  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res) throws IOException, FHIRFormatError {
25544    parseBackboneElementProperties(json, res);
25545    if (json.has("maternalOrganismId"))
25546      res.setMaternalOrganismIdElement(parseString(json.get("maternalOrganismId").getAsString()));
25547    if (json.has("_maternalOrganismId"))
25548      parseElementProperties(getJObject(json, "_maternalOrganismId"), res.getMaternalOrganismIdElement());
25549    if (json.has("maternalOrganismName"))
25550      res.setMaternalOrganismNameElement(parseString(json.get("maternalOrganismName").getAsString()));
25551    if (json.has("_maternalOrganismName"))
25552      parseElementProperties(getJObject(json, "_maternalOrganismName"), res.getMaternalOrganismNameElement());
25553    if (json.has("paternalOrganismId"))
25554      res.setPaternalOrganismIdElement(parseString(json.get("paternalOrganismId").getAsString()));
25555    if (json.has("_paternalOrganismId"))
25556      parseElementProperties(getJObject(json, "_paternalOrganismId"), res.getPaternalOrganismIdElement());
25557    if (json.has("paternalOrganismName"))
25558      res.setPaternalOrganismNameElement(parseString(json.get("paternalOrganismName").getAsString()));
25559    if (json.has("_paternalOrganismName"))
25560      parseElementProperties(getJObject(json, "_paternalOrganismName"), res.getPaternalOrganismNameElement());
25561    if (json.has("hybridType"))
25562      res.setHybridType(parseCodeableConcept(getJObject(json, "hybridType")));
25563  }
25564
25565  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25566    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent();
25567    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(json, owner, res);
25568    return res;
25569  }
25570
25571  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res) throws IOException, FHIRFormatError {
25572    parseBackboneElementProperties(json, res);
25573    if (json.has("kingdom"))
25574      res.setKingdom(parseCodeableConcept(getJObject(json, "kingdom")));
25575    if (json.has("phylum"))
25576      res.setPhylum(parseCodeableConcept(getJObject(json, "phylum")));
25577    if (json.has("class"))
25578      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
25579    if (json.has("order"))
25580      res.setOrder(parseCodeableConcept(getJObject(json, "order")));
25581  }
25582
25583  protected SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
25584    SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent();
25585    parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(json, owner, res);
25586    return res;
25587  }
25588
25589  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res) throws IOException, FHIRFormatError {
25590    parseBackboneElementProperties(json, res);
25591    if (json.has("part"))
25592      res.setPart(parseCodeableConcept(getJObject(json, "part")));
25593    if (json.has("partLocation"))
25594      res.setPartLocation(parseCodeableConcept(getJObject(json, "partLocation")));
25595  }
25596
25597  protected SubstanceSpecification parseSubstanceSpecification(JsonObject json) throws IOException, FHIRFormatError {
25598    SubstanceSpecification res = new SubstanceSpecification();
25599    parseSubstanceSpecificationProperties(json, res);
25600    return res;
25601  }
25602
25603  protected void parseSubstanceSpecificationProperties(JsonObject json, SubstanceSpecification res) throws IOException, FHIRFormatError {
25604    parseDomainResourceProperties(json, res);
25605    if (json.has("identifier"))
25606      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
25607    if (json.has("type"))
25608      res.setType(parseCodeableConcept(getJObject(json, "type")));
25609    if (json.has("status"))
25610      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
25611    if (json.has("domain"))
25612      res.setDomain(parseCodeableConcept(getJObject(json, "domain")));
25613    if (json.has("description"))
25614      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25615    if (json.has("_description"))
25616      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
25617    if (json.has("source")) {
25618      JsonArray array = json.getAsJsonArray("source");
25619      for (int i = 0; i < array.size(); i++) {
25620        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25621      }
25622    };
25623    if (json.has("comment"))
25624      res.setCommentElement(parseString(json.get("comment").getAsString()));
25625    if (json.has("_comment"))
25626      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
25627    if (json.has("moiety")) {
25628      JsonArray array = json.getAsJsonArray("moiety");
25629      for (int i = 0; i < array.size(); i++) {
25630        res.getMoiety().add(parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(array.get(i).getAsJsonObject(), res));
25631      }
25632    };
25633    if (json.has("property")) {
25634      JsonArray array = json.getAsJsonArray("property");
25635      for (int i = 0; i < array.size(); i++) {
25636        res.getProperty().add(parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(array.get(i).getAsJsonObject(), res));
25637      }
25638    };
25639    if (json.has("referenceInformation"))
25640      res.setReferenceInformation(parseReference(getJObject(json, "referenceInformation")));
25641    if (json.has("structure"))
25642      res.setStructure(parseSubstanceSpecificationSubstanceSpecificationStructureComponent(getJObject(json, "structure"), res));
25643    if (json.has("code")) {
25644      JsonArray array = json.getAsJsonArray("code");
25645      for (int i = 0; i < array.size(); i++) {
25646        res.getCode().add(parseSubstanceSpecificationSubstanceSpecificationCodeComponent(array.get(i).getAsJsonObject(), res));
25647      }
25648    };
25649    if (json.has("name")) {
25650      JsonArray array = json.getAsJsonArray("name");
25651      for (int i = 0; i < array.size(); i++) {
25652        res.getName().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), res));
25653      }
25654    };
25655    if (json.has("molecularWeight")) {
25656      JsonArray array = json.getAsJsonArray("molecularWeight");
25657      for (int i = 0; i < array.size(); i++) {
25658        res.getMolecularWeight().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(array.get(i).getAsJsonObject(), res));
25659      }
25660    };
25661    if (json.has("relationship")) {
25662      JsonArray array = json.getAsJsonArray("relationship");
25663      for (int i = 0; i < array.size(); i++) {
25664        res.getRelationship().add(parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(array.get(i).getAsJsonObject(), res));
25665      }
25666    };
25667    if (json.has("nucleicAcid"))
25668      res.setNucleicAcid(parseReference(getJObject(json, "nucleicAcid")));
25669    if (json.has("polymer"))
25670      res.setPolymer(parseReference(getJObject(json, "polymer")));
25671    if (json.has("protein"))
25672      res.setProtein(parseReference(getJObject(json, "protein")));
25673    if (json.has("sourceMaterial"))
25674      res.setSourceMaterial(parseReference(getJObject(json, "sourceMaterial")));
25675  }
25676
25677  protected SubstanceSpecification.SubstanceSpecificationMoietyComponent parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25678    SubstanceSpecification.SubstanceSpecificationMoietyComponent res = new SubstanceSpecification.SubstanceSpecificationMoietyComponent();
25679    parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(json, owner, res);
25680    return res;
25681  }
25682
25683  protected void parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationMoietyComponent res) throws IOException, FHIRFormatError {
25684    parseBackboneElementProperties(json, res);
25685    if (json.has("role"))
25686      res.setRole(parseCodeableConcept(getJObject(json, "role")));
25687    if (json.has("identifier"))
25688      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
25689    if (json.has("name"))
25690      res.setNameElement(parseString(json.get("name").getAsString()));
25691    if (json.has("_name"))
25692      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25693    if (json.has("stereochemistry"))
25694      res.setStereochemistry(parseCodeableConcept(getJObject(json, "stereochemistry")));
25695    if (json.has("opticalActivity"))
25696      res.setOpticalActivity(parseCodeableConcept(getJObject(json, "opticalActivity")));
25697    if (json.has("molecularFormula"))
25698      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
25699    if (json.has("_molecularFormula"))
25700      parseElementProperties(getJObject(json, "_molecularFormula"), res.getMolecularFormulaElement());
25701    Type amount = parseType("amount", json);
25702    if (amount != null)
25703      res.setAmount(amount);
25704  }
25705
25706  protected SubstanceSpecification.SubstanceSpecificationPropertyComponent parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25707    SubstanceSpecification.SubstanceSpecificationPropertyComponent res = new SubstanceSpecification.SubstanceSpecificationPropertyComponent();
25708    parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(json, owner, res);
25709    return res;
25710  }
25711
25712  protected void parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationPropertyComponent res) throws IOException, FHIRFormatError {
25713    parseBackboneElementProperties(json, res);
25714    if (json.has("category"))
25715      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
25716    if (json.has("code"))
25717      res.setCode(parseCodeableConcept(getJObject(json, "code")));
25718    if (json.has("parameters"))
25719      res.setParametersElement(parseString(json.get("parameters").getAsString()));
25720    if (json.has("_parameters"))
25721      parseElementProperties(getJObject(json, "_parameters"), res.getParametersElement());
25722    Type definingSubstance = parseType("definingSubstance", json);
25723    if (definingSubstance != null)
25724      res.setDefiningSubstance(definingSubstance);
25725    Type amount = parseType("amount", json);
25726    if (amount != null)
25727      res.setAmount(amount);
25728  }
25729
25730  protected SubstanceSpecification.SubstanceSpecificationStructureComponent parseSubstanceSpecificationSubstanceSpecificationStructureComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25731    SubstanceSpecification.SubstanceSpecificationStructureComponent res = new SubstanceSpecification.SubstanceSpecificationStructureComponent();
25732    parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(json, owner, res);
25733    return res;
25734  }
25735
25736  protected void parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureComponent res) throws IOException, FHIRFormatError {
25737    parseBackboneElementProperties(json, res);
25738    if (json.has("stereochemistry"))
25739      res.setStereochemistry(parseCodeableConcept(getJObject(json, "stereochemistry")));
25740    if (json.has("opticalActivity"))
25741      res.setOpticalActivity(parseCodeableConcept(getJObject(json, "opticalActivity")));
25742    if (json.has("molecularFormula"))
25743      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
25744    if (json.has("_molecularFormula"))
25745      parseElementProperties(getJObject(json, "_molecularFormula"), res.getMolecularFormulaElement());
25746    if (json.has("molecularFormulaByMoiety"))
25747      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
25748    if (json.has("_molecularFormulaByMoiety"))
25749      parseElementProperties(getJObject(json, "_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
25750    if (json.has("isotope")) {
25751      JsonArray array = json.getAsJsonArray("isotope");
25752      for (int i = 0; i < array.size(); i++) {
25753        res.getIsotope().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(array.get(i).getAsJsonObject(), owner));
25754      }
25755    };
25756    if (json.has("molecularWeight"))
25757      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(getJObject(json, "molecularWeight"), owner));
25758    if (json.has("source")) {
25759      JsonArray array = json.getAsJsonArray("source");
25760      for (int i = 0; i < array.size(); i++) {
25761        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25762      }
25763    };
25764    if (json.has("representation")) {
25765      JsonArray array = json.getAsJsonArray("representation");
25766      for (int i = 0; i < array.size(); i++) {
25767        res.getRepresentation().add(parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(array.get(i).getAsJsonObject(), owner));
25768      }
25769    };
25770  }
25771
25772  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25773    SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent();
25774    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(json, owner, res);
25775    return res;
25776  }
25777
25778  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res) throws IOException, FHIRFormatError {
25779    parseBackboneElementProperties(json, res);
25780    if (json.has("identifier"))
25781      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
25782    if (json.has("name"))
25783      res.setName(parseCodeableConcept(getJObject(json, "name")));
25784    if (json.has("substitution"))
25785      res.setSubstitution(parseCodeableConcept(getJObject(json, "substitution")));
25786    if (json.has("halfLife"))
25787      res.setHalfLife(parseQuantity(getJObject(json, "halfLife")));
25788    if (json.has("molecularWeight"))
25789      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(getJObject(json, "molecularWeight"), owner));
25790  }
25791
25792  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25793    SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent();
25794    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(json, owner, res);
25795    return res;
25796  }
25797
25798  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res) throws IOException, FHIRFormatError {
25799    parseBackboneElementProperties(json, res);
25800    if (json.has("method"))
25801      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
25802    if (json.has("type"))
25803      res.setType(parseCodeableConcept(getJObject(json, "type")));
25804    if (json.has("amount"))
25805      res.setAmount(parseQuantity(getJObject(json, "amount")));
25806  }
25807
25808  protected SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25809    SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res = new SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent();
25810    parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentProperties(json, owner, res);
25811    return res;
25812  }
25813
25814  protected void parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res) throws IOException, FHIRFormatError {
25815    parseBackboneElementProperties(json, res);
25816    if (json.has("type"))
25817      res.setType(parseCodeableConcept(getJObject(json, "type")));
25818    if (json.has("representation"))
25819      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
25820    if (json.has("_representation"))
25821      parseElementProperties(getJObject(json, "_representation"), res.getRepresentationElement());
25822    if (json.has("attachment"))
25823      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
25824  }
25825
25826  protected SubstanceSpecification.SubstanceSpecificationCodeComponent parseSubstanceSpecificationSubstanceSpecificationCodeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25827    SubstanceSpecification.SubstanceSpecificationCodeComponent res = new SubstanceSpecification.SubstanceSpecificationCodeComponent();
25828    parseSubstanceSpecificationSubstanceSpecificationCodeComponentProperties(json, owner, res);
25829    return res;
25830  }
25831
25832  protected void parseSubstanceSpecificationSubstanceSpecificationCodeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationCodeComponent res) throws IOException, FHIRFormatError {
25833    parseBackboneElementProperties(json, res);
25834    if (json.has("code"))
25835      res.setCode(parseCodeableConcept(getJObject(json, "code")));
25836    if (json.has("status"))
25837      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
25838    if (json.has("statusDate"))
25839      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
25840    if (json.has("_statusDate"))
25841      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
25842    if (json.has("comment"))
25843      res.setCommentElement(parseString(json.get("comment").getAsString()));
25844    if (json.has("_comment"))
25845      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
25846    if (json.has("source")) {
25847      JsonArray array = json.getAsJsonArray("source");
25848      for (int i = 0; i < array.size(); i++) {
25849        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25850      }
25851    };
25852  }
25853
25854  protected SubstanceSpecification.SubstanceSpecificationNameComponent parseSubstanceSpecificationSubstanceSpecificationNameComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25855    SubstanceSpecification.SubstanceSpecificationNameComponent res = new SubstanceSpecification.SubstanceSpecificationNameComponent();
25856    parseSubstanceSpecificationSubstanceSpecificationNameComponentProperties(json, owner, res);
25857    return res;
25858  }
25859
25860  protected void parseSubstanceSpecificationSubstanceSpecificationNameComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameComponent res) throws IOException, FHIRFormatError {
25861    parseBackboneElementProperties(json, res);
25862    if (json.has("name"))
25863      res.setNameElement(parseString(json.get("name").getAsString()));
25864    if (json.has("_name"))
25865      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
25866    if (json.has("type"))
25867      res.setType(parseCodeableConcept(getJObject(json, "type")));
25868    if (json.has("status"))
25869      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
25870    if (json.has("preferred"))
25871      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
25872    if (json.has("_preferred"))
25873      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
25874    if (json.has("language")) {
25875      JsonArray array = json.getAsJsonArray("language");
25876      for (int i = 0; i < array.size(); i++) {
25877        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25878      }
25879    };
25880    if (json.has("domain")) {
25881      JsonArray array = json.getAsJsonArray("domain");
25882      for (int i = 0; i < array.size(); i++) {
25883        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25884      }
25885    };
25886    if (json.has("jurisdiction")) {
25887      JsonArray array = json.getAsJsonArray("jurisdiction");
25888      for (int i = 0; i < array.size(); i++) {
25889        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25890      }
25891    };
25892    if (json.has("synonym")) {
25893      JsonArray array = json.getAsJsonArray("synonym");
25894      for (int i = 0; i < array.size(); i++) {
25895        res.getSynonym().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), owner));
25896      }
25897    };
25898    if (json.has("translation")) {
25899      JsonArray array = json.getAsJsonArray("translation");
25900      for (int i = 0; i < array.size(); i++) {
25901        res.getTranslation().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), owner));
25902      }
25903    };
25904    if (json.has("official")) {
25905      JsonArray array = json.getAsJsonArray("official");
25906      for (int i = 0; i < array.size(); i++) {
25907        res.getOfficial().add(parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(array.get(i).getAsJsonObject(), owner));
25908      }
25909    };
25910    if (json.has("source")) {
25911      JsonArray array = json.getAsJsonArray("source");
25912      for (int i = 0; i < array.size(); i++) {
25913        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25914      }
25915    };
25916  }
25917
25918  protected SubstanceSpecification.SubstanceSpecificationNameOfficialComponent parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25919    SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res = new SubstanceSpecification.SubstanceSpecificationNameOfficialComponent();
25920    parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentProperties(json, owner, res);
25921    return res;
25922  }
25923
25924  protected void parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res) throws IOException, FHIRFormatError {
25925    parseBackboneElementProperties(json, res);
25926    if (json.has("authority"))
25927      res.setAuthority(parseCodeableConcept(getJObject(json, "authority")));
25928    if (json.has("status"))
25929      res.setStatus(parseCodeableConcept(getJObject(json, "status")));
25930    if (json.has("date"))
25931      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25932    if (json.has("_date"))
25933      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
25934  }
25935
25936  protected SubstanceSpecification.SubstanceSpecificationRelationshipComponent parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25937    SubstanceSpecification.SubstanceSpecificationRelationshipComponent res = new SubstanceSpecification.SubstanceSpecificationRelationshipComponent();
25938    parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentProperties(json, owner, res);
25939    return res;
25940  }
25941
25942  protected void parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationRelationshipComponent res) throws IOException, FHIRFormatError {
25943    parseBackboneElementProperties(json, res);
25944    Type substance = parseType("substance", json);
25945    if (substance != null)
25946      res.setSubstance(substance);
25947    if (json.has("relationship"))
25948      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
25949    if (json.has("isDefining"))
25950      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
25951    if (json.has("_isDefining"))
25952      parseElementProperties(getJObject(json, "_isDefining"), res.getIsDefiningElement());
25953    Type amount = parseType("amount", json);
25954    if (amount != null)
25955      res.setAmount(amount);
25956    if (json.has("amountRatioLowLimit"))
25957      res.setAmountRatioLowLimit(parseRatio(getJObject(json, "amountRatioLowLimit")));
25958    if (json.has("amountType"))
25959      res.setAmountType(parseCodeableConcept(getJObject(json, "amountType")));
25960    if (json.has("source")) {
25961      JsonArray array = json.getAsJsonArray("source");
25962      for (int i = 0; i < array.size(); i++) {
25963        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25964      }
25965    };
25966  }
25967
25968  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
25969    SupplyDelivery res = new SupplyDelivery();
25970    parseSupplyDeliveryProperties(json, res);
25971    return res;
25972  }
25973
25974  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
25975    parseDomainResourceProperties(json, res);
25976    if (json.has("identifier")) {
25977      JsonArray array = json.getAsJsonArray("identifier");
25978      for (int i = 0; i < array.size(); i++) {
25979        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25980      }
25981    };
25982    if (json.has("basedOn")) {
25983      JsonArray array = json.getAsJsonArray("basedOn");
25984      for (int i = 0; i < array.size(); i++) {
25985        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
25986      }
25987    };
25988    if (json.has("partOf")) {
25989      JsonArray array = json.getAsJsonArray("partOf");
25990      for (int i = 0; i < array.size(); i++) {
25991        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
25992      }
25993    };
25994    if (json.has("status"))
25995      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
25996    if (json.has("_status"))
25997      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
25998    if (json.has("patient"))
25999      res.setPatient(parseReference(getJObject(json, "patient")));
26000    if (json.has("type"))
26001      res.setType(parseCodeableConcept(getJObject(json, "type")));
26002    if (json.has("suppliedItem"))
26003      res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(getJObject(json, "suppliedItem"), res));
26004    Type occurrence = parseType("occurrence", json);
26005    if (occurrence != null)
26006      res.setOccurrence(occurrence);
26007    if (json.has("supplier"))
26008      res.setSupplier(parseReference(getJObject(json, "supplier")));
26009    if (json.has("destination"))
26010      res.setDestination(parseReference(getJObject(json, "destination")));
26011    if (json.has("receiver")) {
26012      JsonArray array = json.getAsJsonArray("receiver");
26013      for (int i = 0; i < array.size(); i++) {
26014        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
26015      }
26016    };
26017  }
26018
26019  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
26020    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
26021    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
26022    return res;
26023  }
26024
26025  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
26026    parseBackboneElementProperties(json, res);
26027    if (json.has("quantity"))
26028      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
26029    Type item = parseType("item", json);
26030    if (item != null)
26031      res.setItem(item);
26032  }
26033
26034  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
26035    SupplyRequest res = new SupplyRequest();
26036    parseSupplyRequestProperties(json, res);
26037    return res;
26038  }
26039
26040  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
26041    parseDomainResourceProperties(json, res);
26042    if (json.has("identifier")) {
26043      JsonArray array = json.getAsJsonArray("identifier");
26044      for (int i = 0; i < array.size(); i++) {
26045        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26046      }
26047    };
26048    if (json.has("status"))
26049      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
26050    if (json.has("_status"))
26051      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26052    if (json.has("category"))
26053      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
26054    if (json.has("priority"))
26055      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
26056    if (json.has("_priority"))
26057      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
26058    Type item = parseType("item", json);
26059    if (item != null)
26060      res.setItem(item);
26061    if (json.has("quantity"))
26062      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
26063    if (json.has("parameter")) {
26064      JsonArray array = json.getAsJsonArray("parameter");
26065      for (int i = 0; i < array.size(); i++) {
26066        res.getParameter().add(parseSupplyRequestSupplyRequestParameterComponent(array.get(i).getAsJsonObject(), res));
26067      }
26068    };
26069    Type occurrence = parseType("occurrence", json);
26070    if (occurrence != null)
26071      res.setOccurrence(occurrence);
26072    if (json.has("authoredOn"))
26073      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
26074    if (json.has("_authoredOn"))
26075      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
26076    if (json.has("requester"))
26077      res.setRequester(parseReference(getJObject(json, "requester")));
26078    if (json.has("supplier")) {
26079      JsonArray array = json.getAsJsonArray("supplier");
26080      for (int i = 0; i < array.size(); i++) {
26081        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
26082      }
26083    };
26084    if (json.has("reasonCode")) {
26085      JsonArray array = json.getAsJsonArray("reasonCode");
26086      for (int i = 0; i < array.size(); i++) {
26087        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26088      }
26089    };
26090    if (json.has("reasonReference")) {
26091      JsonArray array = json.getAsJsonArray("reasonReference");
26092      for (int i = 0; i < array.size(); i++) {
26093        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
26094      }
26095    };
26096    if (json.has("deliverFrom"))
26097      res.setDeliverFrom(parseReference(getJObject(json, "deliverFrom")));
26098    if (json.has("deliverTo"))
26099      res.setDeliverTo(parseReference(getJObject(json, "deliverTo")));
26100  }
26101
26102  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestSupplyRequestParameterComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
26103    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
26104    parseSupplyRequestSupplyRequestParameterComponentProperties(json, owner, res);
26105    return res;
26106  }
26107
26108  protected void parseSupplyRequestSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
26109    parseBackboneElementProperties(json, res);
26110    if (json.has("code"))
26111      res.setCode(parseCodeableConcept(getJObject(json, "code")));
26112    Type value = parseType("value", json);
26113    if (value != null)
26114      res.setValue(value);
26115  }
26116
26117  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
26118    Task res = new Task();
26119    parseTaskProperties(json, res);
26120    return res;
26121  }
26122
26123  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
26124    parseDomainResourceProperties(json, res);
26125    if (json.has("identifier")) {
26126      JsonArray array = json.getAsJsonArray("identifier");
26127      for (int i = 0; i < array.size(); i++) {
26128        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26129      }
26130    };
26131    if (json.has("instantiatesCanonical"))
26132      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
26133    if (json.has("_instantiatesCanonical"))
26134      parseElementProperties(getJObject(json, "_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
26135    if (json.has("instantiatesUri"))
26136      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
26137    if (json.has("_instantiatesUri"))
26138      parseElementProperties(getJObject(json, "_instantiatesUri"), res.getInstantiatesUriElement());
26139    if (json.has("basedOn")) {
26140      JsonArray array = json.getAsJsonArray("basedOn");
26141      for (int i = 0; i < array.size(); i++) {
26142        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
26143      }
26144    };
26145    if (json.has("groupIdentifier"))
26146      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
26147    if (json.has("partOf")) {
26148      JsonArray array = json.getAsJsonArray("partOf");
26149      for (int i = 0; i < array.size(); i++) {
26150        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
26151      }
26152    };
26153    if (json.has("status"))
26154      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
26155    if (json.has("_status"))
26156      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26157    if (json.has("statusReason"))
26158      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
26159    if (json.has("businessStatus"))
26160      res.setBusinessStatus(parseCodeableConcept(getJObject(json, "businessStatus")));
26161    if (json.has("intent"))
26162      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
26163    if (json.has("_intent"))
26164      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
26165    if (json.has("priority"))
26166      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
26167    if (json.has("_priority"))
26168      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
26169    if (json.has("code"))
26170      res.setCode(parseCodeableConcept(getJObject(json, "code")));
26171    if (json.has("description"))
26172      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26173    if (json.has("_description"))
26174      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26175    if (json.has("focus"))
26176      res.setFocus(parseReference(getJObject(json, "focus")));
26177    if (json.has("for"))
26178      res.setFor(parseReference(getJObject(json, "for")));
26179    if (json.has("encounter"))
26180      res.setEncounter(parseReference(getJObject(json, "encounter")));
26181    if (json.has("executionPeriod"))
26182      res.setExecutionPeriod(parsePeriod(getJObject(json, "executionPeriod")));
26183    if (json.has("authoredOn"))
26184      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
26185    if (json.has("_authoredOn"))
26186      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
26187    if (json.has("lastModified"))
26188      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
26189    if (json.has("_lastModified"))
26190      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
26191    if (json.has("requester"))
26192      res.setRequester(parseReference(getJObject(json, "requester")));
26193    if (json.has("performerType")) {
26194      JsonArray array = json.getAsJsonArray("performerType");
26195      for (int i = 0; i < array.size(); i++) {
26196        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26197      }
26198    };
26199    if (json.has("owner"))
26200      res.setOwner(parseReference(getJObject(json, "owner")));
26201    if (json.has("location"))
26202      res.setLocation(parseReference(getJObject(json, "location")));
26203    if (json.has("reasonCode"))
26204      res.setReasonCode(parseCodeableConcept(getJObject(json, "reasonCode")));
26205    if (json.has("reasonReference"))
26206      res.setReasonReference(parseReference(getJObject(json, "reasonReference")));
26207    if (json.has("insurance")) {
26208      JsonArray array = json.getAsJsonArray("insurance");
26209      for (int i = 0; i < array.size(); i++) {
26210        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
26211      }
26212    };
26213    if (json.has("note")) {
26214      JsonArray array = json.getAsJsonArray("note");
26215      for (int i = 0; i < array.size(); i++) {
26216        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26217      }
26218    };
26219    if (json.has("relevantHistory")) {
26220      JsonArray array = json.getAsJsonArray("relevantHistory");
26221      for (int i = 0; i < array.size(); i++) {
26222        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
26223      }
26224    };
26225    if (json.has("restriction"))
26226      res.setRestriction(parseTaskTaskRestrictionComponent(getJObject(json, "restriction"), res));
26227    if (json.has("input")) {
26228      JsonArray array = json.getAsJsonArray("input");
26229      for (int i = 0; i < array.size(); i++) {
26230        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
26231      }
26232    };
26233    if (json.has("output")) {
26234      JsonArray array = json.getAsJsonArray("output");
26235      for (int i = 0; i < array.size(); i++) {
26236        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
26237      }
26238    };
26239  }
26240
26241  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
26242    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
26243    parseTaskTaskRestrictionComponentProperties(json, owner, res);
26244    return res;
26245  }
26246
26247  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
26248    parseBackboneElementProperties(json, res);
26249    if (json.has("repetitions"))
26250      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
26251    if (json.has("_repetitions"))
26252      parseElementProperties(getJObject(json, "_repetitions"), res.getRepetitionsElement());
26253    if (json.has("period"))
26254      res.setPeriod(parsePeriod(getJObject(json, "period")));
26255    if (json.has("recipient")) {
26256      JsonArray array = json.getAsJsonArray("recipient");
26257      for (int i = 0; i < array.size(); i++) {
26258        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
26259      }
26260    };
26261  }
26262
26263  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
26264    Task.ParameterComponent res = new Task.ParameterComponent();
26265    parseTaskParameterComponentProperties(json, owner, res);
26266    return res;
26267  }
26268
26269  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res) throws IOException, FHIRFormatError {
26270    parseBackboneElementProperties(json, res);
26271    if (json.has("type"))
26272      res.setType(parseCodeableConcept(getJObject(json, "type")));
26273    Type value = parseType("value", json);
26274    if (value != null)
26275      res.setValue(value);
26276  }
26277
26278  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
26279    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
26280    parseTaskTaskOutputComponentProperties(json, owner, res);
26281    return res;
26282  }
26283
26284  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
26285    parseBackboneElementProperties(json, res);
26286    if (json.has("type"))
26287      res.setType(parseCodeableConcept(getJObject(json, "type")));
26288    Type value = parseType("value", json);
26289    if (value != null)
26290      res.setValue(value);
26291  }
26292
26293  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
26294    TerminologyCapabilities res = new TerminologyCapabilities();
26295    parseTerminologyCapabilitiesProperties(json, res);
26296    return res;
26297  }
26298
26299  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res) throws IOException, FHIRFormatError {
26300    parseDomainResourceProperties(json, res);
26301    if (json.has("url"))
26302      res.setUrlElement(parseUri(json.get("url").getAsString()));
26303    if (json.has("_url"))
26304      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26305    if (json.has("version"))
26306      res.setVersionElement(parseString(json.get("version").getAsString()));
26307    if (json.has("_version"))
26308      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26309    if (json.has("name"))
26310      res.setNameElement(parseString(json.get("name").getAsString()));
26311    if (json.has("_name"))
26312      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26313    if (json.has("title"))
26314      res.setTitleElement(parseString(json.get("title").getAsString()));
26315    if (json.has("_title"))
26316      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26317    if (json.has("status"))
26318      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26319    if (json.has("_status"))
26320      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26321    if (json.has("experimental"))
26322      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26323    if (json.has("_experimental"))
26324      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
26325    if (json.has("date"))
26326      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26327    if (json.has("_date"))
26328      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
26329    if (json.has("publisher"))
26330      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26331    if (json.has("_publisher"))
26332      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
26333    if (json.has("contact")) {
26334      JsonArray array = json.getAsJsonArray("contact");
26335      for (int i = 0; i < array.size(); i++) {
26336        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26337      }
26338    };
26339    if (json.has("description"))
26340      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26341    if (json.has("_description"))
26342      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26343    if (json.has("useContext")) {
26344      JsonArray array = json.getAsJsonArray("useContext");
26345      for (int i = 0; i < array.size(); i++) {
26346        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26347      }
26348    };
26349    if (json.has("jurisdiction")) {
26350      JsonArray array = json.getAsJsonArray("jurisdiction");
26351      for (int i = 0; i < array.size(); i++) {
26352        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26353      }
26354    };
26355    if (json.has("purpose"))
26356      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26357    if (json.has("_purpose"))
26358      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
26359    if (json.has("copyright"))
26360      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26361    if (json.has("_copyright"))
26362      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
26363    if (json.has("kind"))
26364      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), TerminologyCapabilities.CapabilityStatementKind.NULL, new TerminologyCapabilities.CapabilityStatementKindEnumFactory()));
26365    if (json.has("_kind"))
26366      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
26367    if (json.has("software"))
26368      res.setSoftware(parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(getJObject(json, "software"), res));
26369    if (json.has("implementation"))
26370      res.setImplementation(parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(getJObject(json, "implementation"), res));
26371    if (json.has("lockedDate"))
26372      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
26373    if (json.has("_lockedDate"))
26374      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
26375    if (json.has("codeSystem")) {
26376      JsonArray array = json.getAsJsonArray("codeSystem");
26377      for (int i = 0; i < array.size(); i++) {
26378        res.getCodeSystem().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(array.get(i).getAsJsonObject(), res));
26379      }
26380    };
26381    if (json.has("expansion"))
26382      res.setExpansion(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(getJObject(json, "expansion"), res));
26383    if (json.has("codeSearch"))
26384      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(), TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
26385    if (json.has("_codeSearch"))
26386      parseElementProperties(getJObject(json, "_codeSearch"), res.getCodeSearchElement());
26387    if (json.has("validateCode"))
26388      res.setValidateCode(parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(getJObject(json, "validateCode"), res));
26389    if (json.has("translation"))
26390      res.setTranslation(parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(getJObject(json, "translation"), res));
26391    if (json.has("closure"))
26392      res.setClosure(parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(getJObject(json, "closure"), res));
26393  }
26394
26395  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26396    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
26397    parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(json, owner, res);
26398    return res;
26399  }
26400
26401  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res) throws IOException, FHIRFormatError {
26402    parseBackboneElementProperties(json, res);
26403    if (json.has("name"))
26404      res.setNameElement(parseString(json.get("name").getAsString()));
26405    if (json.has("_name"))
26406      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26407    if (json.has("version"))
26408      res.setVersionElement(parseString(json.get("version").getAsString()));
26409    if (json.has("_version"))
26410      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26411  }
26412
26413  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26414    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
26415    parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(json, owner, res);
26416    return res;
26417  }
26418
26419  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res) throws IOException, FHIRFormatError {
26420    parseBackboneElementProperties(json, res);
26421    if (json.has("description"))
26422      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26423    if (json.has("_description"))
26424      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26425    if (json.has("url"))
26426      res.setUrlElement(parseUrl(json.get("url").getAsString()));
26427    if (json.has("_url"))
26428      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26429  }
26430
26431  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26432    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
26433    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(json, owner, res);
26434    return res;
26435  }
26436
26437  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res) throws IOException, FHIRFormatError {
26438    parseBackboneElementProperties(json, res);
26439    if (json.has("uri"))
26440      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
26441    if (json.has("_uri"))
26442      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
26443    if (json.has("version")) {
26444      JsonArray array = json.getAsJsonArray("version");
26445      for (int i = 0; i < array.size(); i++) {
26446        res.getVersion().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(array.get(i).getAsJsonObject(), owner));
26447      }
26448    };
26449    if (json.has("subsumption"))
26450      res.setSubsumptionElement(parseBoolean(json.get("subsumption").getAsBoolean()));
26451    if (json.has("_subsumption"))
26452      parseElementProperties(getJObject(json, "_subsumption"), res.getSubsumptionElement());
26453  }
26454
26455  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26456    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
26457    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, owner, res);
26458    return res;
26459  }
26460
26461  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res) throws IOException, FHIRFormatError {
26462    parseBackboneElementProperties(json, res);
26463    if (json.has("code"))
26464      res.setCodeElement(parseString(json.get("code").getAsString()));
26465    if (json.has("_code"))
26466      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
26467    if (json.has("isDefault"))
26468      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
26469    if (json.has("_isDefault"))
26470      parseElementProperties(getJObject(json, "_isDefault"), res.getIsDefaultElement());
26471    if (json.has("compositional"))
26472      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
26473    if (json.has("_compositional"))
26474      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
26475    if (json.has("language")) {
26476      JsonArray array = json.getAsJsonArray("language");
26477      for (int i = 0; i < array.size(); i++) {
26478        if (array.get(i).isJsonNull()) {
26479          res.getLanguage().add(new CodeType());
26480        } else {
26481          res.getLanguage().add(parseCode(array.get(i).getAsString()));
26482        }
26483      }
26484    };
26485    if (json.has("_language")) {
26486      JsonArray array = json.getAsJsonArray("_language");
26487      for (int i = 0; i < array.size(); i++) {
26488        if (i == res.getLanguage().size())
26489          res.getLanguage().add(parseCode(null));
26490        if (array.get(i) instanceof JsonObject) 
26491          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
26492      }
26493    };
26494    if (json.has("filter")) {
26495      JsonArray array = json.getAsJsonArray("filter");
26496      for (int i = 0; i < array.size(); i++) {
26497        res.getFilter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(array.get(i).getAsJsonObject(), owner));
26498      }
26499    };
26500    if (json.has("property")) {
26501      JsonArray array = json.getAsJsonArray("property");
26502      for (int i = 0; i < array.size(); i++) {
26503        if (array.get(i).isJsonNull()) {
26504          res.getProperty().add(new CodeType());
26505        } else {
26506          res.getProperty().add(parseCode(array.get(i).getAsString()));
26507        }
26508      }
26509    };
26510    if (json.has("_property")) {
26511      JsonArray array = json.getAsJsonArray("_property");
26512      for (int i = 0; i < array.size(); i++) {
26513        if (i == res.getProperty().size())
26514          res.getProperty().add(parseCode(null));
26515        if (array.get(i) instanceof JsonObject) 
26516          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
26517      }
26518    };
26519  }
26520
26521  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26522    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
26523    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, owner, res);
26524    return res;
26525  }
26526
26527  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res) throws IOException, FHIRFormatError {
26528    parseBackboneElementProperties(json, res);
26529    if (json.has("code"))
26530      res.setCodeElement(parseCode(json.get("code").getAsString()));
26531    if (json.has("_code"))
26532      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
26533    if (json.has("op")) {
26534      JsonArray array = json.getAsJsonArray("op");
26535      for (int i = 0; i < array.size(); i++) {
26536        if (array.get(i).isJsonNull()) {
26537          res.getOp().add(new CodeType());
26538        } else {
26539          res.getOp().add(parseCode(array.get(i).getAsString()));
26540        }
26541      }
26542    };
26543    if (json.has("_op")) {
26544      JsonArray array = json.getAsJsonArray("_op");
26545      for (int i = 0; i < array.size(); i++) {
26546        if (i == res.getOp().size())
26547          res.getOp().add(parseCode(null));
26548        if (array.get(i) instanceof JsonObject) 
26549          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
26550      }
26551    };
26552  }
26553
26554  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26555    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
26556    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(json, owner, res);
26557    return res;
26558  }
26559
26560  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res) throws IOException, FHIRFormatError {
26561    parseBackboneElementProperties(json, res);
26562    if (json.has("hierarchical"))
26563      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
26564    if (json.has("_hierarchical"))
26565      parseElementProperties(getJObject(json, "_hierarchical"), res.getHierarchicalElement());
26566    if (json.has("paging"))
26567      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
26568    if (json.has("_paging"))
26569      parseElementProperties(getJObject(json, "_paging"), res.getPagingElement());
26570    if (json.has("incomplete"))
26571      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
26572    if (json.has("_incomplete"))
26573      parseElementProperties(getJObject(json, "_incomplete"), res.getIncompleteElement());
26574    if (json.has("parameter")) {
26575      JsonArray array = json.getAsJsonArray("parameter");
26576      for (int i = 0; i < array.size(); i++) {
26577        res.getParameter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
26578      }
26579    };
26580    if (json.has("textFilter"))
26581      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
26582    if (json.has("_textFilter"))
26583      parseElementProperties(getJObject(json, "_textFilter"), res.getTextFilterElement());
26584  }
26585
26586  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26587    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
26588    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(json, owner, res);
26589    return res;
26590  }
26591
26592  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res) throws IOException, FHIRFormatError {
26593    parseBackboneElementProperties(json, res);
26594    if (json.has("name"))
26595      res.setNameElement(parseCode(json.get("name").getAsString()));
26596    if (json.has("_name"))
26597      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26598    if (json.has("documentation"))
26599      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
26600    if (json.has("_documentation"))
26601      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
26602  }
26603
26604  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26605    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
26606    parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(json, owner, res);
26607    return res;
26608  }
26609
26610  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res) throws IOException, FHIRFormatError {
26611    parseBackboneElementProperties(json, res);
26612    if (json.has("translations"))
26613      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
26614    if (json.has("_translations"))
26615      parseElementProperties(getJObject(json, "_translations"), res.getTranslationsElement());
26616  }
26617
26618  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26619    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
26620    parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(json, owner, res);
26621    return res;
26622  }
26623
26624  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res) throws IOException, FHIRFormatError {
26625    parseBackboneElementProperties(json, res);
26626    if (json.has("needsMap"))
26627      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
26628    if (json.has("_needsMap"))
26629      parseElementProperties(getJObject(json, "_needsMap"), res.getNeedsMapElement());
26630  }
26631
26632  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
26633    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
26634    parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(json, owner, res);
26635    return res;
26636  }
26637
26638  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res) throws IOException, FHIRFormatError {
26639    parseBackboneElementProperties(json, res);
26640    if (json.has("translation"))
26641      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
26642    if (json.has("_translation"))
26643      parseElementProperties(getJObject(json, "_translation"), res.getTranslationElement());
26644  }
26645
26646  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
26647    TestReport res = new TestReport();
26648    parseTestReportProperties(json, res);
26649    return res;
26650  }
26651
26652  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
26653    parseDomainResourceProperties(json, res);
26654    if (json.has("identifier"))
26655      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
26656    if (json.has("name"))
26657      res.setNameElement(parseString(json.get("name").getAsString()));
26658    if (json.has("_name"))
26659      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26660    if (json.has("status"))
26661      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
26662    if (json.has("_status"))
26663      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26664    if (json.has("testScript"))
26665      res.setTestScript(parseReference(getJObject(json, "testScript")));
26666    if (json.has("result"))
26667      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
26668    if (json.has("_result"))
26669      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
26670    if (json.has("score"))
26671      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
26672    if (json.has("_score"))
26673      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
26674    if (json.has("tester"))
26675      res.setTesterElement(parseString(json.get("tester").getAsString()));
26676    if (json.has("_tester"))
26677      parseElementProperties(getJObject(json, "_tester"), res.getTesterElement());
26678    if (json.has("issued"))
26679      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
26680    if (json.has("_issued"))
26681      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
26682    if (json.has("participant")) {
26683      JsonArray array = json.getAsJsonArray("participant");
26684      for (int i = 0; i < array.size(); i++) {
26685        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
26686      }
26687    };
26688    if (json.has("setup"))
26689      res.setSetup(parseTestReportTestReportSetupComponent(getJObject(json, "setup"), res));
26690    if (json.has("test")) {
26691      JsonArray array = json.getAsJsonArray("test");
26692      for (int i = 0; i < array.size(); i++) {
26693        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
26694      }
26695    };
26696    if (json.has("teardown"))
26697      res.setTeardown(parseTestReportTestReportTeardownComponent(getJObject(json, "teardown"), res));
26698  }
26699
26700  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26701    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
26702    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
26703    return res;
26704  }
26705
26706  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
26707    parseBackboneElementProperties(json, res);
26708    if (json.has("type"))
26709      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
26710    if (json.has("_type"))
26711      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
26712    if (json.has("uri"))
26713      res.setUriElement(parseUri(json.get("uri").getAsString()));
26714    if (json.has("_uri"))
26715      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
26716    if (json.has("display"))
26717      res.setDisplayElement(parseString(json.get("display").getAsString()));
26718    if (json.has("_display"))
26719      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
26720  }
26721
26722  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26723    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
26724    parseTestReportTestReportSetupComponentProperties(json, owner, res);
26725    return res;
26726  }
26727
26728  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
26729    parseBackboneElementProperties(json, res);
26730    if (json.has("action")) {
26731      JsonArray array = json.getAsJsonArray("action");
26732      for (int i = 0; i < array.size(); i++) {
26733        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
26734      }
26735    };
26736  }
26737
26738  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26739    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
26740    parseTestReportSetupActionComponentProperties(json, owner, res);
26741    return res;
26742  }
26743
26744  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
26745    parseBackboneElementProperties(json, res);
26746    if (json.has("operation"))
26747      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
26748    if (json.has("assert"))
26749      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert"), owner));
26750  }
26751
26752  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26753    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
26754    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
26755    return res;
26756  }
26757
26758  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
26759    parseBackboneElementProperties(json, res);
26760    if (json.has("result"))
26761      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
26762    if (json.has("_result"))
26763      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
26764    if (json.has("message"))
26765      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
26766    if (json.has("_message"))
26767      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
26768    if (json.has("detail"))
26769      res.setDetailElement(parseUri(json.get("detail").getAsString()));
26770    if (json.has("_detail"))
26771      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
26772  }
26773
26774  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26775    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
26776    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
26777    return res;
26778  }
26779
26780  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
26781    parseBackboneElementProperties(json, res);
26782    if (json.has("result"))
26783      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
26784    if (json.has("_result"))
26785      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
26786    if (json.has("message"))
26787      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
26788    if (json.has("_message"))
26789      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
26790    if (json.has("detail"))
26791      res.setDetailElement(parseString(json.get("detail").getAsString()));
26792    if (json.has("_detail"))
26793      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
26794  }
26795
26796  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26797    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
26798    parseTestReportTestReportTestComponentProperties(json, owner, res);
26799    return res;
26800  }
26801
26802  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
26803    parseBackboneElementProperties(json, res);
26804    if (json.has("name"))
26805      res.setNameElement(parseString(json.get("name").getAsString()));
26806    if (json.has("_name"))
26807      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26808    if (json.has("description"))
26809      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26810    if (json.has("_description"))
26811      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26812    if (json.has("action")) {
26813      JsonArray array = json.getAsJsonArray("action");
26814      for (int i = 0; i < array.size(); i++) {
26815        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
26816      }
26817    };
26818  }
26819
26820  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26821    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
26822    parseTestReportTestActionComponentProperties(json, owner, res);
26823    return res;
26824  }
26825
26826  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
26827    parseBackboneElementProperties(json, res);
26828    if (json.has("operation"))
26829      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
26830    if (json.has("assert"))
26831      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert"), owner));
26832  }
26833
26834  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26835    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
26836    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
26837    return res;
26838  }
26839
26840  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
26841    parseBackboneElementProperties(json, res);
26842    if (json.has("action")) {
26843      JsonArray array = json.getAsJsonArray("action");
26844      for (int i = 0; i < array.size(); i++) {
26845        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
26846      }
26847    };
26848  }
26849
26850  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26851    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
26852    parseTestReportTeardownActionComponentProperties(json, owner, res);
26853    return res;
26854  }
26855
26856  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
26857    parseBackboneElementProperties(json, res);
26858    if (json.has("operation"))
26859      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
26860  }
26861
26862  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
26863    TestScript res = new TestScript();
26864    parseTestScriptProperties(json, res);
26865    return res;
26866  }
26867
26868  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
26869    parseDomainResourceProperties(json, res);
26870    if (json.has("url"))
26871      res.setUrlElement(parseUri(json.get("url").getAsString()));
26872    if (json.has("_url"))
26873      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
26874    if (json.has("identifier"))
26875      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
26876    if (json.has("version"))
26877      res.setVersionElement(parseString(json.get("version").getAsString()));
26878    if (json.has("_version"))
26879      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
26880    if (json.has("name"))
26881      res.setNameElement(parseString(json.get("name").getAsString()));
26882    if (json.has("_name"))
26883      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
26884    if (json.has("title"))
26885      res.setTitleElement(parseString(json.get("title").getAsString()));
26886    if (json.has("_title"))
26887      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
26888    if (json.has("status"))
26889      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26890    if (json.has("_status"))
26891      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
26892    if (json.has("experimental"))
26893      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26894    if (json.has("_experimental"))
26895      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
26896    if (json.has("date"))
26897      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26898    if (json.has("_date"))
26899      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
26900    if (json.has("publisher"))
26901      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26902    if (json.has("_publisher"))
26903      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
26904    if (json.has("contact")) {
26905      JsonArray array = json.getAsJsonArray("contact");
26906      for (int i = 0; i < array.size(); i++) {
26907        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26908      }
26909    };
26910    if (json.has("description"))
26911      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26912    if (json.has("_description"))
26913      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
26914    if (json.has("useContext")) {
26915      JsonArray array = json.getAsJsonArray("useContext");
26916      for (int i = 0; i < array.size(); i++) {
26917        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26918      }
26919    };
26920    if (json.has("jurisdiction")) {
26921      JsonArray array = json.getAsJsonArray("jurisdiction");
26922      for (int i = 0; i < array.size(); i++) {
26923        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26924      }
26925    };
26926    if (json.has("purpose"))
26927      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26928    if (json.has("_purpose"))
26929      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
26930    if (json.has("copyright"))
26931      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26932    if (json.has("_copyright"))
26933      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
26934    if (json.has("origin")) {
26935      JsonArray array = json.getAsJsonArray("origin");
26936      for (int i = 0; i < array.size(); i++) {
26937        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
26938      }
26939    };
26940    if (json.has("destination")) {
26941      JsonArray array = json.getAsJsonArray("destination");
26942      for (int i = 0; i < array.size(); i++) {
26943        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
26944      }
26945    };
26946    if (json.has("metadata"))
26947      res.setMetadata(parseTestScriptTestScriptMetadataComponent(getJObject(json, "metadata"), res));
26948    if (json.has("fixture")) {
26949      JsonArray array = json.getAsJsonArray("fixture");
26950      for (int i = 0; i < array.size(); i++) {
26951        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
26952      }
26953    };
26954    if (json.has("profile")) {
26955      JsonArray array = json.getAsJsonArray("profile");
26956      for (int i = 0; i < array.size(); i++) {
26957        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
26958      }
26959    };
26960    if (json.has("variable")) {
26961      JsonArray array = json.getAsJsonArray("variable");
26962      for (int i = 0; i < array.size(); i++) {
26963        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
26964      }
26965    };
26966    if (json.has("setup"))
26967      res.setSetup(parseTestScriptTestScriptSetupComponent(getJObject(json, "setup"), res));
26968    if (json.has("test")) {
26969      JsonArray array = json.getAsJsonArray("test");
26970      for (int i = 0; i < array.size(); i++) {
26971        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
26972      }
26973    };
26974    if (json.has("teardown"))
26975      res.setTeardown(parseTestScriptTestScriptTeardownComponent(getJObject(json, "teardown"), res));
26976  }
26977
26978  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26979    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
26980    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
26981    return res;
26982  }
26983
26984  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
26985    parseBackboneElementProperties(json, res);
26986    if (json.has("index"))
26987      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
26988    if (json.has("_index"))
26989      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
26990    if (json.has("profile"))
26991      res.setProfile(parseCoding(getJObject(json, "profile")));
26992  }
26993
26994  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26995    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
26996    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
26997    return res;
26998  }
26999
27000  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
27001    parseBackboneElementProperties(json, res);
27002    if (json.has("index"))
27003      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
27004    if (json.has("_index"))
27005      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
27006    if (json.has("profile"))
27007      res.setProfile(parseCoding(getJObject(json, "profile")));
27008  }
27009
27010  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27011    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
27012    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
27013    return res;
27014  }
27015
27016  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
27017    parseBackboneElementProperties(json, res);
27018    if (json.has("link")) {
27019      JsonArray array = json.getAsJsonArray("link");
27020      for (int i = 0; i < array.size(); i++) {
27021        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
27022      }
27023    };
27024    if (json.has("capability")) {
27025      JsonArray array = json.getAsJsonArray("capability");
27026      for (int i = 0; i < array.size(); i++) {
27027        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
27028      }
27029    };
27030  }
27031
27032  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27033    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
27034    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
27035    return res;
27036  }
27037
27038  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
27039    parseBackboneElementProperties(json, res);
27040    if (json.has("url"))
27041      res.setUrlElement(parseUri(json.get("url").getAsString()));
27042    if (json.has("_url"))
27043      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
27044    if (json.has("description"))
27045      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27046    if (json.has("_description"))
27047      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27048  }
27049
27050  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27051    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
27052    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
27053    return res;
27054  }
27055
27056  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
27057    parseBackboneElementProperties(json, res);
27058    if (json.has("required"))
27059      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
27060    if (json.has("_required"))
27061      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
27062    if (json.has("validated"))
27063      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
27064    if (json.has("_validated"))
27065      parseElementProperties(getJObject(json, "_validated"), res.getValidatedElement());
27066    if (json.has("description"))
27067      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27068    if (json.has("_description"))
27069      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27070    if (json.has("origin")) {
27071      JsonArray array = json.getAsJsonArray("origin");
27072      for (int i = 0; i < array.size(); i++) {
27073        if (array.get(i).isJsonNull()) {
27074          res.getOrigin().add(new IntegerType());
27075        } else {
27076          res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
27077        }
27078      }
27079    };
27080    if (json.has("_origin")) {
27081      JsonArray array = json.getAsJsonArray("_origin");
27082      for (int i = 0; i < array.size(); i++) {
27083        if (i == res.getOrigin().size())
27084          res.getOrigin().add(parseInteger(null));
27085        if (array.get(i) instanceof JsonObject) 
27086          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
27087      }
27088    };
27089    if (json.has("destination"))
27090      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
27091    if (json.has("_destination"))
27092      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
27093    if (json.has("link")) {
27094      JsonArray array = json.getAsJsonArray("link");
27095      for (int i = 0; i < array.size(); i++) {
27096        if (array.get(i).isJsonNull()) {
27097          res.getLink().add(new UriType());
27098        } else {
27099          res.getLink().add(parseUri(array.get(i).getAsString()));
27100        }
27101      }
27102    };
27103    if (json.has("_link")) {
27104      JsonArray array = json.getAsJsonArray("_link");
27105      for (int i = 0; i < array.size(); i++) {
27106        if (i == res.getLink().size())
27107          res.getLink().add(parseUri(null));
27108        if (array.get(i) instanceof JsonObject) 
27109          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
27110      }
27111    };
27112    if (json.has("capabilities"))
27113      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
27114    if (json.has("_capabilities"))
27115      parseElementProperties(getJObject(json, "_capabilities"), res.getCapabilitiesElement());
27116  }
27117
27118  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27119    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
27120    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
27121    return res;
27122  }
27123
27124  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
27125    parseBackboneElementProperties(json, res);
27126    if (json.has("autocreate"))
27127      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
27128    if (json.has("_autocreate"))
27129      parseElementProperties(getJObject(json, "_autocreate"), res.getAutocreateElement());
27130    if (json.has("autodelete"))
27131      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
27132    if (json.has("_autodelete"))
27133      parseElementProperties(getJObject(json, "_autodelete"), res.getAutodeleteElement());
27134    if (json.has("resource"))
27135      res.setResource(parseReference(getJObject(json, "resource")));
27136  }
27137
27138  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27139    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
27140    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
27141    return res;
27142  }
27143
27144  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
27145    parseBackboneElementProperties(json, res);
27146    if (json.has("name"))
27147      res.setNameElement(parseString(json.get("name").getAsString()));
27148    if (json.has("_name"))
27149      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27150    if (json.has("defaultValue"))
27151      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
27152    if (json.has("_defaultValue"))
27153      parseElementProperties(getJObject(json, "_defaultValue"), res.getDefaultValueElement());
27154    if (json.has("description"))
27155      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27156    if (json.has("_description"))
27157      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27158    if (json.has("expression"))
27159      res.setExpressionElement(parseString(json.get("expression").getAsString()));
27160    if (json.has("_expression"))
27161      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
27162    if (json.has("headerField"))
27163      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
27164    if (json.has("_headerField"))
27165      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
27166    if (json.has("hint"))
27167      res.setHintElement(parseString(json.get("hint").getAsString()));
27168    if (json.has("_hint"))
27169      parseElementProperties(getJObject(json, "_hint"), res.getHintElement());
27170    if (json.has("path"))
27171      res.setPathElement(parseString(json.get("path").getAsString()));
27172    if (json.has("_path"))
27173      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
27174    if (json.has("sourceId"))
27175      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27176    if (json.has("_sourceId"))
27177      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
27178  }
27179
27180  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27181    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
27182    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
27183    return res;
27184  }
27185
27186  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
27187    parseBackboneElementProperties(json, res);
27188    if (json.has("action")) {
27189      JsonArray array = json.getAsJsonArray("action");
27190      for (int i = 0; i < array.size(); i++) {
27191        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
27192      }
27193    };
27194  }
27195
27196  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27197    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
27198    parseTestScriptSetupActionComponentProperties(json, owner, res);
27199    return res;
27200  }
27201
27202  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
27203    parseBackboneElementProperties(json, res);
27204    if (json.has("operation"))
27205      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
27206    if (json.has("assert"))
27207      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert"), owner));
27208  }
27209
27210  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27211    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
27212    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
27213    return res;
27214  }
27215
27216  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
27217    parseBackboneElementProperties(json, res);
27218    if (json.has("type"))
27219      res.setType(parseCoding(getJObject(json, "type")));
27220    if (json.has("resource"))
27221      res.setResourceElement(parseCode(json.get("resource").getAsString()));
27222    if (json.has("_resource"))
27223      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
27224    if (json.has("label"))
27225      res.setLabelElement(parseString(json.get("label").getAsString()));
27226    if (json.has("_label"))
27227      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
27228    if (json.has("description"))
27229      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27230    if (json.has("_description"))
27231      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27232    if (json.has("accept"))
27233      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
27234    if (json.has("_accept"))
27235      parseElementProperties(getJObject(json, "_accept"), res.getAcceptElement());
27236    if (json.has("contentType"))
27237      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
27238    if (json.has("_contentType"))
27239      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
27240    if (json.has("destination"))
27241      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
27242    if (json.has("_destination"))
27243      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
27244    if (json.has("encodeRequestUrl"))
27245      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
27246    if (json.has("_encodeRequestUrl"))
27247      parseElementProperties(getJObject(json, "_encodeRequestUrl"), res.getEncodeRequestUrlElement());
27248    if (json.has("method"))
27249      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
27250    if (json.has("_method"))
27251      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
27252    if (json.has("origin"))
27253      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
27254    if (json.has("_origin"))
27255      parseElementProperties(getJObject(json, "_origin"), res.getOriginElement());
27256    if (json.has("params"))
27257      res.setParamsElement(parseString(json.get("params").getAsString()));
27258    if (json.has("_params"))
27259      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
27260    if (json.has("requestHeader")) {
27261      JsonArray array = json.getAsJsonArray("requestHeader");
27262      for (int i = 0; i < array.size(); i++) {
27263        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
27264      }
27265    };
27266    if (json.has("requestId"))
27267      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
27268    if (json.has("_requestId"))
27269      parseElementProperties(getJObject(json, "_requestId"), res.getRequestIdElement());
27270    if (json.has("responseId"))
27271      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
27272    if (json.has("_responseId"))
27273      parseElementProperties(getJObject(json, "_responseId"), res.getResponseIdElement());
27274    if (json.has("sourceId"))
27275      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27276    if (json.has("_sourceId"))
27277      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
27278    if (json.has("targetId"))
27279      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
27280    if (json.has("_targetId"))
27281      parseElementProperties(getJObject(json, "_targetId"), res.getTargetIdElement());
27282    if (json.has("url"))
27283      res.setUrlElement(parseString(json.get("url").getAsString()));
27284    if (json.has("_url"))
27285      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
27286  }
27287
27288  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27289    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
27290    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
27291    return res;
27292  }
27293
27294  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
27295    parseBackboneElementProperties(json, res);
27296    if (json.has("field"))
27297      res.setFieldElement(parseString(json.get("field").getAsString()));
27298    if (json.has("_field"))
27299      parseElementProperties(getJObject(json, "_field"), res.getFieldElement());
27300    if (json.has("value"))
27301      res.setValueElement(parseString(json.get("value").getAsString()));
27302    if (json.has("_value"))
27303      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
27304  }
27305
27306  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27307    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
27308    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
27309    return res;
27310  }
27311
27312  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
27313    parseBackboneElementProperties(json, res);
27314    if (json.has("label"))
27315      res.setLabelElement(parseString(json.get("label").getAsString()));
27316    if (json.has("_label"))
27317      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
27318    if (json.has("description"))
27319      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27320    if (json.has("_description"))
27321      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27322    if (json.has("direction"))
27323      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
27324    if (json.has("_direction"))
27325      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
27326    if (json.has("compareToSourceId"))
27327      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
27328    if (json.has("_compareToSourceId"))
27329      parseElementProperties(getJObject(json, "_compareToSourceId"), res.getCompareToSourceIdElement());
27330    if (json.has("compareToSourceExpression"))
27331      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
27332    if (json.has("_compareToSourceExpression"))
27333      parseElementProperties(getJObject(json, "_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
27334    if (json.has("compareToSourcePath"))
27335      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
27336    if (json.has("_compareToSourcePath"))
27337      parseElementProperties(getJObject(json, "_compareToSourcePath"), res.getCompareToSourcePathElement());
27338    if (json.has("contentType"))
27339      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
27340    if (json.has("_contentType"))
27341      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
27342    if (json.has("expression"))
27343      res.setExpressionElement(parseString(json.get("expression").getAsString()));
27344    if (json.has("_expression"))
27345      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
27346    if (json.has("headerField"))
27347      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
27348    if (json.has("_headerField"))
27349      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
27350    if (json.has("minimumId"))
27351      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
27352    if (json.has("_minimumId"))
27353      parseElementProperties(getJObject(json, "_minimumId"), res.getMinimumIdElement());
27354    if (json.has("navigationLinks"))
27355      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
27356    if (json.has("_navigationLinks"))
27357      parseElementProperties(getJObject(json, "_navigationLinks"), res.getNavigationLinksElement());
27358    if (json.has("operator"))
27359      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
27360    if (json.has("_operator"))
27361      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
27362    if (json.has("path"))
27363      res.setPathElement(parseString(json.get("path").getAsString()));
27364    if (json.has("_path"))
27365      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
27366    if (json.has("requestMethod"))
27367      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
27368    if (json.has("_requestMethod"))
27369      parseElementProperties(getJObject(json, "_requestMethod"), res.getRequestMethodElement());
27370    if (json.has("requestURL"))
27371      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
27372    if (json.has("_requestURL"))
27373      parseElementProperties(getJObject(json, "_requestURL"), res.getRequestURLElement());
27374    if (json.has("resource"))
27375      res.setResourceElement(parseCode(json.get("resource").getAsString()));
27376    if (json.has("_resource"))
27377      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
27378    if (json.has("response"))
27379      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
27380    if (json.has("_response"))
27381      parseElementProperties(getJObject(json, "_response"), res.getResponseElement());
27382    if (json.has("responseCode"))
27383      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
27384    if (json.has("_responseCode"))
27385      parseElementProperties(getJObject(json, "_responseCode"), res.getResponseCodeElement());
27386    if (json.has("sourceId"))
27387      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
27388    if (json.has("_sourceId"))
27389      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
27390    if (json.has("validateProfileId"))
27391      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
27392    if (json.has("_validateProfileId"))
27393      parseElementProperties(getJObject(json, "_validateProfileId"), res.getValidateProfileIdElement());
27394    if (json.has("value"))
27395      res.setValueElement(parseString(json.get("value").getAsString()));
27396    if (json.has("_value"))
27397      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
27398    if (json.has("warningOnly"))
27399      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
27400    if (json.has("_warningOnly"))
27401      parseElementProperties(getJObject(json, "_warningOnly"), res.getWarningOnlyElement());
27402  }
27403
27404  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27405    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
27406    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
27407    return res;
27408  }
27409
27410  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
27411    parseBackboneElementProperties(json, res);
27412    if (json.has("name"))
27413      res.setNameElement(parseString(json.get("name").getAsString()));
27414    if (json.has("_name"))
27415      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27416    if (json.has("description"))
27417      res.setDescriptionElement(parseString(json.get("description").getAsString()));
27418    if (json.has("_description"))
27419      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27420    if (json.has("action")) {
27421      JsonArray array = json.getAsJsonArray("action");
27422      for (int i = 0; i < array.size(); i++) {
27423        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
27424      }
27425    };
27426  }
27427
27428  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27429    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
27430    parseTestScriptTestActionComponentProperties(json, owner, res);
27431    return res;
27432  }
27433
27434  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
27435    parseBackboneElementProperties(json, res);
27436    if (json.has("operation"))
27437      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
27438    if (json.has("assert"))
27439      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert"), owner));
27440  }
27441
27442  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27443    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
27444    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
27445    return res;
27446  }
27447
27448  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
27449    parseBackboneElementProperties(json, res);
27450    if (json.has("action")) {
27451      JsonArray array = json.getAsJsonArray("action");
27452      for (int i = 0; i < array.size(); i++) {
27453        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
27454      }
27455    };
27456  }
27457
27458  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
27459    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
27460    parseTestScriptTeardownActionComponentProperties(json, owner, res);
27461    return res;
27462  }
27463
27464  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
27465    parseBackboneElementProperties(json, res);
27466    if (json.has("operation"))
27467      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
27468  }
27469
27470  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
27471    ValueSet res = new ValueSet();
27472    parseValueSetProperties(json, res);
27473    return res;
27474  }
27475
27476  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
27477    parseDomainResourceProperties(json, res);
27478    if (json.has("url"))
27479      res.setUrlElement(parseUri(json.get("url").getAsString()));
27480    if (json.has("_url"))
27481      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
27482    if (json.has("identifier")) {
27483      JsonArray array = json.getAsJsonArray("identifier");
27484      for (int i = 0; i < array.size(); i++) {
27485        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27486      }
27487    };
27488    if (json.has("version"))
27489      res.setVersionElement(parseString(json.get("version").getAsString()));
27490    if (json.has("_version"))
27491      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
27492    if (json.has("name"))
27493      res.setNameElement(parseString(json.get("name").getAsString()));
27494    if (json.has("_name"))
27495      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27496    if (json.has("title"))
27497      res.setTitleElement(parseString(json.get("title").getAsString()));
27498    if (json.has("_title"))
27499      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
27500    if (json.has("status"))
27501      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
27502    if (json.has("_status"))
27503      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27504    if (json.has("experimental"))
27505      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
27506    if (json.has("_experimental"))
27507      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
27508    if (json.has("date"))
27509      res.setDateElement(parseDateTime(json.get("date").getAsString()));
27510    if (json.has("_date"))
27511      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
27512    if (json.has("publisher"))
27513      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
27514    if (json.has("_publisher"))
27515      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
27516    if (json.has("contact")) {
27517      JsonArray array = json.getAsJsonArray("contact");
27518      for (int i = 0; i < array.size(); i++) {
27519        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
27520      }
27521    };
27522    if (json.has("description"))
27523      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
27524    if (json.has("_description"))
27525      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
27526    if (json.has("useContext")) {
27527      JsonArray array = json.getAsJsonArray("useContext");
27528      for (int i = 0; i < array.size(); i++) {
27529        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
27530      }
27531    };
27532    if (json.has("jurisdiction")) {
27533      JsonArray array = json.getAsJsonArray("jurisdiction");
27534      for (int i = 0; i < array.size(); i++) {
27535        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27536      }
27537    };
27538    if (json.has("immutable"))
27539      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
27540    if (json.has("_immutable"))
27541      parseElementProperties(getJObject(json, "_immutable"), res.getImmutableElement());
27542    if (json.has("purpose"))
27543      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
27544    if (json.has("_purpose"))
27545      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
27546    if (json.has("copyright"))
27547      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
27548    if (json.has("_copyright"))
27549      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
27550    if (json.has("compose"))
27551      res.setCompose(parseValueSetValueSetComposeComponent(getJObject(json, "compose"), res));
27552    if (json.has("expansion"))
27553      res.setExpansion(parseValueSetValueSetExpansionComponent(getJObject(json, "expansion"), res));
27554  }
27555
27556  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27557    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
27558    parseValueSetValueSetComposeComponentProperties(json, owner, res);
27559    return res;
27560  }
27561
27562  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
27563    parseBackboneElementProperties(json, res);
27564    if (json.has("lockedDate"))
27565      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
27566    if (json.has("_lockedDate"))
27567      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
27568    if (json.has("inactive"))
27569      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
27570    if (json.has("_inactive"))
27571      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
27572    if (json.has("include")) {
27573      JsonArray array = json.getAsJsonArray("include");
27574      for (int i = 0; i < array.size(); i++) {
27575        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
27576      }
27577    };
27578    if (json.has("exclude")) {
27579      JsonArray array = json.getAsJsonArray("exclude");
27580      for (int i = 0; i < array.size(); i++) {
27581        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
27582      }
27583    };
27584  }
27585
27586  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27587    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
27588    parseValueSetConceptSetComponentProperties(json, owner, res);
27589    return res;
27590  }
27591
27592  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
27593    parseBackboneElementProperties(json, res);
27594    if (json.has("system"))
27595      res.setSystemElement(parseUri(json.get("system").getAsString()));
27596    if (json.has("_system"))
27597      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
27598    if (json.has("version"))
27599      res.setVersionElement(parseString(json.get("version").getAsString()));
27600    if (json.has("_version"))
27601      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
27602    if (json.has("concept")) {
27603      JsonArray array = json.getAsJsonArray("concept");
27604      for (int i = 0; i < array.size(); i++) {
27605        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
27606      }
27607    };
27608    if (json.has("filter")) {
27609      JsonArray array = json.getAsJsonArray("filter");
27610      for (int i = 0; i < array.size(); i++) {
27611        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
27612      }
27613    };
27614    if (json.has("valueSet")) {
27615      JsonArray array = json.getAsJsonArray("valueSet");
27616      for (int i = 0; i < array.size(); i++) {
27617        if (array.get(i).isJsonNull()) {
27618          res.getValueSet().add(new CanonicalType());
27619        } else {
27620          res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
27621        }
27622      }
27623    };
27624    if (json.has("_valueSet")) {
27625      JsonArray array = json.getAsJsonArray("_valueSet");
27626      for (int i = 0; i < array.size(); i++) {
27627        if (i == res.getValueSet().size())
27628          res.getValueSet().add(parseCanonical(null));
27629        if (array.get(i) instanceof JsonObject) 
27630          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
27631      }
27632    };
27633  }
27634
27635  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27636    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
27637    parseValueSetConceptReferenceComponentProperties(json, owner, res);
27638    return res;
27639  }
27640
27641  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
27642    parseBackboneElementProperties(json, res);
27643    if (json.has("code"))
27644      res.setCodeElement(parseCode(json.get("code").getAsString()));
27645    if (json.has("_code"))
27646      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
27647    if (json.has("display"))
27648      res.setDisplayElement(parseString(json.get("display").getAsString()));
27649    if (json.has("_display"))
27650      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
27651    if (json.has("designation")) {
27652      JsonArray array = json.getAsJsonArray("designation");
27653      for (int i = 0; i < array.size(); i++) {
27654        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
27655      }
27656    };
27657  }
27658
27659  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27660    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
27661    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
27662    return res;
27663  }
27664
27665  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
27666    parseBackboneElementProperties(json, res);
27667    if (json.has("language"))
27668      res.setLanguageElement(parseCode(json.get("language").getAsString()));
27669    if (json.has("_language"))
27670      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
27671    if (json.has("use"))
27672      res.setUse(parseCoding(getJObject(json, "use")));
27673    if (json.has("value"))
27674      res.setValueElement(parseString(json.get("value").getAsString()));
27675    if (json.has("_value"))
27676      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
27677  }
27678
27679  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27680    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
27681    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
27682    return res;
27683  }
27684
27685  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
27686    parseBackboneElementProperties(json, res);
27687    if (json.has("property"))
27688      res.setPropertyElement(parseCode(json.get("property").getAsString()));
27689    if (json.has("_property"))
27690      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
27691    if (json.has("op"))
27692      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
27693    if (json.has("_op"))
27694      parseElementProperties(getJObject(json, "_op"), res.getOpElement());
27695    if (json.has("value"))
27696      res.setValueElement(parseString(json.get("value").getAsString()));
27697    if (json.has("_value"))
27698      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
27699  }
27700
27701  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27702    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
27703    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
27704    return res;
27705  }
27706
27707  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
27708    parseBackboneElementProperties(json, res);
27709    if (json.has("identifier"))
27710      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
27711    if (json.has("_identifier"))
27712      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
27713    if (json.has("timestamp"))
27714      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
27715    if (json.has("_timestamp"))
27716      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
27717    if (json.has("total"))
27718      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
27719    if (json.has("_total"))
27720      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
27721    if (json.has("offset"))
27722      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
27723    if (json.has("_offset"))
27724      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
27725    if (json.has("parameter")) {
27726      JsonArray array = json.getAsJsonArray("parameter");
27727      for (int i = 0; i < array.size(); i++) {
27728        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
27729      }
27730    };
27731    if (json.has("contains")) {
27732      JsonArray array = json.getAsJsonArray("contains");
27733      for (int i = 0; i < array.size(); i++) {
27734        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
27735      }
27736    };
27737  }
27738
27739  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27740    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
27741    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
27742    return res;
27743  }
27744
27745  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
27746    parseBackboneElementProperties(json, res);
27747    if (json.has("name"))
27748      res.setNameElement(parseString(json.get("name").getAsString()));
27749    if (json.has("_name"))
27750      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
27751    Type value = parseType("value", json);
27752    if (value != null)
27753      res.setValue(value);
27754  }
27755
27756  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27757    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
27758    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
27759    return res;
27760  }
27761
27762  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
27763    parseBackboneElementProperties(json, res);
27764    if (json.has("system"))
27765      res.setSystemElement(parseUri(json.get("system").getAsString()));
27766    if (json.has("_system"))
27767      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
27768    if (json.has("abstract"))
27769      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
27770    if (json.has("_abstract"))
27771      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
27772    if (json.has("inactive"))
27773      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
27774    if (json.has("_inactive"))
27775      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
27776    if (json.has("version"))
27777      res.setVersionElement(parseString(json.get("version").getAsString()));
27778    if (json.has("_version"))
27779      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
27780    if (json.has("code"))
27781      res.setCodeElement(parseCode(json.get("code").getAsString()));
27782    if (json.has("_code"))
27783      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
27784    if (json.has("display"))
27785      res.setDisplayElement(parseString(json.get("display").getAsString()));
27786    if (json.has("_display"))
27787      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
27788    if (json.has("designation")) {
27789      JsonArray array = json.getAsJsonArray("designation");
27790      for (int i = 0; i < array.size(); i++) {
27791        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
27792      }
27793    };
27794    if (json.has("contains")) {
27795      JsonArray array = json.getAsJsonArray("contains");
27796      for (int i = 0; i < array.size(); i++) {
27797        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
27798      }
27799    };
27800  }
27801
27802  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
27803    VerificationResult res = new VerificationResult();
27804    parseVerificationResultProperties(json, res);
27805    return res;
27806  }
27807
27808  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res) throws IOException, FHIRFormatError {
27809    parseDomainResourceProperties(json, res);
27810    if (json.has("target")) {
27811      JsonArray array = json.getAsJsonArray("target");
27812      for (int i = 0; i < array.size(); i++) {
27813        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
27814      }
27815    };
27816    if (json.has("targetLocation")) {
27817      JsonArray array = json.getAsJsonArray("targetLocation");
27818      for (int i = 0; i < array.size(); i++) {
27819        if (array.get(i).isJsonNull()) {
27820          res.getTargetLocation().add(new StringType());
27821        } else {
27822          res.getTargetLocation().add(parseString(array.get(i).getAsString()));
27823        }
27824      }
27825    };
27826    if (json.has("_targetLocation")) {
27827      JsonArray array = json.getAsJsonArray("_targetLocation");
27828      for (int i = 0; i < array.size(); i++) {
27829        if (i == res.getTargetLocation().size())
27830          res.getTargetLocation().add(parseString(null));
27831        if (array.get(i) instanceof JsonObject) 
27832          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
27833      }
27834    };
27835    if (json.has("need"))
27836      res.setNeed(parseCodeableConcept(getJObject(json, "need")));
27837    if (json.has("status"))
27838      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.Status.NULL, new VerificationResult.StatusEnumFactory()));
27839    if (json.has("_status"))
27840      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27841    if (json.has("statusDate"))
27842      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
27843    if (json.has("_statusDate"))
27844      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
27845    if (json.has("validationType"))
27846      res.setValidationType(parseCodeableConcept(getJObject(json, "validationType")));
27847    if (json.has("validationProcess")) {
27848      JsonArray array = json.getAsJsonArray("validationProcess");
27849      for (int i = 0; i < array.size(); i++) {
27850        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27851      }
27852    };
27853    if (json.has("frequency"))
27854      res.setFrequency(parseTiming(getJObject(json, "frequency")));
27855    if (json.has("lastPerformed"))
27856      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
27857    if (json.has("_lastPerformed"))
27858      parseElementProperties(getJObject(json, "_lastPerformed"), res.getLastPerformedElement());
27859    if (json.has("nextScheduled"))
27860      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
27861    if (json.has("_nextScheduled"))
27862      parseElementProperties(getJObject(json, "_nextScheduled"), res.getNextScheduledElement());
27863    if (json.has("failureAction"))
27864      res.setFailureAction(parseCodeableConcept(getJObject(json, "failureAction")));
27865    if (json.has("primarySource")) {
27866      JsonArray array = json.getAsJsonArray("primarySource");
27867      for (int i = 0; i < array.size(); i++) {
27868        res.getPrimarySource().add(parseVerificationResultVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject(), res));
27869      }
27870    };
27871    if (json.has("attestation"))
27872      res.setAttestation(parseVerificationResultVerificationResultAttestationComponent(getJObject(json, "attestation"), res));
27873    if (json.has("validator")) {
27874      JsonArray array = json.getAsJsonArray("validator");
27875      for (int i = 0; i < array.size(); i++) {
27876        res.getValidator().add(parseVerificationResultVerificationResultValidatorComponent(array.get(i).getAsJsonObject(), res));
27877      }
27878    };
27879  }
27880
27881  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultVerificationResultPrimarySourceComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27882    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
27883    parseVerificationResultVerificationResultPrimarySourceComponentProperties(json, owner, res);
27884    return res;
27885  }
27886
27887  protected void parseVerificationResultVerificationResultPrimarySourceComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultPrimarySourceComponent res) throws IOException, FHIRFormatError {
27888    parseBackboneElementProperties(json, res);
27889    if (json.has("who"))
27890      res.setWho(parseReference(getJObject(json, "who")));
27891    if (json.has("type")) {
27892      JsonArray array = json.getAsJsonArray("type");
27893      for (int i = 0; i < array.size(); i++) {
27894        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27895      }
27896    };
27897    if (json.has("communicationMethod")) {
27898      JsonArray array = json.getAsJsonArray("communicationMethod");
27899      for (int i = 0; i < array.size(); i++) {
27900        res.getCommunicationMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27901      }
27902    };
27903    if (json.has("validationStatus"))
27904      res.setValidationStatus(parseCodeableConcept(getJObject(json, "validationStatus")));
27905    if (json.has("validationDate"))
27906      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
27907    if (json.has("_validationDate"))
27908      parseElementProperties(getJObject(json, "_validationDate"), res.getValidationDateElement());
27909    if (json.has("canPushUpdates"))
27910      res.setCanPushUpdates(parseCodeableConcept(getJObject(json, "canPushUpdates")));
27911    if (json.has("pushTypeAvailable")) {
27912      JsonArray array = json.getAsJsonArray("pushTypeAvailable");
27913      for (int i = 0; i < array.size(); i++) {
27914        res.getPushTypeAvailable().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27915      }
27916    };
27917  }
27918
27919  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultVerificationResultAttestationComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27920    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
27921    parseVerificationResultVerificationResultAttestationComponentProperties(json, owner, res);
27922    return res;
27923  }
27924
27925  protected void parseVerificationResultVerificationResultAttestationComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultAttestationComponent res) throws IOException, FHIRFormatError {
27926    parseBackboneElementProperties(json, res);
27927    if (json.has("who"))
27928      res.setWho(parseReference(getJObject(json, "who")));
27929    if (json.has("onBehalfOf"))
27930      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
27931    if (json.has("communicationMethod"))
27932      res.setCommunicationMethod(parseCodeableConcept(getJObject(json, "communicationMethod")));
27933    if (json.has("date"))
27934      res.setDateElement(parseDate(json.get("date").getAsString()));
27935    if (json.has("_date"))
27936      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
27937    if (json.has("sourceIdentityCertificate"))
27938      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
27939    if (json.has("_sourceIdentityCertificate"))
27940      parseElementProperties(getJObject(json, "_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
27941    if (json.has("proxyIdentityCertificate"))
27942      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
27943    if (json.has("_proxyIdentityCertificate"))
27944      parseElementProperties(getJObject(json, "_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
27945    if (json.has("proxySignature"))
27946      res.setProxySignature(parseSignature(getJObject(json, "proxySignature")));
27947    if (json.has("sourceSignature"))
27948      res.setSourceSignature(parseSignature(getJObject(json, "sourceSignature")));
27949  }
27950
27951  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultVerificationResultValidatorComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27952    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
27953    parseVerificationResultVerificationResultValidatorComponentProperties(json, owner, res);
27954    return res;
27955  }
27956
27957  protected void parseVerificationResultVerificationResultValidatorComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultValidatorComponent res) throws IOException, FHIRFormatError {
27958    parseBackboneElementProperties(json, res);
27959    if (json.has("organization"))
27960      res.setOrganization(parseReference(getJObject(json, "organization")));
27961    if (json.has("identityCertificate"))
27962      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
27963    if (json.has("_identityCertificate"))
27964      parseElementProperties(getJObject(json, "_identityCertificate"), res.getIdentityCertificateElement());
27965    if (json.has("attestationSignature"))
27966      res.setAttestationSignature(parseSignature(getJObject(json, "attestationSignature")));
27967  }
27968
27969  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
27970    VisionPrescription res = new VisionPrescription();
27971    parseVisionPrescriptionProperties(json, res);
27972    return res;
27973  }
27974
27975  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
27976    parseDomainResourceProperties(json, res);
27977    if (json.has("identifier")) {
27978      JsonArray array = json.getAsJsonArray("identifier");
27979      for (int i = 0; i < array.size(); i++) {
27980        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27981      }
27982    };
27983    if (json.has("status"))
27984      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
27985    if (json.has("_status"))
27986      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
27987    if (json.has("created"))
27988      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
27989    if (json.has("_created"))
27990      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
27991    if (json.has("patient"))
27992      res.setPatient(parseReference(getJObject(json, "patient")));
27993    if (json.has("encounter"))
27994      res.setEncounter(parseReference(getJObject(json, "encounter")));
27995    if (json.has("dateWritten"))
27996      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
27997    if (json.has("_dateWritten"))
27998      parseElementProperties(getJObject(json, "_dateWritten"), res.getDateWrittenElement());
27999    if (json.has("prescriber"))
28000      res.setPrescriber(parseReference(getJObject(json, "prescriber")));
28001    if (json.has("lensSpecification")) {
28002      JsonArray array = json.getAsJsonArray("lensSpecification");
28003      for (int i = 0; i < array.size(); i++) {
28004        res.getLensSpecification().add(parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(array.get(i).getAsJsonObject(), res));
28005      }
28006    };
28007  }
28008
28009  protected VisionPrescription.VisionPrescriptionLensSpecificationComponent parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
28010    VisionPrescription.VisionPrescriptionLensSpecificationComponent res = new VisionPrescription.VisionPrescriptionLensSpecificationComponent();
28011    parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(json, owner, res);
28012    return res;
28013  }
28014
28015  protected void parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.VisionPrescriptionLensSpecificationComponent res) throws IOException, FHIRFormatError {
28016    parseBackboneElementProperties(json, res);
28017    if (json.has("product"))
28018      res.setProduct(parseCodeableConcept(getJObject(json, "product")));
28019    if (json.has("eye"))
28020      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
28021    if (json.has("_eye"))
28022      parseElementProperties(getJObject(json, "_eye"), res.getEyeElement());
28023    if (json.has("sphere"))
28024      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
28025    if (json.has("_sphere"))
28026      parseElementProperties(getJObject(json, "_sphere"), res.getSphereElement());
28027    if (json.has("cylinder"))
28028      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
28029    if (json.has("_cylinder"))
28030      parseElementProperties(getJObject(json, "_cylinder"), res.getCylinderElement());
28031    if (json.has("axis"))
28032      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
28033    if (json.has("_axis"))
28034      parseElementProperties(getJObject(json, "_axis"), res.getAxisElement());
28035    if (json.has("prism")) {
28036      JsonArray array = json.getAsJsonArray("prism");
28037      for (int i = 0; i < array.size(); i++) {
28038        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject(), owner));
28039      }
28040    };
28041    if (json.has("add"))
28042      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
28043    if (json.has("_add"))
28044      parseElementProperties(getJObject(json, "_add"), res.getAddElement());
28045    if (json.has("power"))
28046      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
28047    if (json.has("_power"))
28048      parseElementProperties(getJObject(json, "_power"), res.getPowerElement());
28049    if (json.has("backCurve"))
28050      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
28051    if (json.has("_backCurve"))
28052      parseElementProperties(getJObject(json, "_backCurve"), res.getBackCurveElement());
28053    if (json.has("diameter"))
28054      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
28055    if (json.has("_diameter"))
28056      parseElementProperties(getJObject(json, "_diameter"), res.getDiameterElement());
28057    if (json.has("duration"))
28058      res.setDuration(parseQuantity(getJObject(json, "duration")));
28059    if (json.has("color"))
28060      res.setColorElement(parseString(json.get("color").getAsString()));
28061    if (json.has("_color"))
28062      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
28063    if (json.has("brand"))
28064      res.setBrandElement(parseString(json.get("brand").getAsString()));
28065    if (json.has("_brand"))
28066      parseElementProperties(getJObject(json, "_brand"), res.getBrandElement());
28067    if (json.has("note")) {
28068      JsonArray array = json.getAsJsonArray("note");
28069      for (int i = 0; i < array.size(); i++) {
28070        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
28071      }
28072    };
28073  }
28074
28075  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
28076    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
28077    parseVisionPrescriptionPrismComponentProperties(json, owner, res);
28078    return res;
28079  }
28080
28081  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
28082    parseBackboneElementProperties(json, res);
28083    if (json.has("amount"))
28084      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
28085    if (json.has("_amount"))
28086      parseElementProperties(getJObject(json, "_amount"), res.getAmountElement());
28087    if (json.has("base"))
28088      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
28089    if (json.has("_base"))
28090      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
28091  }
28092
28093  @Override
28094  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
28095    if (!json.has("resourceType")) {
28096      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
28097    }
28098    String t = json.get("resourceType").getAsString();
28099    if (Utilities.noString(t))
28100      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
28101    if (t.equals("Parameters"))
28102      return parseParameters(json);
28103    else if (t.equals("Account"))
28104      return parseAccount(json);
28105    else if (t.equals("ActivityDefinition"))
28106      return parseActivityDefinition(json);
28107    else if (t.equals("AdverseEvent"))
28108      return parseAdverseEvent(json);
28109    else if (t.equals("AllergyIntolerance"))
28110      return parseAllergyIntolerance(json);
28111    else if (t.equals("Appointment"))
28112      return parseAppointment(json);
28113    else if (t.equals("AppointmentResponse"))
28114      return parseAppointmentResponse(json);
28115    else if (t.equals("AuditEvent"))
28116      return parseAuditEvent(json);
28117    else if (t.equals("Basic"))
28118      return parseBasic(json);
28119    else if (t.equals("Binary"))
28120      return parseBinary(json);
28121    else if (t.equals("BiologicallyDerivedProduct"))
28122      return parseBiologicallyDerivedProduct(json);
28123    else if (t.equals("BodyStructure"))
28124      return parseBodyStructure(json);
28125    else if (t.equals("Bundle"))
28126      return parseBundle(json);
28127    else if (t.equals("CapabilityStatement"))
28128      return parseCapabilityStatement(json);
28129    else if (t.equals("CarePlan"))
28130      return parseCarePlan(json);
28131    else if (t.equals("CareTeam"))
28132      return parseCareTeam(json);
28133    else if (t.equals("CatalogEntry"))
28134      return parseCatalogEntry(json);
28135    else if (t.equals("ChargeItem"))
28136      return parseChargeItem(json);
28137    else if (t.equals("ChargeItemDefinition"))
28138      return parseChargeItemDefinition(json);
28139    else if (t.equals("Claim"))
28140      return parseClaim(json);
28141    else if (t.equals("ClaimResponse"))
28142      return parseClaimResponse(json);
28143    else if (t.equals("ClinicalImpression"))
28144      return parseClinicalImpression(json);
28145    else if (t.equals("CodeSystem"))
28146      return parseCodeSystem(json);
28147    else if (t.equals("Communication"))
28148      return parseCommunication(json);
28149    else if (t.equals("CommunicationRequest"))
28150      return parseCommunicationRequest(json);
28151    else if (t.equals("CompartmentDefinition"))
28152      return parseCompartmentDefinition(json);
28153    else if (t.equals("Composition"))
28154      return parseComposition(json);
28155    else if (t.equals("ConceptMap"))
28156      return parseConceptMap(json);
28157    else if (t.equals("Condition"))
28158      return parseCondition(json);
28159    else if (t.equals("Consent"))
28160      return parseConsent(json);
28161    else if (t.equals("Contract"))
28162      return parseContract(json);
28163    else if (t.equals("Coverage"))
28164      return parseCoverage(json);
28165    else if (t.equals("CoverageEligibilityRequest"))
28166      return parseCoverageEligibilityRequest(json);
28167    else if (t.equals("CoverageEligibilityResponse"))
28168      return parseCoverageEligibilityResponse(json);
28169    else if (t.equals("DetectedIssue"))
28170      return parseDetectedIssue(json);
28171    else if (t.equals("Device"))
28172      return parseDevice(json);
28173    else if (t.equals("DeviceDefinition"))
28174      return parseDeviceDefinition(json);
28175    else if (t.equals("DeviceMetric"))
28176      return parseDeviceMetric(json);
28177    else if (t.equals("DeviceRequest"))
28178      return parseDeviceRequest(json);
28179    else if (t.equals("DeviceUseStatement"))
28180      return parseDeviceUseStatement(json);
28181    else if (t.equals("DiagnosticReport"))
28182      return parseDiagnosticReport(json);
28183    else if (t.equals("DocumentManifest"))
28184      return parseDocumentManifest(json);
28185    else if (t.equals("DocumentReference"))
28186      return parseDocumentReference(json);
28187    else if (t.equals("EffectEvidenceSynthesis"))
28188      return parseEffectEvidenceSynthesis(json);
28189    else if (t.equals("Encounter"))
28190      return parseEncounter(json);
28191    else if (t.equals("Endpoint"))
28192      return parseEndpoint(json);
28193    else if (t.equals("EnrollmentRequest"))
28194      return parseEnrollmentRequest(json);
28195    else if (t.equals("EnrollmentResponse"))
28196      return parseEnrollmentResponse(json);
28197    else if (t.equals("EpisodeOfCare"))
28198      return parseEpisodeOfCare(json);
28199    else if (t.equals("EventDefinition"))
28200      return parseEventDefinition(json);
28201    else if (t.equals("Evidence"))
28202      return parseEvidence(json);
28203    else if (t.equals("EvidenceVariable"))
28204      return parseEvidenceVariable(json);
28205    else if (t.equals("ExampleScenario"))
28206      return parseExampleScenario(json);
28207    else if (t.equals("ExplanationOfBenefit"))
28208      return parseExplanationOfBenefit(json);
28209    else if (t.equals("FamilyMemberHistory"))
28210      return parseFamilyMemberHistory(json);
28211    else if (t.equals("Flag"))
28212      return parseFlag(json);
28213    else if (t.equals("Goal"))
28214      return parseGoal(json);
28215    else if (t.equals("GraphDefinition"))
28216      return parseGraphDefinition(json);
28217    else if (t.equals("Group"))
28218      return parseGroup(json);
28219    else if (t.equals("GuidanceResponse"))
28220      return parseGuidanceResponse(json);
28221    else if (t.equals("HealthcareService"))
28222      return parseHealthcareService(json);
28223    else if (t.equals("ImagingStudy"))
28224      return parseImagingStudy(json);
28225    else if (t.equals("Immunization"))
28226      return parseImmunization(json);
28227    else if (t.equals("ImmunizationEvaluation"))
28228      return parseImmunizationEvaluation(json);
28229    else if (t.equals("ImmunizationRecommendation"))
28230      return parseImmunizationRecommendation(json);
28231    else if (t.equals("ImplementationGuide"))
28232      return parseImplementationGuide(json);
28233    else if (t.equals("InsurancePlan"))
28234      return parseInsurancePlan(json);
28235    else if (t.equals("Invoice"))
28236      return parseInvoice(json);
28237    else if (t.equals("Library"))
28238      return parseLibrary(json);
28239    else if (t.equals("Linkage"))
28240      return parseLinkage(json);
28241    else if (t.equals("List"))
28242      return parseListResource(json);
28243    else if (t.equals("Location"))
28244      return parseLocation(json);
28245    else if (t.equals("Measure"))
28246      return parseMeasure(json);
28247    else if (t.equals("MeasureReport"))
28248      return parseMeasureReport(json);
28249    else if (t.equals("Media"))
28250      return parseMedia(json);
28251    else if (t.equals("Medication"))
28252      return parseMedication(json);
28253    else if (t.equals("MedicationAdministration"))
28254      return parseMedicationAdministration(json);
28255    else if (t.equals("MedicationDispense"))
28256      return parseMedicationDispense(json);
28257    else if (t.equals("MedicationKnowledge"))
28258      return parseMedicationKnowledge(json);
28259    else if (t.equals("MedicationRequest"))
28260      return parseMedicationRequest(json);
28261    else if (t.equals("MedicationStatement"))
28262      return parseMedicationStatement(json);
28263    else if (t.equals("MedicinalProduct"))
28264      return parseMedicinalProduct(json);
28265    else if (t.equals("MedicinalProductAuthorization"))
28266      return parseMedicinalProductAuthorization(json);
28267    else if (t.equals("MedicinalProductContraindication"))
28268      return parseMedicinalProductContraindication(json);
28269    else if (t.equals("MedicinalProductIndication"))
28270      return parseMedicinalProductIndication(json);
28271    else if (t.equals("MedicinalProductIngredient"))
28272      return parseMedicinalProductIngredient(json);
28273    else if (t.equals("MedicinalProductInteraction"))
28274      return parseMedicinalProductInteraction(json);
28275    else if (t.equals("MedicinalProductManufactured"))
28276      return parseMedicinalProductManufactured(json);
28277    else if (t.equals("MedicinalProductPackaged"))
28278      return parseMedicinalProductPackaged(json);
28279    else if (t.equals("MedicinalProductPharmaceutical"))
28280      return parseMedicinalProductPharmaceutical(json);
28281    else if (t.equals("MedicinalProductUndesirableEffect"))
28282      return parseMedicinalProductUndesirableEffect(json);
28283    else if (t.equals("MessageDefinition"))
28284      return parseMessageDefinition(json);
28285    else if (t.equals("MessageHeader"))
28286      return parseMessageHeader(json);
28287    else if (t.equals("MolecularSequence"))
28288      return parseMolecularSequence(json);
28289    else if (t.equals("NamingSystem"))
28290      return parseNamingSystem(json);
28291    else if (t.equals("NutritionOrder"))
28292      return parseNutritionOrder(json);
28293    else if (t.equals("Observation"))
28294      return parseObservation(json);
28295    else if (t.equals("ObservationDefinition"))
28296      return parseObservationDefinition(json);
28297    else if (t.equals("OperationDefinition"))
28298      return parseOperationDefinition(json);
28299    else if (t.equals("OperationOutcome"))
28300      return parseOperationOutcome(json);
28301    else if (t.equals("Organization"))
28302      return parseOrganization(json);
28303    else if (t.equals("OrganizationAffiliation"))
28304      return parseOrganizationAffiliation(json);
28305    else if (t.equals("Patient"))
28306      return parsePatient(json);
28307    else if (t.equals("PaymentNotice"))
28308      return parsePaymentNotice(json);
28309    else if (t.equals("PaymentReconciliation"))
28310      return parsePaymentReconciliation(json);
28311    else if (t.equals("Person"))
28312      return parsePerson(json);
28313    else if (t.equals("PlanDefinition"))
28314      return parsePlanDefinition(json);
28315    else if (t.equals("Practitioner"))
28316      return parsePractitioner(json);
28317    else if (t.equals("PractitionerRole"))
28318      return parsePractitionerRole(json);
28319    else if (t.equals("Procedure"))
28320      return parseProcedure(json);
28321    else if (t.equals("Provenance"))
28322      return parseProvenance(json);
28323    else if (t.equals("Questionnaire"))
28324      return parseQuestionnaire(json);
28325    else if (t.equals("QuestionnaireResponse"))
28326      return parseQuestionnaireResponse(json);
28327    else if (t.equals("RelatedPerson"))
28328      return parseRelatedPerson(json);
28329    else if (t.equals("RequestGroup"))
28330      return parseRequestGroup(json);
28331    else if (t.equals("ResearchDefinition"))
28332      return parseResearchDefinition(json);
28333    else if (t.equals("ResearchElementDefinition"))
28334      return parseResearchElementDefinition(json);
28335    else if (t.equals("ResearchStudy"))
28336      return parseResearchStudy(json);
28337    else if (t.equals("ResearchSubject"))
28338      return parseResearchSubject(json);
28339    else if (t.equals("RiskAssessment"))
28340      return parseRiskAssessment(json);
28341    else if (t.equals("RiskEvidenceSynthesis"))
28342      return parseRiskEvidenceSynthesis(json);
28343    else if (t.equals("Schedule"))
28344      return parseSchedule(json);
28345    else if (t.equals("SearchParameter"))
28346      return parseSearchParameter(json);
28347    else if (t.equals("ServiceRequest"))
28348      return parseServiceRequest(json);
28349    else if (t.equals("Slot"))
28350      return parseSlot(json);
28351    else if (t.equals("Specimen"))
28352      return parseSpecimen(json);
28353    else if (t.equals("SpecimenDefinition"))
28354      return parseSpecimenDefinition(json);
28355    else if (t.equals("StructureDefinition"))
28356      return parseStructureDefinition(json);
28357    else if (t.equals("StructureMap"))
28358      return parseStructureMap(json);
28359    else if (t.equals("Subscription"))
28360      return parseSubscription(json);
28361    else if (t.equals("Substance"))
28362      return parseSubstance(json);
28363    else if (t.equals("SubstanceNucleicAcid"))
28364      return parseSubstanceNucleicAcid(json);
28365    else if (t.equals("SubstancePolymer"))
28366      return parseSubstancePolymer(json);
28367    else if (t.equals("SubstanceProtein"))
28368      return parseSubstanceProtein(json);
28369    else if (t.equals("SubstanceReferenceInformation"))
28370      return parseSubstanceReferenceInformation(json);
28371    else if (t.equals("SubstanceSourceMaterial"))
28372      return parseSubstanceSourceMaterial(json);
28373    else if (t.equals("SubstanceSpecification"))
28374      return parseSubstanceSpecification(json);
28375    else if (t.equals("SupplyDelivery"))
28376      return parseSupplyDelivery(json);
28377    else if (t.equals("SupplyRequest"))
28378      return parseSupplyRequest(json);
28379    else if (t.equals("Task"))
28380      return parseTask(json);
28381    else if (t.equals("TerminologyCapabilities"))
28382      return parseTerminologyCapabilities(json);
28383    else if (t.equals("TestReport"))
28384      return parseTestReport(json);
28385    else if (t.equals("TestScript"))
28386      return parseTestScript(json);
28387    else if (t.equals("ValueSet"))
28388      return parseValueSet(json);
28389    else if (t.equals("VerificationResult"))
28390      return parseVerificationResult(json);
28391    else if (t.equals("VisionPrescription"))
28392      return parseVisionPrescription(json);
28393    else if (t.equals("Binary"))
28394      return parseBinary(json);
28395    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
28396  }
28397
28398  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
28399    if (json.has(prefix+"Extension"))
28400      return parseExtension(getJObject(json, prefix+"Extension"));
28401    else if (json.has(prefix+"Narrative"))
28402      return parseNarrative(getJObject(json, prefix+"Narrative"));
28403    else if (json.has(prefix+"Meta"))
28404      return parseMeta(getJObject(json, prefix+"Meta"));
28405    else if (json.has(prefix+"Address"))
28406      return parseAddress(getJObject(json, prefix+"Address"));
28407    else if (json.has(prefix+"Contributor"))
28408      return parseContributor(getJObject(json, prefix+"Contributor"));
28409    else if (json.has(prefix+"Attachment"))
28410      return parseAttachment(getJObject(json, prefix+"Attachment"));
28411    else if (json.has(prefix+"Count"))
28412      return parseCount(getJObject(json, prefix+"Count"));
28413    else if (json.has(prefix+"DataRequirement"))
28414      return parseDataRequirement(getJObject(json, prefix+"DataRequirement"));
28415    else if (json.has(prefix+"Dosage"))
28416      return parseDosage(getJObject(json, prefix+"Dosage"));
28417    else if (json.has(prefix+"Money"))
28418      return parseMoney(getJObject(json, prefix+"Money"));
28419    else if (json.has(prefix+"HumanName"))
28420      return parseHumanName(getJObject(json, prefix+"HumanName"));
28421    else if (json.has(prefix+"ContactPoint"))
28422      return parseContactPoint(getJObject(json, prefix+"ContactPoint"));
28423    else if (json.has(prefix+"MarketingStatus"))
28424      return parseMarketingStatus(getJObject(json, prefix+"MarketingStatus"));
28425    else if (json.has(prefix+"Identifier"))
28426      return parseIdentifier(getJObject(json, prefix+"Identifier"));
28427    else if (json.has(prefix+"SubstanceAmount"))
28428      return parseSubstanceAmount(getJObject(json, prefix+"SubstanceAmount"));
28429    else if (json.has(prefix+"Coding"))
28430      return parseCoding(getJObject(json, prefix+"Coding"));
28431    else if (json.has(prefix+"SampledData"))
28432      return parseSampledData(getJObject(json, prefix+"SampledData"));
28433    else if (json.has(prefix+"Population"))
28434      return parsePopulation(getJObject(json, prefix+"Population"));
28435    else if (json.has(prefix+"Ratio"))
28436      return parseRatio(getJObject(json, prefix+"Ratio"));
28437    else if (json.has(prefix+"Distance"))
28438      return parseDistance(getJObject(json, prefix+"Distance"));
28439    else if (json.has(prefix+"Age"))
28440      return parseAge(getJObject(json, prefix+"Age"));
28441    else if (json.has(prefix+"Reference"))
28442      return parseReference(getJObject(json, prefix+"Reference"));
28443    else if (json.has(prefix+"TriggerDefinition"))
28444      return parseTriggerDefinition(getJObject(json, prefix+"TriggerDefinition"));
28445    else if (json.has(prefix+"Quantity"))
28446      return parseQuantity(getJObject(json, prefix+"Quantity"));
28447    else if (json.has(prefix+"Period"))
28448      return parsePeriod(getJObject(json, prefix+"Period"));
28449    else if (json.has(prefix+"Duration"))
28450      return parseDuration(getJObject(json, prefix+"Duration"));
28451    else if (json.has(prefix+"Range"))
28452      return parseRange(getJObject(json, prefix+"Range"));
28453    else if (json.has(prefix+"RelatedArtifact"))
28454      return parseRelatedArtifact(getJObject(json, prefix+"RelatedArtifact"));
28455    else if (json.has(prefix+"Annotation"))
28456      return parseAnnotation(getJObject(json, prefix+"Annotation"));
28457    else if (json.has(prefix+"ProductShelfLife"))
28458      return parseProductShelfLife(getJObject(json, prefix+"ProductShelfLife"));
28459    else if (json.has(prefix+"ContactDetail"))
28460      return parseContactDetail(getJObject(json, prefix+"ContactDetail"));
28461    else if (json.has(prefix+"UsageContext"))
28462      return parseUsageContext(getJObject(json, prefix+"UsageContext"));
28463    else if (json.has(prefix+"Expression"))
28464      return parseExpression(getJObject(json, prefix+"Expression"));
28465    else if (json.has(prefix+"Signature"))
28466      return parseSignature(getJObject(json, prefix+"Signature"));
28467    else if (json.has(prefix+"Timing"))
28468      return parseTiming(getJObject(json, prefix+"Timing"));
28469    else if (json.has(prefix+"ProdCharacteristic"))
28470      return parseProdCharacteristic(getJObject(json, prefix+"ProdCharacteristic"));
28471    else if (json.has(prefix+"CodeableConcept"))
28472      return parseCodeableConcept(getJObject(json, prefix+"CodeableConcept"));
28473    else if (json.has(prefix+"ParameterDefinition"))
28474      return parseParameterDefinition(getJObject(json, prefix+"ParameterDefinition"));
28475    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
28476      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
28477      if (json.has("_"+prefix+"Date"))
28478        parseElementProperties(getJObject(json, "_"+prefix+"Date"), t);
28479      return t;
28480    }
28481    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
28482      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
28483      if (json.has("_"+prefix+"DateTime"))
28484        parseElementProperties(getJObject(json, "_"+prefix+"DateTime"), t);
28485      return t;
28486    }
28487    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
28488      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
28489      if (json.has("_"+prefix+"Code"))
28490        parseElementProperties(getJObject(json, "_"+prefix+"Code"), t);
28491      return t;
28492    }
28493    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
28494      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
28495      if (json.has("_"+prefix+"String"))
28496        parseElementProperties(getJObject(json, "_"+prefix+"String"), t);
28497      return t;
28498    }
28499    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
28500      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
28501      if (json.has("_"+prefix+"Integer"))
28502        parseElementProperties(getJObject(json, "_"+prefix+"Integer"), t);
28503      return t;
28504    }
28505    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
28506      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
28507      if (json.has("_"+prefix+"Oid"))
28508        parseElementProperties(getJObject(json, "_"+prefix+"Oid"), t);
28509      return t;
28510    }
28511    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
28512      Type t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
28513      if (json.has("_"+prefix+"Canonical"))
28514        parseElementProperties(getJObject(json, "_"+prefix+"Canonical"), t);
28515      return t;
28516    }
28517    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
28518      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
28519      if (json.has("_"+prefix+"Uri"))
28520        parseElementProperties(getJObject(json, "_"+prefix+"Uri"), t);
28521      return t;
28522    }
28523    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
28524      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
28525      if (json.has("_"+prefix+"Uuid"))
28526        parseElementProperties(getJObject(json, "_"+prefix+"Uuid"), t);
28527      return t;
28528    }
28529    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
28530      Type t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
28531      if (json.has("_"+prefix+"Url"))
28532        parseElementProperties(getJObject(json, "_"+prefix+"Url"), t);
28533      return t;
28534    }
28535    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
28536      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
28537      if (json.has("_"+prefix+"Instant"))
28538        parseElementProperties(getJObject(json, "_"+prefix+"Instant"), t);
28539      return t;
28540    }
28541    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
28542      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
28543      if (json.has("_"+prefix+"Boolean"))
28544        parseElementProperties(getJObject(json, "_"+prefix+"Boolean"), t);
28545      return t;
28546    }
28547    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
28548      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
28549      if (json.has("_"+prefix+"Base64Binary"))
28550        parseElementProperties(getJObject(json, "_"+prefix+"Base64Binary"), t);
28551      return t;
28552    }
28553    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
28554      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
28555      if (json.has("_"+prefix+"UnsignedInt"))
28556        parseElementProperties(getJObject(json, "_"+prefix+"UnsignedInt"), t);
28557      return t;
28558    }
28559    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
28560      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
28561      if (json.has("_"+prefix+"Markdown"))
28562        parseElementProperties(getJObject(json, "_"+prefix+"Markdown"), t);
28563      return t;
28564    }
28565    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
28566      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
28567      if (json.has("_"+prefix+"Time"))
28568        parseElementProperties(getJObject(json, "_"+prefix+"Time"), t);
28569      return t;
28570    }
28571    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
28572      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
28573      if (json.has("_"+prefix+"Id"))
28574        parseElementProperties(getJObject(json, "_"+prefix+"Id"), t);
28575      return t;
28576    }
28577    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
28578      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
28579      if (json.has("_"+prefix+"PositiveInt"))
28580        parseElementProperties(getJObject(json, "_"+prefix+"PositiveInt"), t);
28581      return t;
28582    }
28583    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
28584      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
28585      if (json.has("_"+prefix+"Decimal"))
28586        parseElementProperties(getJObject(json, "_"+prefix+"Decimal"), t);
28587      return t;
28588    }
28589    return null;
28590  }
28591
28592  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
28593    if (type.equals("Extension"))
28594      return parseExtension(json);
28595    else if (type.equals("Narrative"))
28596      return parseNarrative(json);
28597    else if (type.equals("Meta"))
28598      return parseMeta(json);
28599    else if (type.equals("Address"))
28600      return parseAddress(json);
28601    else if (type.equals("Contributor"))
28602      return parseContributor(json);
28603    else if (type.equals("Attachment"))
28604      return parseAttachment(json);
28605    else if (type.equals("Count"))
28606      return parseCount(json);
28607    else if (type.equals("DataRequirement"))
28608      return parseDataRequirement(json);
28609    else if (type.equals("Dosage"))
28610      return parseDosage(json);
28611    else if (type.equals("Money"))
28612      return parseMoney(json);
28613    else if (type.equals("HumanName"))
28614      return parseHumanName(json);
28615    else if (type.equals("ContactPoint"))
28616      return parseContactPoint(json);
28617    else if (type.equals("MarketingStatus"))
28618      return parseMarketingStatus(json);
28619    else if (type.equals("Identifier"))
28620      return parseIdentifier(json);
28621    else if (type.equals("SubstanceAmount"))
28622      return parseSubstanceAmount(json);
28623    else if (type.equals("Coding"))
28624      return parseCoding(json);
28625    else if (type.equals("SampledData"))
28626      return parseSampledData(json);
28627    else if (type.equals("Population"))
28628      return parsePopulation(json);
28629    else if (type.equals("Ratio"))
28630      return parseRatio(json);
28631    else if (type.equals("Distance"))
28632      return parseDistance(json);
28633    else if (type.equals("Age"))
28634      return parseAge(json);
28635    else if (type.equals("Reference"))
28636      return parseReference(json);
28637    else if (type.equals("TriggerDefinition"))
28638      return parseTriggerDefinition(json);
28639    else if (type.equals("Quantity"))
28640      return parseQuantity(json);
28641    else if (type.equals("Period"))
28642      return parsePeriod(json);
28643    else if (type.equals("Duration"))
28644      return parseDuration(json);
28645    else if (type.equals("Range"))
28646      return parseRange(json);
28647    else if (type.equals("RelatedArtifact"))
28648      return parseRelatedArtifact(json);
28649    else if (type.equals("Annotation"))
28650      return parseAnnotation(json);
28651    else if (type.equals("ProductShelfLife"))
28652      return parseProductShelfLife(json);
28653    else if (type.equals("ContactDetail"))
28654      return parseContactDetail(json);
28655    else if (type.equals("UsageContext"))
28656      return parseUsageContext(json);
28657    else if (type.equals("Expression"))
28658      return parseExpression(json);
28659    else if (type.equals("Signature"))
28660      return parseSignature(json);
28661    else if (type.equals("Timing"))
28662      return parseTiming(json);
28663    else if (type.equals("ProdCharacteristic"))
28664      return parseProdCharacteristic(json);
28665    else if (type.equals("CodeableConcept"))
28666      return parseCodeableConcept(json);
28667    else if (type.equals("ParameterDefinition"))
28668      return parseParameterDefinition(json);
28669    throw new FHIRFormatError("Unknown Type "+type);
28670  }
28671
28672  protected boolean hasTypeName(JsonObject json, String prefix) {
28673        if (json.has(prefix+"Extension"))
28674      return true;
28675    if (json.has(prefix+"Narrative"))
28676      return true;
28677    if (json.has(prefix+"Meta"))
28678      return true;
28679    if (json.has(prefix+"Address"))
28680      return true;
28681    if (json.has(prefix+"Contributor"))
28682      return true;
28683    if (json.has(prefix+"Attachment"))
28684      return true;
28685    if (json.has(prefix+"Count"))
28686      return true;
28687    if (json.has(prefix+"DataRequirement"))
28688      return true;
28689    if (json.has(prefix+"Dosage"))
28690      return true;
28691    if (json.has(prefix+"Money"))
28692      return true;
28693    if (json.has(prefix+"HumanName"))
28694      return true;
28695    if (json.has(prefix+"ContactPoint"))
28696      return true;
28697    if (json.has(prefix+"MarketingStatus"))
28698      return true;
28699    if (json.has(prefix+"Identifier"))
28700      return true;
28701    if (json.has(prefix+"SubstanceAmount"))
28702      return true;
28703    if (json.has(prefix+"Coding"))
28704      return true;
28705    if (json.has(prefix+"SampledData"))
28706      return true;
28707    if (json.has(prefix+"Population"))
28708      return true;
28709    if (json.has(prefix+"Ratio"))
28710      return true;
28711    if (json.has(prefix+"Distance"))
28712      return true;
28713    if (json.has(prefix+"Age"))
28714      return true;
28715    if (json.has(prefix+"Reference"))
28716      return true;
28717    if (json.has(prefix+"TriggerDefinition"))
28718      return true;
28719    if (json.has(prefix+"Quantity"))
28720      return true;
28721    if (json.has(prefix+"Period"))
28722      return true;
28723    if (json.has(prefix+"Duration"))
28724      return true;
28725    if (json.has(prefix+"Range"))
28726      return true;
28727    if (json.has(prefix+"RelatedArtifact"))
28728      return true;
28729    if (json.has(prefix+"Annotation"))
28730      return true;
28731    if (json.has(prefix+"ProductShelfLife"))
28732      return true;
28733    if (json.has(prefix+"ContactDetail"))
28734      return true;
28735    if (json.has(prefix+"UsageContext"))
28736      return true;
28737    if (json.has(prefix+"Expression"))
28738      return true;
28739    if (json.has(prefix+"Signature"))
28740      return true;
28741    if (json.has(prefix+"Timing"))
28742      return true;
28743    if (json.has(prefix+"ProdCharacteristic"))
28744      return true;
28745    if (json.has(prefix+"CodeableConcept"))
28746      return true;
28747    if (json.has(prefix+"ParameterDefinition"))
28748      return true;
28749    if (json.has(prefix+"Parameters"))
28750      return true;
28751    if (json.has(prefix+"Account"))
28752      return true;
28753    if (json.has(prefix+"ActivityDefinition"))
28754      return true;
28755    if (json.has(prefix+"AdverseEvent"))
28756      return true;
28757    if (json.has(prefix+"AllergyIntolerance"))
28758      return true;
28759    if (json.has(prefix+"Appointment"))
28760      return true;
28761    if (json.has(prefix+"AppointmentResponse"))
28762      return true;
28763    if (json.has(prefix+"AuditEvent"))
28764      return true;
28765    if (json.has(prefix+"Basic"))
28766      return true;
28767    if (json.has(prefix+"Binary"))
28768      return true;
28769    if (json.has(prefix+"BiologicallyDerivedProduct"))
28770      return true;
28771    if (json.has(prefix+"BodyStructure"))
28772      return true;
28773    if (json.has(prefix+"Bundle"))
28774      return true;
28775    if (json.has(prefix+"CapabilityStatement"))
28776      return true;
28777    if (json.has(prefix+"CarePlan"))
28778      return true;
28779    if (json.has(prefix+"CareTeam"))
28780      return true;
28781    if (json.has(prefix+"CatalogEntry"))
28782      return true;
28783    if (json.has(prefix+"ChargeItem"))
28784      return true;
28785    if (json.has(prefix+"ChargeItemDefinition"))
28786      return true;
28787    if (json.has(prefix+"Claim"))
28788      return true;
28789    if (json.has(prefix+"ClaimResponse"))
28790      return true;
28791    if (json.has(prefix+"ClinicalImpression"))
28792      return true;
28793    if (json.has(prefix+"CodeSystem"))
28794      return true;
28795    if (json.has(prefix+"Communication"))
28796      return true;
28797    if (json.has(prefix+"CommunicationRequest"))
28798      return true;
28799    if (json.has(prefix+"CompartmentDefinition"))
28800      return true;
28801    if (json.has(prefix+"Composition"))
28802      return true;
28803    if (json.has(prefix+"ConceptMap"))
28804      return true;
28805    if (json.has(prefix+"Condition"))
28806      return true;
28807    if (json.has(prefix+"Consent"))
28808      return true;
28809    if (json.has(prefix+"Contract"))
28810      return true;
28811    if (json.has(prefix+"Coverage"))
28812      return true;
28813    if (json.has(prefix+"CoverageEligibilityRequest"))
28814      return true;
28815    if (json.has(prefix+"CoverageEligibilityResponse"))
28816      return true;
28817    if (json.has(prefix+"DetectedIssue"))
28818      return true;
28819    if (json.has(prefix+"Device"))
28820      return true;
28821    if (json.has(prefix+"DeviceDefinition"))
28822      return true;
28823    if (json.has(prefix+"DeviceMetric"))
28824      return true;
28825    if (json.has(prefix+"DeviceRequest"))
28826      return true;
28827    if (json.has(prefix+"DeviceUseStatement"))
28828      return true;
28829    if (json.has(prefix+"DiagnosticReport"))
28830      return true;
28831    if (json.has(prefix+"DocumentManifest"))
28832      return true;
28833    if (json.has(prefix+"DocumentReference"))
28834      return true;
28835    if (json.has(prefix+"EffectEvidenceSynthesis"))
28836      return true;
28837    if (json.has(prefix+"Encounter"))
28838      return true;
28839    if (json.has(prefix+"Endpoint"))
28840      return true;
28841    if (json.has(prefix+"EnrollmentRequest"))
28842      return true;
28843    if (json.has(prefix+"EnrollmentResponse"))
28844      return true;
28845    if (json.has(prefix+"EpisodeOfCare"))
28846      return true;
28847    if (json.has(prefix+"EventDefinition"))
28848      return true;
28849    if (json.has(prefix+"Evidence"))
28850      return true;
28851    if (json.has(prefix+"EvidenceVariable"))
28852      return true;
28853    if (json.has(prefix+"ExampleScenario"))
28854      return true;
28855    if (json.has(prefix+"ExplanationOfBenefit"))
28856      return true;
28857    if (json.has(prefix+"FamilyMemberHistory"))
28858      return true;
28859    if (json.has(prefix+"Flag"))
28860      return true;
28861    if (json.has(prefix+"Goal"))
28862      return true;
28863    if (json.has(prefix+"GraphDefinition"))
28864      return true;
28865    if (json.has(prefix+"Group"))
28866      return true;
28867    if (json.has(prefix+"GuidanceResponse"))
28868      return true;
28869    if (json.has(prefix+"HealthcareService"))
28870      return true;
28871    if (json.has(prefix+"ImagingStudy"))
28872      return true;
28873    if (json.has(prefix+"Immunization"))
28874      return true;
28875    if (json.has(prefix+"ImmunizationEvaluation"))
28876      return true;
28877    if (json.has(prefix+"ImmunizationRecommendation"))
28878      return true;
28879    if (json.has(prefix+"ImplementationGuide"))
28880      return true;
28881    if (json.has(prefix+"InsurancePlan"))
28882      return true;
28883    if (json.has(prefix+"Invoice"))
28884      return true;
28885    if (json.has(prefix+"Library"))
28886      return true;
28887    if (json.has(prefix+"Linkage"))
28888      return true;
28889    if (json.has(prefix+"List"))
28890      return true;
28891    if (json.has(prefix+"Location"))
28892      return true;
28893    if (json.has(prefix+"Measure"))
28894      return true;
28895    if (json.has(prefix+"MeasureReport"))
28896      return true;
28897    if (json.has(prefix+"Media"))
28898      return true;
28899    if (json.has(prefix+"Medication"))
28900      return true;
28901    if (json.has(prefix+"MedicationAdministration"))
28902      return true;
28903    if (json.has(prefix+"MedicationDispense"))
28904      return true;
28905    if (json.has(prefix+"MedicationKnowledge"))
28906      return true;
28907    if (json.has(prefix+"MedicationRequest"))
28908      return true;
28909    if (json.has(prefix+"MedicationStatement"))
28910      return true;
28911    if (json.has(prefix+"MedicinalProduct"))
28912      return true;
28913    if (json.has(prefix+"MedicinalProductAuthorization"))
28914      return true;
28915    if (json.has(prefix+"MedicinalProductContraindication"))
28916      return true;
28917    if (json.has(prefix+"MedicinalProductIndication"))
28918      return true;
28919    if (json.has(prefix+"MedicinalProductIngredient"))
28920      return true;
28921    if (json.has(prefix+"MedicinalProductInteraction"))
28922      return true;
28923    if (json.has(prefix+"MedicinalProductManufactured"))
28924      return true;
28925    if (json.has(prefix+"MedicinalProductPackaged"))
28926      return true;
28927    if (json.has(prefix+"MedicinalProductPharmaceutical"))
28928      return true;
28929    if (json.has(prefix+"MedicinalProductUndesirableEffect"))
28930      return true;
28931    if (json.has(prefix+"MessageDefinition"))
28932      return true;
28933    if (json.has(prefix+"MessageHeader"))
28934      return true;
28935    if (json.has(prefix+"MolecularSequence"))
28936      return true;
28937    if (json.has(prefix+"NamingSystem"))
28938      return true;
28939    if (json.has(prefix+"NutritionOrder"))
28940      return true;
28941    if (json.has(prefix+"Observation"))
28942      return true;
28943    if (json.has(prefix+"ObservationDefinition"))
28944      return true;
28945    if (json.has(prefix+"OperationDefinition"))
28946      return true;
28947    if (json.has(prefix+"OperationOutcome"))
28948      return true;
28949    if (json.has(prefix+"Organization"))
28950      return true;
28951    if (json.has(prefix+"OrganizationAffiliation"))
28952      return true;
28953    if (json.has(prefix+"Patient"))
28954      return true;
28955    if (json.has(prefix+"PaymentNotice"))
28956      return true;
28957    if (json.has(prefix+"PaymentReconciliation"))
28958      return true;
28959    if (json.has(prefix+"Person"))
28960      return true;
28961    if (json.has(prefix+"PlanDefinition"))
28962      return true;
28963    if (json.has(prefix+"Practitioner"))
28964      return true;
28965    if (json.has(prefix+"PractitionerRole"))
28966      return true;
28967    if (json.has(prefix+"Procedure"))
28968      return true;
28969    if (json.has(prefix+"Provenance"))
28970      return true;
28971    if (json.has(prefix+"Questionnaire"))
28972      return true;
28973    if (json.has(prefix+"QuestionnaireResponse"))
28974      return true;
28975    if (json.has(prefix+"RelatedPerson"))
28976      return true;
28977    if (json.has(prefix+"RequestGroup"))
28978      return true;
28979    if (json.has(prefix+"ResearchDefinition"))
28980      return true;
28981    if (json.has(prefix+"ResearchElementDefinition"))
28982      return true;
28983    if (json.has(prefix+"ResearchStudy"))
28984      return true;
28985    if (json.has(prefix+"ResearchSubject"))
28986      return true;
28987    if (json.has(prefix+"RiskAssessment"))
28988      return true;
28989    if (json.has(prefix+"RiskEvidenceSynthesis"))
28990      return true;
28991    if (json.has(prefix+"Schedule"))
28992      return true;
28993    if (json.has(prefix+"SearchParameter"))
28994      return true;
28995    if (json.has(prefix+"ServiceRequest"))
28996      return true;
28997    if (json.has(prefix+"Slot"))
28998      return true;
28999    if (json.has(prefix+"Specimen"))
29000      return true;
29001    if (json.has(prefix+"SpecimenDefinition"))
29002      return true;
29003    if (json.has(prefix+"StructureDefinition"))
29004      return true;
29005    if (json.has(prefix+"StructureMap"))
29006      return true;
29007    if (json.has(prefix+"Subscription"))
29008      return true;
29009    if (json.has(prefix+"Substance"))
29010      return true;
29011    if (json.has(prefix+"SubstanceNucleicAcid"))
29012      return true;
29013    if (json.has(prefix+"SubstancePolymer"))
29014      return true;
29015    if (json.has(prefix+"SubstanceProtein"))
29016      return true;
29017    if (json.has(prefix+"SubstanceReferenceInformation"))
29018      return true;
29019    if (json.has(prefix+"SubstanceSourceMaterial"))
29020      return true;
29021    if (json.has(prefix+"SubstanceSpecification"))
29022      return true;
29023    if (json.has(prefix+"SupplyDelivery"))
29024      return true;
29025    if (json.has(prefix+"SupplyRequest"))
29026      return true;
29027    if (json.has(prefix+"Task"))
29028      return true;
29029    if (json.has(prefix+"TerminologyCapabilities"))
29030      return true;
29031    if (json.has(prefix+"TestReport"))
29032      return true;
29033    if (json.has(prefix+"TestScript"))
29034      return true;
29035    if (json.has(prefix+"ValueSet"))
29036      return true;
29037    if (json.has(prefix+"VerificationResult"))
29038      return true;
29039    if (json.has(prefix+"VisionPrescription"))
29040      return true;
29041    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
29042      return true;
29043    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
29044      return true;
29045    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
29046      return true;
29047    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
29048      return true;
29049    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
29050      return true;
29051    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
29052      return true;
29053    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
29054      return true;
29055    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
29056      return true;
29057    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
29058      return true;
29059    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
29060      return true;
29061    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
29062      return true;
29063    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
29064      return true;
29065    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
29066      return true;
29067    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
29068      return true;
29069    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
29070      return true;
29071    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
29072      return true;
29073    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
29074      return true;
29075    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
29076      return true;
29077    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
29078      return true;
29079    return false;
29080  }
29081
29082  protected Type parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
29083    if (type.equals("ElementDefinition"))
29084      return parseElementDefinition(json);
29085    else if (type.equals("DataRequirement"))
29086      return parseDataRequirement(json);
29087    else
29088      return parseType(json, type);
29089  }
29090
29091  protected void composeElement(Element element) throws IOException {
29092    if (element.hasId())
29093      prop("id", element.getId());
29094      if (makeComments(element)) {
29095        openArray("fhir_comments");
29096        for (String s : element.getFormatCommentsPre())
29097          prop(null,  s);
29098        for (String s : element.getFormatCommentsPost())
29099          prop(null,  s);
29100         closeArray();
29101      }
29102    if (element.hasExtension()) {
29103      openArray("extension");
29104      for (Extension e : element.getExtension())
29105        composeExtension(null, e);
29106      closeArray();
29107    }
29108  }
29109
29110  protected void composeBackboneElementInner(BackboneElement element) throws IOException {
29111    composeBackbone(element);
29112  }
29113
29114  protected void composeBackbone(BackboneElement element) throws IOException {
29115    composeElement(element);
29116    if (element.hasModifierExtension()) {
29117      openArray("modifierExtension");
29118      for (Extension e : element.getModifierExtension())
29119        composeExtension(null, e);
29120      closeArray();
29121    }
29122  }
29123
29124  protected void composeBackbone(BackboneType element) throws IOException {
29125    composeElement(element);
29126    if (element.hasModifierExtension()) {
29127      openArray("modifierExtension");
29128      for (Extension e : element.getModifierExtension())
29129        composeExtension(null, e);
29130      closeArray();
29131    }
29132  }
29133
29134  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
29135    if (value != null && value.getValue() != null) {
29136      prop(name, e.toCode(value.getValue()));
29137    } else if (inArray)   
29138      writeNull(name);
29139  }    
29140
29141  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
29142    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29143      open(inArray ? null : "_"+name);
29144      composeElement(value);
29145      close();
29146    } else if (inArray)   
29147      writeNull(name);
29148  }    
29149
29150  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
29151    if (value != null && value.hasValue()) {
29152        prop(name, value.asStringValue());
29153    }    
29154    else if (inArray) 
29155      writeNull(name); 
29156  }    
29157
29158  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
29159    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29160      open(inArray ? null : "_"+name);
29161      composeElement(value);
29162      close();
29163    }
29164    else if (inArray) 
29165      writeNull(name); 
29166  }
29167
29168  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
29169    if (value != null && value.hasValue()) {
29170        prop(name, value.asStringValue());
29171    }    
29172    else if (inArray) 
29173      writeNull(name); 
29174  }    
29175
29176  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
29177    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29178      open(inArray ? null : "_"+name);
29179      composeElement(value);
29180      close();
29181    }
29182    else if (inArray) 
29183      writeNull(name); 
29184  }
29185
29186  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
29187    if (value != null && value.hasValue()) {
29188        prop(name, toString(value.getValue()));
29189    }    
29190    else if (inArray) 
29191      writeNull(name); 
29192  }    
29193
29194  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
29195    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29196      open(inArray ? null : "_"+name);
29197      composeElement(value);
29198      close();
29199    }
29200    else if (inArray) 
29201      writeNull(name); 
29202  }
29203
29204  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
29205    if (value != null && value.hasValue()) {
29206        prop(name, toString(value.getValue()));
29207    }    
29208    else if (inArray) 
29209      writeNull(name); 
29210  }    
29211
29212  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
29213    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29214      open(inArray ? null : "_"+name);
29215      composeElement(value);
29216      close();
29217    }
29218    else if (inArray) 
29219      writeNull(name); 
29220  }
29221
29222  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
29223    if (value != null && value.hasValue()) {
29224        prop(name, Integer.valueOf(value.getValue()));
29225    }    
29226    else if (inArray) 
29227      writeNull(name); 
29228  }    
29229
29230  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
29231    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29232      open(inArray ? null : "_"+name);
29233      composeElement(value);
29234      close();
29235    }
29236    else if (inArray) 
29237      writeNull(name); 
29238  }
29239
29240  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
29241    if (value != null && value.hasValue()) {
29242        prop(name, toString(value.getValue()));
29243    }    
29244    else if (inArray) 
29245      writeNull(name); 
29246  }    
29247
29248  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
29249    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29250      open(inArray ? null : "_"+name);
29251      composeElement(value);
29252      close();
29253    }
29254    else if (inArray) 
29255      writeNull(name); 
29256  }
29257
29258  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
29259    if (value != null && value.hasValue()) {
29260        prop(name, toString(value.getValue()));
29261    }    
29262    else if (inArray) 
29263      writeNull(name); 
29264  }    
29265
29266  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
29267    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29268      open(inArray ? null : "_"+name);
29269      composeElement(value);
29270      close();
29271    }
29272    else if (inArray) 
29273      writeNull(name); 
29274  }
29275
29276  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
29277    if (value != null && value.hasValue()) {
29278        prop(name, toString(value.getValue()));
29279    }    
29280    else if (inArray) 
29281      writeNull(name); 
29282  }    
29283
29284  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
29285    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29286      open(inArray ? null : "_"+name);
29287      composeElement(value);
29288      close();
29289    }
29290    else if (inArray) 
29291      writeNull(name); 
29292  }
29293
29294  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
29295    if (value != null && value.hasValue()) {
29296        prop(name, toString(value.getValue()));
29297    }    
29298    else if (inArray) 
29299      writeNull(name); 
29300  }    
29301
29302  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
29303    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29304      open(inArray ? null : "_"+name);
29305      composeElement(value);
29306      close();
29307    }
29308    else if (inArray) 
29309      writeNull(name); 
29310  }
29311
29312  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
29313    if (value != null && value.hasValue()) {
29314        prop(name, toString(value.getValue()));
29315    }    
29316    else if (inArray) 
29317      writeNull(name); 
29318  }    
29319
29320  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
29321    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29322      open(inArray ? null : "_"+name);
29323      composeElement(value);
29324      close();
29325    }
29326    else if (inArray) 
29327      writeNull(name); 
29328  }
29329
29330  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
29331    if (value != null && value.hasValue()) {
29332        prop(name, value.asStringValue());
29333    }    
29334    else if (inArray) 
29335      writeNull(name); 
29336  }    
29337
29338  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
29339    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29340      open(inArray ? null : "_"+name);
29341      composeElement(value);
29342      close();
29343    }
29344    else if (inArray) 
29345      writeNull(name); 
29346  }
29347
29348  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
29349    if (value != null && value.hasValue()) {
29350        prop(name, value.getValue());
29351    }    
29352    else if (inArray) 
29353      writeNull(name); 
29354  }    
29355
29356  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
29357    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29358      open(inArray ? null : "_"+name);
29359      composeElement(value);
29360      close();
29361    }
29362    else if (inArray) 
29363      writeNull(name); 
29364  }
29365
29366  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
29367    if (value != null && value.hasValue()) {
29368        prop(name, toString(value.getValue()));
29369    }    
29370    else if (inArray) 
29371      writeNull(name); 
29372  }    
29373
29374  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
29375    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29376      open(inArray ? null : "_"+name);
29377      composeElement(value);
29378      close();
29379    }
29380    else if (inArray) 
29381      writeNull(name); 
29382  }
29383
29384  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
29385    if (value != null && value.hasValue()) {
29386        prop(name, Integer.valueOf(value.getValue()));
29387    }    
29388    else if (inArray) 
29389      writeNull(name); 
29390  }    
29391
29392  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
29393    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29394      open(inArray ? null : "_"+name);
29395      composeElement(value);
29396      close();
29397    }
29398    else if (inArray) 
29399      writeNull(name); 
29400  }
29401
29402  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
29403    if (value != null && value.hasValue()) {
29404        prop(name, toString(value.getValue()));
29405    }    
29406    else if (inArray) 
29407      writeNull(name); 
29408  }    
29409
29410  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
29411    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29412      open(inArray ? null : "_"+name);
29413      composeElement(value);
29414      close();
29415    }
29416    else if (inArray) 
29417      writeNull(name); 
29418  }
29419
29420  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
29421    if (value != null && value.hasValue()) {
29422        prop(name, value.asStringValue());
29423    }    
29424    else if (inArray) 
29425      writeNull(name); 
29426  }    
29427
29428  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
29429    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29430      open(inArray ? null : "_"+name);
29431      composeElement(value);
29432      close();
29433    }
29434    else if (inArray) 
29435      writeNull(name); 
29436  }
29437
29438  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
29439    if (value != null && value.hasValue()) {
29440        prop(name, toString(value.getValue()));
29441    }    
29442    else if (inArray) 
29443      writeNull(name); 
29444  }    
29445
29446  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
29447    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29448      open(inArray ? null : "_"+name);
29449      composeElement(value);
29450      close();
29451    }
29452    else if (inArray) 
29453      writeNull(name); 
29454  }
29455
29456  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
29457    if (value != null && value.hasValue()) {
29458        prop(name, Integer.valueOf(value.getValue()));
29459    }    
29460    else if (inArray) 
29461      writeNull(name); 
29462  }    
29463
29464  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
29465    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29466      open(inArray ? null : "_"+name);
29467      composeElement(value);
29468      close();
29469    }
29470    else if (inArray) 
29471      writeNull(name); 
29472  }
29473
29474  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
29475    if (value != null && value.hasValue()) {
29476        prop(name, value.getValue());
29477    }    
29478    else if (inArray) 
29479      writeNull(name); 
29480  }    
29481
29482  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
29483    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
29484      open(inArray ? null : "_"+name);
29485      composeElement(value);
29486      close();
29487    }
29488    else if (inArray) 
29489      writeNull(name); 
29490  }
29491
29492  protected void composeExtension(String name, Extension element) throws IOException {
29493    if (element != null) {
29494      open(name);
29495      composeExtensionInner(element);
29496      close();
29497    }
29498  }
29499
29500  protected void composeExtensionInner(Extension element) throws IOException {
29501      composeElement(element);
29502      if (element.hasUrlElement()) {
29503        composeUriCore("url", element.getUrlElement(), false);
29504        composeUriExtras("url", element.getUrlElement(), false);
29505      }
29506      if (element.hasValue()) {
29507        composeType("value", element.getValue());
29508      }
29509  }
29510
29511  protected void composeNarrative(String name, Narrative element) throws IOException {
29512    if (element != null) {
29513      open(name);
29514      composeNarrativeInner(element);
29515      close();
29516    }
29517  }
29518
29519  protected void composeNarrativeInner(Narrative element) throws IOException {
29520      composeElement(element);
29521      if (element.hasStatusElement()) {
29522        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
29523        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
29524      }
29525      if (element.hasDiv()) {
29526        XhtmlNode node = element.getDiv();
29527        if (node.getNsDecl() == null) {
29528          node.attribute("xmlns", XHTML_NS);
29529        }
29530        composeXhtml("div", node);
29531      }
29532  }
29533
29534  protected void composeCount(String name, Count element) throws IOException {
29535    if (element != null) {
29536      open(name);
29537      composeCountInner(element);
29538      close();
29539    }
29540  }
29541
29542  protected void composeCountInner(Count element) throws IOException {
29543      composeQuantityInner(element);
29544  }
29545
29546  protected void composeDosage(String name, Dosage element) throws IOException {
29547    if (element != null) {
29548      open(name);
29549      composeDosageInner(element);
29550      close();
29551    }
29552  }
29553
29554  protected void composeDosageInner(Dosage element) throws IOException {
29555      composeBackbone(element);
29556      if (element.hasSequenceElement()) {
29557        composeIntegerCore("sequence", element.getSequenceElement(), false);
29558        composeIntegerExtras("sequence", element.getSequenceElement(), false);
29559      }
29560      if (element.hasTextElement()) {
29561        composeStringCore("text", element.getTextElement(), false);
29562        composeStringExtras("text", element.getTextElement(), false);
29563      }
29564      if (element.hasAdditionalInstruction()) {
29565        openArray("additionalInstruction");
29566        for (CodeableConcept e : element.getAdditionalInstruction()) 
29567          composeCodeableConcept(null, e);
29568        closeArray();
29569      };
29570      if (element.hasPatientInstructionElement()) {
29571        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
29572        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
29573      }
29574      if (element.hasTiming()) {
29575        composeTiming("timing", element.getTiming());
29576      }
29577      if (element.hasAsNeeded()) {
29578        composeType("asNeeded", element.getAsNeeded());
29579      }
29580      if (element.hasSite()) {
29581        composeCodeableConcept("site", element.getSite());
29582      }
29583      if (element.hasRoute()) {
29584        composeCodeableConcept("route", element.getRoute());
29585      }
29586      if (element.hasMethod()) {
29587        composeCodeableConcept("method", element.getMethod());
29588      }
29589      if (element.hasDoseAndRate()) {
29590        openArray("doseAndRate");
29591        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
29592          composeDosageDosageDoseAndRateComponent(null, e);
29593        closeArray();
29594      };
29595      if (element.hasMaxDosePerPeriod()) {
29596        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
29597      }
29598      if (element.hasMaxDosePerAdministration()) {
29599        composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
29600      }
29601      if (element.hasMaxDosePerLifetime()) {
29602        composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
29603      }
29604  }
29605
29606  protected void composeDosageDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
29607    if (element != null) {
29608      open(name);
29609      composeDosageDosageDoseAndRateComponentInner(element);
29610      close();
29611    }
29612  }
29613
29614  protected void composeDosageDosageDoseAndRateComponentInner(Dosage.DosageDoseAndRateComponent element) throws IOException {
29615      composeElement(element);
29616      if (element.hasType()) {
29617        composeCodeableConcept("type", element.getType());
29618      }
29619      if (element.hasDose()) {
29620        composeType("dose", element.getDose());
29621      }
29622      if (element.hasRate()) {
29623        composeType("rate", element.getRate());
29624      }
29625  }
29626
29627  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
29628    if (element != null) {
29629      open(name);
29630      composeMarketingStatusInner(element);
29631      close();
29632    }
29633  }
29634
29635  protected void composeMarketingStatusInner(MarketingStatus element) throws IOException {
29636      composeBackbone(element);
29637      if (element.hasCountry()) {
29638        composeCodeableConcept("country", element.getCountry());
29639      }
29640      if (element.hasJurisdiction()) {
29641        composeCodeableConcept("jurisdiction", element.getJurisdiction());
29642      }
29643      if (element.hasStatus()) {
29644        composeCodeableConcept("status", element.getStatus());
29645      }
29646      if (element.hasDateRange()) {
29647        composePeriod("dateRange", element.getDateRange());
29648      }
29649      if (element.hasRestoreDateElement()) {
29650        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
29651        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
29652      }
29653  }
29654
29655  protected void composeSubstanceAmount(String name, SubstanceAmount element) throws IOException {
29656    if (element != null) {
29657      open(name);
29658      composeSubstanceAmountInner(element);
29659      close();
29660    }
29661  }
29662
29663  protected void composeSubstanceAmountInner(SubstanceAmount element) throws IOException {
29664      composeBackbone(element);
29665      if (element.hasAmount()) {
29666        composeType("amount", element.getAmount());
29667      }
29668      if (element.hasAmountType()) {
29669        composeCodeableConcept("amountType", element.getAmountType());
29670      }
29671      if (element.hasAmountTextElement()) {
29672        composeStringCore("amountText", element.getAmountTextElement(), false);
29673        composeStringExtras("amountText", element.getAmountTextElement(), false);
29674      }
29675      if (element.hasReferenceRange()) {
29676        composeSubstanceAmountSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
29677      }
29678  }
29679
29680  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponent(String name, SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
29681    if (element != null) {
29682      open(name);
29683      composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(element);
29684      close();
29685    }
29686  }
29687
29688  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
29689      composeElement(element);
29690      if (element.hasLowLimit()) {
29691        composeQuantity("lowLimit", element.getLowLimit());
29692      }
29693      if (element.hasHighLimit()) {
29694        composeQuantity("highLimit", element.getHighLimit());
29695      }
29696  }
29697
29698  protected void composePopulation(String name, Population element) throws IOException {
29699    if (element != null) {
29700      open(name);
29701      composePopulationInner(element);
29702      close();
29703    }
29704  }
29705
29706  protected void composePopulationInner(Population element) throws IOException {
29707      composeBackbone(element);
29708      if (element.hasAge()) {
29709        composeType("age", element.getAge());
29710      }
29711      if (element.hasGender()) {
29712        composeCodeableConcept("gender", element.getGender());
29713      }
29714      if (element.hasRace()) {
29715        composeCodeableConcept("race", element.getRace());
29716      }
29717      if (element.hasPhysiologicalCondition()) {
29718        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
29719      }
29720  }
29721
29722  protected void composeDistance(String name, Distance element) throws IOException {
29723    if (element != null) {
29724      open(name);
29725      composeDistanceInner(element);
29726      close();
29727    }
29728  }
29729
29730  protected void composeDistanceInner(Distance element) throws IOException {
29731      composeQuantityInner(element);
29732  }
29733
29734  protected void composeAge(String name, Age element) throws IOException {
29735    if (element != null) {
29736      open(name);
29737      composeAgeInner(element);
29738      close();
29739    }
29740  }
29741
29742  protected void composeAgeInner(Age element) throws IOException {
29743      composeQuantityInner(element);
29744  }
29745
29746  protected void composeDuration(String name, Duration element) throws IOException {
29747    if (element != null) {
29748      open(name);
29749      composeDurationInner(element);
29750      close();
29751    }
29752  }
29753
29754  protected void composeDurationInner(Duration element) throws IOException {
29755      composeQuantityInner(element);
29756  }
29757
29758  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
29759    if (element != null) {
29760      open(name);
29761      composeProductShelfLifeInner(element);
29762      close();
29763    }
29764  }
29765
29766  protected void composeProductShelfLifeInner(ProductShelfLife element) throws IOException {
29767      composeBackbone(element);
29768      if (element.hasIdentifier()) {
29769        composeIdentifier("identifier", element.getIdentifier());
29770      }
29771      if (element.hasType()) {
29772        composeCodeableConcept("type", element.getType());
29773      }
29774      if (element.hasPeriod()) {
29775        composeQuantity("period", element.getPeriod());
29776      }
29777      if (element.hasSpecialPrecautionsForStorage()) {
29778        openArray("specialPrecautionsForStorage");
29779        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
29780          composeCodeableConcept(null, e);
29781        closeArray();
29782      };
29783  }
29784
29785  protected void composeTiming(String name, Timing element) throws IOException {
29786    if (element != null) {
29787      open(name);
29788      composeTimingInner(element);
29789      close();
29790    }
29791  }
29792
29793  protected void composeTimingInner(Timing element) throws IOException {
29794      composeBackbone(element);
29795      if (element.hasEvent()) {
29796        openArray("event");
29797        for (DateTimeType e : element.getEvent()) 
29798          composeDateTimeCore(null, e, true);
29799        closeArray();
29800        if (anyHasExtras(element.getEvent())) {
29801          openArray("_event");
29802          for (DateTimeType e : element.getEvent()) 
29803            composeDateTimeExtras(null, e, true);
29804          closeArray();
29805        }
29806      };
29807      if (element.hasRepeat()) {
29808        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
29809      }
29810      if (element.hasCode()) {
29811        composeCodeableConcept("code", element.getCode());
29812      }
29813  }
29814
29815  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
29816    if (element != null) {
29817      open(name);
29818      composeTimingTimingRepeatComponentInner(element);
29819      close();
29820    }
29821  }
29822
29823  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
29824      composeElement(element);
29825      if (element.hasBounds()) {
29826        composeType("bounds", element.getBounds());
29827      }
29828      if (element.hasCountElement()) {
29829        composePositiveIntCore("count", element.getCountElement(), false);
29830        composePositiveIntExtras("count", element.getCountElement(), false);
29831      }
29832      if (element.hasCountMaxElement()) {
29833        composePositiveIntCore("countMax", element.getCountMaxElement(), false);
29834        composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
29835      }
29836      if (element.hasDurationElement()) {
29837        composeDecimalCore("duration", element.getDurationElement(), false);
29838        composeDecimalExtras("duration", element.getDurationElement(), false);
29839      }
29840      if (element.hasDurationMaxElement()) {
29841        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
29842        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
29843      }
29844      if (element.hasDurationUnitElement()) {
29845        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29846        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29847      }
29848      if (element.hasFrequencyElement()) {
29849        composePositiveIntCore("frequency", element.getFrequencyElement(), false);
29850        composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
29851      }
29852      if (element.hasFrequencyMaxElement()) {
29853        composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
29854        composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
29855      }
29856      if (element.hasPeriodElement()) {
29857        composeDecimalCore("period", element.getPeriodElement(), false);
29858        composeDecimalExtras("period", element.getPeriodElement(), false);
29859      }
29860      if (element.hasPeriodMaxElement()) {
29861        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
29862        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
29863      }
29864      if (element.hasPeriodUnitElement()) {
29865        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29866        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29867      }
29868      if (element.hasDayOfWeek()) {
29869        openArray("dayOfWeek");
29870        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
29871          composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
29872        closeArray();
29873        if (anyHasExtras(element.getDayOfWeek())) {
29874          openArray("_dayOfWeek");
29875          for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
29876            composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
29877          closeArray();
29878        }
29879      };
29880      if (element.hasTimeOfDay()) {
29881        openArray("timeOfDay");
29882        for (TimeType e : element.getTimeOfDay()) 
29883          composeTimeCore(null, e, true);
29884        closeArray();
29885        if (anyHasExtras(element.getTimeOfDay())) {
29886          openArray("_timeOfDay");
29887          for (TimeType e : element.getTimeOfDay()) 
29888            composeTimeExtras(null, e, true);
29889          closeArray();
29890        }
29891      };
29892      if (element.hasWhen()) {
29893        openArray("when");
29894        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
29895          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
29896        closeArray();
29897        if (anyHasExtras(element.getWhen())) {
29898          openArray("_when");
29899          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
29900            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
29901          closeArray();
29902        }
29903      };
29904      if (element.hasOffsetElement()) {
29905        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
29906        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
29907      }
29908  }
29909
29910  protected void composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
29911    if (element != null) {
29912      open(name);
29913      composeProdCharacteristicInner(element);
29914      close();
29915    }
29916  }
29917
29918  protected void composeProdCharacteristicInner(ProdCharacteristic element) throws IOException {
29919      composeBackbone(element);
29920      if (element.hasHeight()) {
29921        composeQuantity("height", element.getHeight());
29922      }
29923      if (element.hasWidth()) {
29924        composeQuantity("width", element.getWidth());
29925      }
29926      if (element.hasDepth()) {
29927        composeQuantity("depth", element.getDepth());
29928      }
29929      if (element.hasWeight()) {
29930        composeQuantity("weight", element.getWeight());
29931      }
29932      if (element.hasNominalVolume()) {
29933        composeQuantity("nominalVolume", element.getNominalVolume());
29934      }
29935      if (element.hasExternalDiameter()) {
29936        composeQuantity("externalDiameter", element.getExternalDiameter());
29937      }
29938      if (element.hasShapeElement()) {
29939        composeStringCore("shape", element.getShapeElement(), false);
29940        composeStringExtras("shape", element.getShapeElement(), false);
29941      }
29942      if (element.hasColor()) {
29943        openArray("color");
29944        for (StringType e : element.getColor()) 
29945          composeStringCore(null, e, true);
29946        closeArray();
29947        if (anyHasExtras(element.getColor())) {
29948          openArray("_color");
29949          for (StringType e : element.getColor()) 
29950            composeStringExtras(null, e, true);
29951          closeArray();
29952        }
29953      };
29954      if (element.hasImprint()) {
29955        openArray("imprint");
29956        for (StringType e : element.getImprint()) 
29957          composeStringCore(null, e, true);
29958        closeArray();
29959        if (anyHasExtras(element.getImprint())) {
29960          openArray("_imprint");
29961          for (StringType e : element.getImprint()) 
29962            composeStringExtras(null, e, true);
29963          closeArray();
29964        }
29965      };
29966      if (element.hasImage()) {
29967        openArray("image");
29968        for (Attachment e : element.getImage()) 
29969          composeAttachment(null, e);
29970        closeArray();
29971      };
29972      if (element.hasScoring()) {
29973        composeCodeableConcept("scoring", element.getScoring());
29974      }
29975  }
29976
29977  protected void composeMeta(String name, Meta element) throws IOException {
29978    if (element != null) {
29979      open(name);
29980      composeMetaInner(element);
29981      close();
29982    }
29983  }
29984
29985  protected void composeMetaInner(Meta element) throws IOException {
29986      composeElement(element);
29987      if (element.hasVersionIdElement()) {
29988        composeIdCore("versionId", element.getVersionIdElement(), false);
29989        composeIdExtras("versionId", element.getVersionIdElement(), false);
29990      }
29991      if (element.hasLastUpdatedElement()) {
29992        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
29993        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
29994      }
29995      if (element.hasSourceElement()) {
29996        composeUriCore("source", element.getSourceElement(), false);
29997        composeUriExtras("source", element.getSourceElement(), false);
29998      }
29999      if (element.hasProfile()) {
30000        openArray("profile");
30001        for (CanonicalType e : element.getProfile()) 
30002          composeCanonicalCore(null, e, true);
30003        closeArray();
30004        if (anyHasExtras(element.getProfile())) {
30005          openArray("_profile");
30006          for (CanonicalType e : element.getProfile()) 
30007            composeCanonicalExtras(null, e, true);
30008          closeArray();
30009        }
30010      };
30011      if (element.hasSecurity()) {
30012        openArray("security");
30013        for (Coding e : element.getSecurity()) 
30014          composeCoding(null, e);
30015        closeArray();
30016      };
30017      if (element.hasTag()) {
30018        openArray("tag");
30019        for (Coding e : element.getTag()) 
30020          composeCoding(null, e);
30021        closeArray();
30022      };
30023  }
30024
30025  protected void composeAddress(String name, Address element) throws IOException {
30026    if (element != null) {
30027      open(name);
30028      composeAddressInner(element);
30029      close();
30030    }
30031  }
30032
30033  protected void composeAddressInner(Address element) throws IOException {
30034      composeElement(element);
30035      if (element.hasUseElement()) {
30036        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
30037        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
30038      }
30039      if (element.hasTypeElement()) {
30040        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
30041        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
30042      }
30043      if (element.hasTextElement()) {
30044        composeStringCore("text", element.getTextElement(), false);
30045        composeStringExtras("text", element.getTextElement(), false);
30046      }
30047      if (element.hasLine()) {
30048        openArray("line");
30049        for (StringType e : element.getLine()) 
30050          composeStringCore(null, e, true);
30051        closeArray();
30052        if (anyHasExtras(element.getLine())) {
30053          openArray("_line");
30054          for (StringType e : element.getLine()) 
30055            composeStringExtras(null, e, true);
30056          closeArray();
30057        }
30058      };
30059      if (element.hasCityElement()) {
30060        composeStringCore("city", element.getCityElement(), false);
30061        composeStringExtras("city", element.getCityElement(), false);
30062      }
30063      if (element.hasDistrictElement()) {
30064        composeStringCore("district", element.getDistrictElement(), false);
30065        composeStringExtras("district", element.getDistrictElement(), false);
30066      }
30067      if (element.hasStateElement()) {
30068        composeStringCore("state", element.getStateElement(), false);
30069        composeStringExtras("state", element.getStateElement(), false);
30070      }
30071      if (element.hasPostalCodeElement()) {
30072        composeStringCore("postalCode", element.getPostalCodeElement(), false);
30073        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
30074      }
30075      if (element.hasCountryElement()) {
30076        composeStringCore("country", element.getCountryElement(), false);
30077        composeStringExtras("country", element.getCountryElement(), false);
30078      }
30079      if (element.hasPeriod()) {
30080        composePeriod("period", element.getPeriod());
30081      }
30082  }
30083
30084  protected void composeContributor(String name, Contributor element) throws IOException {
30085    if (element != null) {
30086      open(name);
30087      composeContributorInner(element);
30088      close();
30089    }
30090  }
30091
30092  protected void composeContributorInner(Contributor element) throws IOException {
30093      composeElement(element);
30094      if (element.hasTypeElement()) {
30095        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
30096        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
30097      }
30098      if (element.hasNameElement()) {
30099        composeStringCore("name", element.getNameElement(), false);
30100        composeStringExtras("name", element.getNameElement(), false);
30101      }
30102      if (element.hasContact()) {
30103        openArray("contact");
30104        for (ContactDetail e : element.getContact()) 
30105          composeContactDetail(null, e);
30106        closeArray();
30107      };
30108  }
30109
30110  protected void composeAttachment(String name, Attachment element) throws IOException {
30111    if (element != null) {
30112      open(name);
30113      composeAttachmentInner(element);
30114      close();
30115    }
30116  }
30117
30118  protected void composeAttachmentInner(Attachment element) throws IOException {
30119      composeElement(element);
30120      if (element.hasContentTypeElement()) {
30121        composeCodeCore("contentType", element.getContentTypeElement(), false);
30122        composeCodeExtras("contentType", element.getContentTypeElement(), false);
30123      }
30124      if (element.hasLanguageElement()) {
30125        composeCodeCore("language", element.getLanguageElement(), false);
30126        composeCodeExtras("language", element.getLanguageElement(), false);
30127      }
30128      if (element.hasDataElement()) {
30129        composeBase64BinaryCore("data", element.getDataElement(), false);
30130        composeBase64BinaryExtras("data", element.getDataElement(), false);
30131      }
30132      if (element.hasUrlElement()) {
30133        composeUrlCore("url", element.getUrlElement(), false);
30134        composeUrlExtras("url", element.getUrlElement(), false);
30135      }
30136      if (element.hasSizeElement()) {
30137        composeUnsignedIntCore("size", element.getSizeElement(), false);
30138        composeUnsignedIntExtras("size", element.getSizeElement(), false);
30139      }
30140      if (element.hasHashElement()) {
30141        composeBase64BinaryCore("hash", element.getHashElement(), false);
30142        composeBase64BinaryExtras("hash", element.getHashElement(), false);
30143      }
30144      if (element.hasTitleElement()) {
30145        composeStringCore("title", element.getTitleElement(), false);
30146        composeStringExtras("title", element.getTitleElement(), false);
30147      }
30148      if (element.hasCreationElement()) {
30149        composeDateTimeCore("creation", element.getCreationElement(), false);
30150        composeDateTimeExtras("creation", element.getCreationElement(), false);
30151      }
30152  }
30153
30154  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
30155    if (element != null) {
30156      open(name);
30157      composeDataRequirementInner(element);
30158      close();
30159    }
30160  }
30161
30162  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
30163      composeElement(element);
30164      if (element.hasTypeElement()) {
30165        composeCodeCore("type", element.getTypeElement(), false);
30166        composeCodeExtras("type", element.getTypeElement(), false);
30167      }
30168      if (element.hasProfile()) {
30169        openArray("profile");
30170        for (CanonicalType e : element.getProfile()) 
30171          composeCanonicalCore(null, e, true);
30172        closeArray();
30173        if (anyHasExtras(element.getProfile())) {
30174          openArray("_profile");
30175          for (CanonicalType e : element.getProfile()) 
30176            composeCanonicalExtras(null, e, true);
30177          closeArray();
30178        }
30179      };
30180      if (element.hasSubject()) {
30181        composeType("subject", element.getSubject());
30182      }
30183      if (element.hasMustSupport()) {
30184        openArray("mustSupport");
30185        for (StringType e : element.getMustSupport()) 
30186          composeStringCore(null, e, true);
30187        closeArray();
30188        if (anyHasExtras(element.getMustSupport())) {
30189          openArray("_mustSupport");
30190          for (StringType e : element.getMustSupport()) 
30191            composeStringExtras(null, e, true);
30192          closeArray();
30193        }
30194      };
30195      if (element.hasCodeFilter()) {
30196        openArray("codeFilter");
30197        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
30198          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
30199        closeArray();
30200      };
30201      if (element.hasDateFilter()) {
30202        openArray("dateFilter");
30203        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
30204          composeDataRequirementDataRequirementDateFilterComponent(null, e);
30205        closeArray();
30206      };
30207      if (element.hasLimitElement()) {
30208        composePositiveIntCore("limit", element.getLimitElement(), false);
30209        composePositiveIntExtras("limit", element.getLimitElement(), false);
30210      }
30211      if (element.hasSort()) {
30212        openArray("sort");
30213        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
30214          composeDataRequirementDataRequirementSortComponent(null, e);
30215        closeArray();
30216      };
30217  }
30218
30219  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
30220    if (element != null) {
30221      open(name);
30222      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
30223      close();
30224    }
30225  }
30226
30227  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
30228      composeElement(element);
30229      if (element.hasPathElement()) {
30230        composeStringCore("path", element.getPathElement(), false);
30231        composeStringExtras("path", element.getPathElement(), false);
30232      }
30233      if (element.hasSearchParamElement()) {
30234        composeStringCore("searchParam", element.getSearchParamElement(), false);
30235        composeStringExtras("searchParam", element.getSearchParamElement(), false);
30236      }
30237      if (element.hasValueSetElement()) {
30238        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
30239        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
30240      }
30241      if (element.hasCode()) {
30242        openArray("code");
30243        for (Coding e : element.getCode()) 
30244          composeCoding(null, e);
30245        closeArray();
30246      };
30247  }
30248
30249  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
30250    if (element != null) {
30251      open(name);
30252      composeDataRequirementDataRequirementDateFilterComponentInner(element);
30253      close();
30254    }
30255  }
30256
30257  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
30258      composeElement(element);
30259      if (element.hasPathElement()) {
30260        composeStringCore("path", element.getPathElement(), false);
30261        composeStringExtras("path", element.getPathElement(), false);
30262      }
30263      if (element.hasSearchParamElement()) {
30264        composeStringCore("searchParam", element.getSearchParamElement(), false);
30265        composeStringExtras("searchParam", element.getSearchParamElement(), false);
30266      }
30267      if (element.hasValue()) {
30268        composeType("value", element.getValue());
30269      }
30270  }
30271
30272  protected void composeDataRequirementDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
30273    if (element != null) {
30274      open(name);
30275      composeDataRequirementDataRequirementSortComponentInner(element);
30276      close();
30277    }
30278  }
30279
30280  protected void composeDataRequirementDataRequirementSortComponentInner(DataRequirement.DataRequirementSortComponent element) throws IOException {
30281      composeElement(element);
30282      if (element.hasPathElement()) {
30283        composeStringCore("path", element.getPathElement(), false);
30284        composeStringExtras("path", element.getPathElement(), false);
30285      }
30286      if (element.hasDirectionElement()) {
30287        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
30288        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
30289      }
30290  }
30291
30292  protected void composeMoney(String name, Money element) throws IOException {
30293    if (element != null) {
30294      open(name);
30295      composeMoneyInner(element);
30296      close();
30297    }
30298  }
30299
30300  protected void composeMoneyInner(Money element) throws IOException {
30301      composeElement(element);
30302      if (element.hasValueElement()) {
30303        composeDecimalCore("value", element.getValueElement(), false);
30304        composeDecimalExtras("value", element.getValueElement(), false);
30305      }
30306      if (element.hasCurrencyElement()) {
30307        composeCodeCore("currency", element.getCurrencyElement(), false);
30308        composeCodeExtras("currency", element.getCurrencyElement(), false);
30309      }
30310  }
30311
30312  protected void composeHumanName(String name, HumanName element) throws IOException {
30313    if (element != null) {
30314      open(name);
30315      composeHumanNameInner(element);
30316      close();
30317    }
30318  }
30319
30320  protected void composeHumanNameInner(HumanName element) throws IOException {
30321      composeElement(element);
30322      if (element.hasUseElement()) {
30323        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
30324        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
30325      }
30326      if (element.hasTextElement()) {
30327        composeStringCore("text", element.getTextElement(), false);
30328        composeStringExtras("text", element.getTextElement(), false);
30329      }
30330      if (element.hasFamilyElement()) {
30331        composeStringCore("family", element.getFamilyElement(), false);
30332        composeStringExtras("family", element.getFamilyElement(), false);
30333      }
30334      if (element.hasGiven()) {
30335        openArray("given");
30336        for (StringType e : element.getGiven()) 
30337          composeStringCore(null, e, true);
30338        closeArray();
30339        if (anyHasExtras(element.getGiven())) {
30340          openArray("_given");
30341          for (StringType e : element.getGiven()) 
30342            composeStringExtras(null, e, true);
30343          closeArray();
30344        }
30345      };
30346      if (element.hasPrefix()) {
30347        openArray("prefix");
30348        for (StringType e : element.getPrefix()) 
30349          composeStringCore(null, e, true);
30350        closeArray();
30351        if (anyHasExtras(element.getPrefix())) {
30352          openArray("_prefix");
30353          for (StringType e : element.getPrefix()) 
30354            composeStringExtras(null, e, true);
30355          closeArray();
30356        }
30357      };
30358      if (element.hasSuffix()) {
30359        openArray("suffix");
30360        for (StringType e : element.getSuffix()) 
30361          composeStringCore(null, e, true);
30362        closeArray();
30363        if (anyHasExtras(element.getSuffix())) {
30364          openArray("_suffix");
30365          for (StringType e : element.getSuffix()) 
30366            composeStringExtras(null, e, true);
30367          closeArray();
30368        }
30369      };
30370      if (element.hasPeriod()) {
30371        composePeriod("period", element.getPeriod());
30372      }
30373  }
30374
30375  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
30376    if (element != null) {
30377      open(name);
30378      composeContactPointInner(element);
30379      close();
30380    }
30381  }
30382
30383  protected void composeContactPointInner(ContactPoint element) throws IOException {
30384      composeElement(element);
30385      if (element.hasSystemElement()) {
30386        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
30387        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
30388      }
30389      if (element.hasValueElement()) {
30390        composeStringCore("value", element.getValueElement(), false);
30391        composeStringExtras("value", element.getValueElement(), false);
30392      }
30393      if (element.hasUseElement()) {
30394        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
30395        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
30396      }
30397      if (element.hasRankElement()) {
30398        composePositiveIntCore("rank", element.getRankElement(), false);
30399        composePositiveIntExtras("rank", element.getRankElement(), false);
30400      }
30401      if (element.hasPeriod()) {
30402        composePeriod("period", element.getPeriod());
30403      }
30404  }
30405
30406  protected void composeIdentifier(String name, Identifier element) throws IOException {
30407    if (element != null) {
30408      open(name);
30409      composeIdentifierInner(element);
30410      close();
30411    }
30412  }
30413
30414  protected void composeIdentifierInner(Identifier element) throws IOException {
30415      composeElement(element);
30416      if (element.hasUseElement()) {
30417        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
30418        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
30419      }
30420      if (element.hasType()) {
30421        composeCodeableConcept("type", element.getType());
30422      }
30423      if (element.hasSystemElement()) {
30424        composeUriCore("system", element.getSystemElement(), false);
30425        composeUriExtras("system", element.getSystemElement(), false);
30426      }
30427      if (element.hasValueElement()) {
30428        composeStringCore("value", element.getValueElement(), false);
30429        composeStringExtras("value", element.getValueElement(), false);
30430      }
30431      if (element.hasPeriod()) {
30432        composePeriod("period", element.getPeriod());
30433      }
30434      if (element.hasAssigner()) {
30435        composeReference("assigner", element.getAssigner());
30436      }
30437  }
30438
30439  protected void composeCoding(String name, Coding element) throws IOException {
30440    if (element != null) {
30441      open(name);
30442      composeCodingInner(element);
30443      close();
30444    }
30445  }
30446
30447  protected void composeCodingInner(Coding element) throws IOException {
30448      composeElement(element);
30449      if (element.hasSystemElement()) {
30450        composeUriCore("system", element.getSystemElement(), false);
30451        composeUriExtras("system", element.getSystemElement(), false);
30452      }
30453      if (element.hasVersionElement()) {
30454        composeStringCore("version", element.getVersionElement(), false);
30455        composeStringExtras("version", element.getVersionElement(), false);
30456      }
30457      if (element.hasCodeElement()) {
30458        composeCodeCore("code", element.getCodeElement(), false);
30459        composeCodeExtras("code", element.getCodeElement(), false);
30460      }
30461      if (element.hasDisplayElement()) {
30462        composeStringCore("display", element.getDisplayElement(), false);
30463        composeStringExtras("display", element.getDisplayElement(), false);
30464      }
30465      if (element.hasUserSelectedElement()) {
30466        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
30467        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
30468      }
30469  }
30470
30471  protected void composeSampledData(String name, SampledData element) throws IOException {
30472    if (element != null) {
30473      open(name);
30474      composeSampledDataInner(element);
30475      close();
30476    }
30477  }
30478
30479  protected void composeSampledDataInner(SampledData element) throws IOException {
30480      composeElement(element);
30481      if (element.hasOrigin()) {
30482        composeQuantity("origin", element.getOrigin());
30483      }
30484      if (element.hasPeriodElement()) {
30485        composeDecimalCore("period", element.getPeriodElement(), false);
30486        composeDecimalExtras("period", element.getPeriodElement(), false);
30487      }
30488      if (element.hasFactorElement()) {
30489        composeDecimalCore("factor", element.getFactorElement(), false);
30490        composeDecimalExtras("factor", element.getFactorElement(), false);
30491      }
30492      if (element.hasLowerLimitElement()) {
30493        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
30494        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
30495      }
30496      if (element.hasUpperLimitElement()) {
30497        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
30498        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
30499      }
30500      if (element.hasDimensionsElement()) {
30501        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
30502        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
30503      }
30504      if (element.hasDataElement()) {
30505        composeStringCore("data", element.getDataElement(), false);
30506        composeStringExtras("data", element.getDataElement(), false);
30507      }
30508  }
30509
30510  protected void composeRatio(String name, Ratio element) throws IOException {
30511    if (element != null) {
30512      open(name);
30513      composeRatioInner(element);
30514      close();
30515    }
30516  }
30517
30518  protected void composeRatioInner(Ratio element) throws IOException {
30519      composeElement(element);
30520      if (element.hasNumerator()) {
30521        composeQuantity("numerator", element.getNumerator());
30522      }
30523      if (element.hasDenominator()) {
30524        composeQuantity("denominator", element.getDenominator());
30525      }
30526  }
30527
30528  protected void composeReference(String name, Reference element) throws IOException {
30529    if (element != null) {
30530      open(name);
30531      composeReferenceInner(element);
30532      close();
30533    }
30534  }
30535
30536  protected void composeReferenceInner(Reference element) throws IOException {
30537      composeElement(element);
30538      if (element.hasReferenceElement()) {
30539        composeStringCore("reference", element.getReferenceElement(), false);
30540        composeStringExtras("reference", element.getReferenceElement(), false);
30541      }
30542      if (element.hasTypeElement()) {
30543        composeUriCore("type", element.getTypeElement(), false);
30544        composeUriExtras("type", element.getTypeElement(), false);
30545      }
30546      if (element.hasIdentifier()) {
30547        composeIdentifier("identifier", element.getIdentifier());
30548      }
30549      if (element.hasDisplayElement()) {
30550        composeStringCore("display", element.getDisplayElement(), false);
30551        composeStringExtras("display", element.getDisplayElement(), false);
30552      }
30553  }
30554
30555  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
30556    if (element != null) {
30557      open(name);
30558      composeTriggerDefinitionInner(element);
30559      close();
30560    }
30561  }
30562
30563  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
30564      composeElement(element);
30565      if (element.hasTypeElement()) {
30566        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
30567        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
30568      }
30569      if (element.hasNameElement()) {
30570        composeStringCore("name", element.getNameElement(), false);
30571        composeStringExtras("name", element.getNameElement(), false);
30572      }
30573      if (element.hasTiming()) {
30574        composeType("timing", element.getTiming());
30575      }
30576      if (element.hasData()) {
30577        openArray("data");
30578        for (DataRequirement e : element.getData()) 
30579          composeDataRequirement(null, e);
30580        closeArray();
30581      };
30582      if (element.hasCondition()) {
30583        composeExpression("condition", element.getCondition());
30584      }
30585  }
30586
30587  protected void composeQuantity(String name, Quantity element) throws IOException {
30588    if (element != null) {
30589      open(name);
30590      composeQuantityInner(element);
30591      close();
30592    }
30593  }
30594
30595  protected void composeQuantityInner(Quantity element) throws IOException {
30596      composeElement(element);
30597      if (element.hasValueElement()) {
30598        composeDecimalCore("value", element.getValueElement(), false);
30599        composeDecimalExtras("value", element.getValueElement(), false);
30600      }
30601      if (element.hasComparatorElement()) {
30602        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
30603        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
30604      }
30605      if (element.hasUnitElement()) {
30606        composeStringCore("unit", element.getUnitElement(), false);
30607        composeStringExtras("unit", element.getUnitElement(), false);
30608      }
30609      if (element.hasSystemElement()) {
30610        composeUriCore("system", element.getSystemElement(), false);
30611        composeUriExtras("system", element.getSystemElement(), false);
30612      }
30613      if (element.hasCodeElement()) {
30614        composeCodeCore("code", element.getCodeElement(), false);
30615        composeCodeExtras("code", element.getCodeElement(), false);
30616      }
30617  }
30618
30619  protected void composePeriod(String name, Period element) throws IOException {
30620    if (element != null) {
30621      open(name);
30622      composePeriodInner(element);
30623      close();
30624    }
30625  }
30626
30627  protected void composePeriodInner(Period element) throws IOException {
30628      composeElement(element);
30629      if (element.hasStartElement()) {
30630        composeDateTimeCore("start", element.getStartElement(), false);
30631        composeDateTimeExtras("start", element.getStartElement(), false);
30632      }
30633      if (element.hasEndElement()) {
30634        composeDateTimeCore("end", element.getEndElement(), false);
30635        composeDateTimeExtras("end", element.getEndElement(), false);
30636      }
30637  }
30638
30639  protected void composeRange(String name, Range element) throws IOException {
30640    if (element != null) {
30641      open(name);
30642      composeRangeInner(element);
30643      close();
30644    }
30645  }
30646
30647  protected void composeRangeInner(Range element) throws IOException {
30648      composeElement(element);
30649      if (element.hasLow()) {
30650        composeQuantity("low", element.getLow());
30651      }
30652      if (element.hasHigh()) {
30653        composeQuantity("high", element.getHigh());
30654      }
30655  }
30656
30657  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
30658    if (element != null) {
30659      open(name);
30660      composeRelatedArtifactInner(element);
30661      close();
30662    }
30663  }
30664
30665  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
30666      composeElement(element);
30667      if (element.hasTypeElement()) {
30668        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
30669        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
30670      }
30671      if (element.hasLabelElement()) {
30672        composeStringCore("label", element.getLabelElement(), false);
30673        composeStringExtras("label", element.getLabelElement(), false);
30674      }
30675      if (element.hasDisplayElement()) {
30676        composeStringCore("display", element.getDisplayElement(), false);
30677        composeStringExtras("display", element.getDisplayElement(), false);
30678      }
30679      if (element.hasCitationElement()) {
30680        composeMarkdownCore("citation", element.getCitationElement(), false);
30681        composeMarkdownExtras("citation", element.getCitationElement(), false);
30682      }
30683      if (element.hasUrlElement()) {
30684        composeUrlCore("url", element.getUrlElement(), false);
30685        composeUrlExtras("url", element.getUrlElement(), false);
30686      }
30687      if (element.hasDocument()) {
30688        composeAttachment("document", element.getDocument());
30689      }
30690      if (element.hasResourceElement()) {
30691        composeCanonicalCore("resource", element.getResourceElement(), false);
30692        composeCanonicalExtras("resource", element.getResourceElement(), false);
30693      }
30694  }
30695
30696  protected void composeAnnotation(String name, Annotation element) throws IOException {
30697    if (element != null) {
30698      open(name);
30699      composeAnnotationInner(element);
30700      close();
30701    }
30702  }
30703
30704  protected void composeAnnotationInner(Annotation element) throws IOException {
30705      composeElement(element);
30706      if (element.hasAuthor()) {
30707        composeType("author", element.getAuthor());
30708      }
30709      if (element.hasTimeElement()) {
30710        composeDateTimeCore("time", element.getTimeElement(), false);
30711        composeDateTimeExtras("time", element.getTimeElement(), false);
30712      }
30713      if (element.hasTextElement()) {
30714        composeMarkdownCore("text", element.getTextElement(), false);
30715        composeMarkdownExtras("text", element.getTextElement(), false);
30716      }
30717  }
30718
30719  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
30720    if (element != null) {
30721      open(name);
30722      composeContactDetailInner(element);
30723      close();
30724    }
30725  }
30726
30727  protected void composeContactDetailInner(ContactDetail element) throws IOException {
30728      composeElement(element);
30729      if (element.hasNameElement()) {
30730        composeStringCore("name", element.getNameElement(), false);
30731        composeStringExtras("name", element.getNameElement(), false);
30732      }
30733      if (element.hasTelecom()) {
30734        openArray("telecom");
30735        for (ContactPoint e : element.getTelecom()) 
30736          composeContactPoint(null, e);
30737        closeArray();
30738      };
30739  }
30740
30741  protected void composeUsageContext(String name, UsageContext element) throws IOException {
30742    if (element != null) {
30743      open(name);
30744      composeUsageContextInner(element);
30745      close();
30746    }
30747  }
30748
30749  protected void composeUsageContextInner(UsageContext element) throws IOException {
30750      composeElement(element);
30751      if (element.hasCode()) {
30752        composeCoding("code", element.getCode());
30753      }
30754      if (element.hasValue()) {
30755        composeType("value", element.getValue());
30756      }
30757  }
30758
30759  protected void composeExpression(String name, Expression element) throws IOException {
30760    if (element != null) {
30761      open(name);
30762      composeExpressionInner(element);
30763      close();
30764    }
30765  }
30766
30767  protected void composeExpressionInner(Expression element) throws IOException {
30768      composeElement(element);
30769      if (element.hasDescriptionElement()) {
30770        composeStringCore("description", element.getDescriptionElement(), false);
30771        composeStringExtras("description", element.getDescriptionElement(), false);
30772      }
30773      if (element.hasNameElement()) {
30774        composeIdCore("name", element.getNameElement(), false);
30775        composeIdExtras("name", element.getNameElement(), false);
30776      }
30777      if (element.hasLanguageElement()) {
30778        composeCodeCore("language", element.getLanguageElement(), false);
30779        composeCodeExtras("language", element.getLanguageElement(), false);
30780      }
30781      if (element.hasExpressionElement()) {
30782        composeStringCore("expression", element.getExpressionElement(), false);
30783        composeStringExtras("expression", element.getExpressionElement(), false);
30784      }
30785      if (element.hasReferenceElement()) {
30786        composeUriCore("reference", element.getReferenceElement(), false);
30787        composeUriExtras("reference", element.getReferenceElement(), false);
30788      }
30789  }
30790
30791  protected void composeSignature(String name, Signature element) throws IOException {
30792    if (element != null) {
30793      open(name);
30794      composeSignatureInner(element);
30795      close();
30796    }
30797  }
30798
30799  protected void composeSignatureInner(Signature element) throws IOException {
30800      composeElement(element);
30801      if (element.hasType()) {
30802        openArray("type");
30803        for (Coding e : element.getType()) 
30804          composeCoding(null, e);
30805        closeArray();
30806      };
30807      if (element.hasWhenElement()) {
30808        composeInstantCore("when", element.getWhenElement(), false);
30809        composeInstantExtras("when", element.getWhenElement(), false);
30810      }
30811      if (element.hasWho()) {
30812        composeReference("who", element.getWho());
30813      }
30814      if (element.hasOnBehalfOf()) {
30815        composeReference("onBehalfOf", element.getOnBehalfOf());
30816      }
30817      if (element.hasTargetFormatElement()) {
30818        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
30819        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
30820      }
30821      if (element.hasSigFormatElement()) {
30822        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
30823        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
30824      }
30825      if (element.hasDataElement()) {
30826        composeBase64BinaryCore("data", element.getDataElement(), false);
30827        composeBase64BinaryExtras("data", element.getDataElement(), false);
30828      }
30829  }
30830
30831  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
30832    if (element != null) {
30833      open(name);
30834      composeCodeableConceptInner(element);
30835      close();
30836    }
30837  }
30838
30839  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
30840      composeElement(element);
30841      if (element.hasCoding()) {
30842        openArray("coding");
30843        for (Coding e : element.getCoding()) 
30844          composeCoding(null, e);
30845        closeArray();
30846      };
30847      if (element.hasTextElement()) {
30848        composeStringCore("text", element.getTextElement(), false);
30849        composeStringExtras("text", element.getTextElement(), false);
30850      }
30851  }
30852
30853  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
30854    if (element != null) {
30855      open(name);
30856      composeParameterDefinitionInner(element);
30857      close();
30858    }
30859  }
30860
30861  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
30862      composeElement(element);
30863      if (element.hasNameElement()) {
30864        composeCodeCore("name", element.getNameElement(), false);
30865        composeCodeExtras("name", element.getNameElement(), false);
30866      }
30867      if (element.hasUseElement()) {
30868        composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
30869        composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
30870      }
30871      if (element.hasMinElement()) {
30872        composeIntegerCore("min", element.getMinElement(), false);
30873        composeIntegerExtras("min", element.getMinElement(), false);
30874      }
30875      if (element.hasMaxElement()) {
30876        composeStringCore("max", element.getMaxElement(), false);
30877        composeStringExtras("max", element.getMaxElement(), false);
30878      }
30879      if (element.hasDocumentationElement()) {
30880        composeStringCore("documentation", element.getDocumentationElement(), false);
30881        composeStringExtras("documentation", element.getDocumentationElement(), false);
30882      }
30883      if (element.hasTypeElement()) {
30884        composeCodeCore("type", element.getTypeElement(), false);
30885        composeCodeExtras("type", element.getTypeElement(), false);
30886      }
30887      if (element.hasProfileElement()) {
30888        composeCanonicalCore("profile", element.getProfileElement(), false);
30889        composeCanonicalExtras("profile", element.getProfileElement(), false);
30890      }
30891  }
30892
30893  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
30894    if (element != null) {
30895      open(name);
30896      composeElementDefinitionInner(element);
30897      close();
30898    }
30899  }
30900
30901  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
30902      composeBackbone(element);
30903      if (element.hasPathElement()) {
30904        composeStringCore("path", element.getPathElement(), false);
30905        composeStringExtras("path", element.getPathElement(), false);
30906      }
30907      if (element.hasRepresentation()) {
30908        openArray("representation");
30909        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
30910          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
30911        closeArray();
30912        if (anyHasExtras(element.getRepresentation())) {
30913          openArray("_representation");
30914          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
30915            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
30916          closeArray();
30917        }
30918      };
30919      if (element.hasSliceNameElement()) {
30920        composeStringCore("sliceName", element.getSliceNameElement(), false);
30921        composeStringExtras("sliceName", element.getSliceNameElement(), false);
30922      }
30923      if (element.hasSliceIsConstrainingElement()) {
30924        composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
30925        composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
30926      }
30927      if (element.hasLabelElement()) {
30928        composeStringCore("label", element.getLabelElement(), false);
30929        composeStringExtras("label", element.getLabelElement(), false);
30930      }
30931      if (element.hasCode()) {
30932        openArray("code");
30933        for (Coding e : element.getCode()) 
30934          composeCoding(null, e);
30935        closeArray();
30936      };
30937      if (element.hasSlicing()) {
30938        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
30939      }
30940      if (element.hasShortElement()) {
30941        composeStringCore("short", element.getShortElement(), false);
30942        composeStringExtras("short", element.getShortElement(), false);
30943      }
30944      if (element.hasDefinitionElement()) {
30945        composeMarkdownCore("definition", element.getDefinitionElement(), false);
30946        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
30947      }
30948      if (element.hasCommentElement()) {
30949        composeMarkdownCore("comment", element.getCommentElement(), false);
30950        composeMarkdownExtras("comment", element.getCommentElement(), false);
30951      }
30952      if (element.hasRequirementsElement()) {
30953        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
30954        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
30955      }
30956      if (element.hasAlias()) {
30957        openArray("alias");
30958        for (StringType e : element.getAlias()) 
30959          composeStringCore(null, e, true);
30960        closeArray();
30961        if (anyHasExtras(element.getAlias())) {
30962          openArray("_alias");
30963          for (StringType e : element.getAlias()) 
30964            composeStringExtras(null, e, true);
30965          closeArray();
30966        }
30967      };
30968      if (element.hasMinElement()) {
30969        composeUnsignedIntCore("min", element.getMinElement(), false);
30970        composeUnsignedIntExtras("min", element.getMinElement(), false);
30971      }
30972      if (element.hasMaxElement()) {
30973        composeStringCore("max", element.getMaxElement(), false);
30974        composeStringExtras("max", element.getMaxElement(), false);
30975      }
30976      if (element.hasBase()) {
30977        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
30978      }
30979      if (element.hasContentReferenceElement()) {
30980        composeUriCore("contentReference", element.getContentReferenceElement(), false);
30981        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
30982      }
30983      if (element.hasType()) {
30984        openArray("type");
30985        for (ElementDefinition.TypeRefComponent e : element.getType()) 
30986          composeElementDefinitionTypeRefComponent(null, e);
30987        closeArray();
30988      };
30989      if (element.hasDefaultValue()) {
30990        composeType("defaultValue", element.getDefaultValue());
30991      }
30992      if (element.hasMeaningWhenMissingElement()) {
30993        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
30994        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
30995      }
30996      if (element.hasOrderMeaningElement()) {
30997        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
30998        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
30999      }
31000      if (element.hasFixed()) {
31001        composeType("fixed", element.getFixed());
31002      }
31003      if (element.hasPattern()) {
31004        composeType("pattern", element.getPattern());
31005      }
31006      if (element.hasExample()) {
31007        openArray("example");
31008        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
31009          composeElementDefinitionElementDefinitionExampleComponent(null, e);
31010        closeArray();
31011      };
31012      if (element.hasMinValue()) {
31013        composeType("minValue", element.getMinValue());
31014      }
31015      if (element.hasMaxValue()) {
31016        composeType("maxValue", element.getMaxValue());
31017      }
31018      if (element.hasMaxLengthElement()) {
31019        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
31020        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
31021      }
31022      if (element.hasCondition()) {
31023        openArray("condition");
31024        for (IdType e : element.getCondition()) 
31025          composeIdCore(null, e, true);
31026        closeArray();
31027        if (anyHasExtras(element.getCondition())) {
31028          openArray("_condition");
31029          for (IdType e : element.getCondition()) 
31030            composeIdExtras(null, e, true);
31031          closeArray();
31032        }
31033      };
31034      if (element.hasConstraint()) {
31035        openArray("constraint");
31036        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
31037          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
31038        closeArray();
31039      };
31040      if (element.hasMustSupportElement()) {
31041        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
31042        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
31043      }
31044      if (element.hasIsModifierElement()) {
31045        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
31046        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
31047      }
31048      if (element.hasIsModifierReasonElement()) {
31049        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
31050        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
31051      }
31052      if (element.hasIsSummaryElement()) {
31053        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
31054        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
31055      }
31056      if (element.hasBinding()) {
31057        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
31058      }
31059      if (element.hasMapping()) {
31060        openArray("mapping");
31061        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
31062          composeElementDefinitionElementDefinitionMappingComponent(null, e);
31063        closeArray();
31064      };
31065  }
31066
31067  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
31068    if (element != null) {
31069      open(name);
31070      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
31071      close();
31072    }
31073  }
31074
31075  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
31076      composeElement(element);
31077      if (element.hasDiscriminator()) {
31078        openArray("discriminator");
31079        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
31080          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
31081        closeArray();
31082      };
31083      if (element.hasDescriptionElement()) {
31084        composeStringCore("description", element.getDescriptionElement(), false);
31085        composeStringExtras("description", element.getDescriptionElement(), false);
31086      }
31087      if (element.hasOrderedElement()) {
31088        composeBooleanCore("ordered", element.getOrderedElement(), false);
31089        composeBooleanExtras("ordered", element.getOrderedElement(), false);
31090      }
31091      if (element.hasRulesElement()) {
31092        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
31093        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
31094      }
31095  }
31096
31097  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
31098    if (element != null) {
31099      open(name);
31100      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
31101      close();
31102    }
31103  }
31104
31105  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
31106      composeElement(element);
31107      if (element.hasTypeElement()) {
31108        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
31109        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
31110      }
31111      if (element.hasPathElement()) {
31112        composeStringCore("path", element.getPathElement(), false);
31113        composeStringExtras("path", element.getPathElement(), false);
31114      }
31115  }
31116
31117  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
31118    if (element != null) {
31119      open(name);
31120      composeElementDefinitionElementDefinitionBaseComponentInner(element);
31121      close();
31122    }
31123  }
31124
31125  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
31126      composeElement(element);
31127      if (element.hasPathElement()) {
31128        composeStringCore("path", element.getPathElement(), false);
31129        composeStringExtras("path", element.getPathElement(), false);
31130      }
31131      if (element.hasMinElement()) {
31132        composeUnsignedIntCore("min", element.getMinElement(), false);
31133        composeUnsignedIntExtras("min", element.getMinElement(), false);
31134      }
31135      if (element.hasMaxElement()) {
31136        composeStringCore("max", element.getMaxElement(), false);
31137        composeStringExtras("max", element.getMaxElement(), false);
31138      }
31139  }
31140
31141  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
31142    if (element != null) {
31143      open(name);
31144      composeElementDefinitionTypeRefComponentInner(element);
31145      close();
31146    }
31147  }
31148
31149  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
31150      composeElement(element);
31151      if (element.hasCodeElement()) {
31152        composeUriCore("code", element.getCodeElement(), false);
31153        composeUriExtras("code", element.getCodeElement(), false);
31154      }
31155      if (element.hasProfile()) {
31156        openArray("profile");
31157        for (CanonicalType e : element.getProfile()) 
31158          composeCanonicalCore(null, e, true);
31159        closeArray();
31160        if (anyHasExtras(element.getProfile())) {
31161          openArray("_profile");
31162          for (CanonicalType e : element.getProfile()) 
31163            composeCanonicalExtras(null, e, true);
31164          closeArray();
31165        }
31166      };
31167      if (element.hasTargetProfile()) {
31168        openArray("targetProfile");
31169        for (CanonicalType e : element.getTargetProfile()) 
31170          composeCanonicalCore(null, e, true);
31171        closeArray();
31172        if (anyHasExtras(element.getTargetProfile())) {
31173          openArray("_targetProfile");
31174          for (CanonicalType e : element.getTargetProfile()) 
31175            composeCanonicalExtras(null, e, true);
31176          closeArray();
31177        }
31178      };
31179      if (element.hasAggregation()) {
31180        openArray("aggregation");
31181        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
31182          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
31183        closeArray();
31184        if (anyHasExtras(element.getAggregation())) {
31185          openArray("_aggregation");
31186          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
31187            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
31188          closeArray();
31189        }
31190      };
31191      if (element.hasVersioningElement()) {
31192        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
31193        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
31194      }
31195  }
31196
31197  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
31198    if (element != null) {
31199      open(name);
31200      composeElementDefinitionElementDefinitionExampleComponentInner(element);
31201      close();
31202    }
31203  }
31204
31205  protected void composeElementDefinitionElementDefinitionExampleComponentInner(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
31206      composeElement(element);
31207      if (element.hasLabelElement()) {
31208        composeStringCore("label", element.getLabelElement(), false);
31209        composeStringExtras("label", element.getLabelElement(), false);
31210      }
31211      if (element.hasValue()) {
31212        composeType("value", element.getValue());
31213      }
31214  }
31215
31216  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
31217    if (element != null) {
31218      open(name);
31219      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
31220      close();
31221    }
31222  }
31223
31224  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
31225      composeElement(element);
31226      if (element.hasKeyElement()) {
31227        composeIdCore("key", element.getKeyElement(), false);
31228        composeIdExtras("key", element.getKeyElement(), false);
31229      }
31230      if (element.hasRequirementsElement()) {
31231        composeStringCore("requirements", element.getRequirementsElement(), false);
31232        composeStringExtras("requirements", element.getRequirementsElement(), false);
31233      }
31234      if (element.hasSeverityElement()) {
31235        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
31236        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
31237      }
31238      if (element.hasHumanElement()) {
31239        composeStringCore("human", element.getHumanElement(), false);
31240        composeStringExtras("human", element.getHumanElement(), false);
31241      }
31242      if (element.hasExpressionElement()) {
31243        composeStringCore("expression", element.getExpressionElement(), false);
31244        composeStringExtras("expression", element.getExpressionElement(), false);
31245      }
31246      if (element.hasXpathElement()) {
31247        composeStringCore("xpath", element.getXpathElement(), false);
31248        composeStringExtras("xpath", element.getXpathElement(), false);
31249      }
31250      if (element.hasSourceElement()) {
31251        composeCanonicalCore("source", element.getSourceElement(), false);
31252        composeCanonicalExtras("source", element.getSourceElement(), false);
31253      }
31254  }
31255
31256  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
31257    if (element != null) {
31258      open(name);
31259      composeElementDefinitionElementDefinitionBindingComponentInner(element);
31260      close();
31261    }
31262  }
31263
31264  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
31265      composeElement(element);
31266      if (element.hasStrengthElement()) {
31267        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
31268        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
31269      }
31270      if (element.hasDescriptionElement()) {
31271        composeStringCore("description", element.getDescriptionElement(), false);
31272        composeStringExtras("description", element.getDescriptionElement(), false);
31273      }
31274      if (element.hasValueSetElement()) {
31275        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
31276        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
31277      }
31278  }
31279
31280  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
31281    if (element != null) {
31282      open(name);
31283      composeElementDefinitionElementDefinitionMappingComponentInner(element);
31284      close();
31285    }
31286  }
31287
31288  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
31289      composeElement(element);
31290      if (element.hasIdentityElement()) {
31291        composeIdCore("identity", element.getIdentityElement(), false);
31292        composeIdExtras("identity", element.getIdentityElement(), false);
31293      }
31294      if (element.hasLanguageElement()) {
31295        composeCodeCore("language", element.getLanguageElement(), false);
31296        composeCodeExtras("language", element.getLanguageElement(), false);
31297      }
31298      if (element.hasMapElement()) {
31299        composeStringCore("map", element.getMapElement(), false);
31300        composeStringExtras("map", element.getMapElement(), false);
31301      }
31302      if (element.hasCommentElement()) {
31303        composeStringCore("comment", element.getCommentElement(), false);
31304        composeStringExtras("comment", element.getCommentElement(), false);
31305      }
31306  }
31307
31308  protected void composeDomainResourceElements(DomainResource element) throws IOException {
31309      composeResourceElements(element);
31310      if (element.hasText()) {
31311        composeNarrative("text", element.getText());
31312      }
31313      if (element.hasContained()) {
31314        openArray("contained");
31315        for (Resource e : element.getContained()) {
31316          open(null);
31317          composeResource(e);
31318          close();
31319        }
31320        closeArray();
31321      };
31322      if (element.hasExtension()) {
31323        openArray("extension");
31324        for (Extension e : element.getExtension()) 
31325          composeExtension(null, e);
31326        closeArray();
31327      };
31328      if (element.hasModifierExtension()) {
31329        openArray("modifierExtension");
31330        for (Extension e : element.getModifierExtension()) 
31331          composeExtension(null, e);
31332        closeArray();
31333      };
31334  }
31335
31336  protected void composeParameters(String name, Parameters element) throws IOException {
31337    if (element != null) {
31338      prop("resourceType", name);
31339      composeParametersInner(element);
31340    }
31341  }
31342
31343  protected void composeParametersInner(Parameters element) throws IOException {
31344      composeResourceElements(element);
31345      if (element.hasParameter()) {
31346        openArray("parameter");
31347        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
31348          composeParametersParametersParameterComponent(null, e);
31349        closeArray();
31350      };
31351  }
31352
31353  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
31354    if (element != null) {
31355      open(name);
31356      composeParametersParametersParameterComponentInner(element);
31357      close();
31358    }
31359  }
31360
31361  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
31362      composeBackbone(element);
31363      if (element.hasNameElement()) {
31364        composeStringCore("name", element.getNameElement(), false);
31365        composeStringExtras("name", element.getNameElement(), false);
31366      }
31367      if (element.hasValue()) {
31368        composeType("value", element.getValue());
31369      }
31370        if (element.hasResource()) {
31371          open("resource");
31372          composeResource(element.getResource());
31373          close();
31374        }
31375      if (element.hasPart()) {
31376        openArray("part");
31377        for (Parameters.ParametersParameterComponent e : element.getPart()) 
31378          composeParametersParametersParameterComponent(null, e);
31379        closeArray();
31380      };
31381  }
31382
31383  protected void composeResourceElements(Resource element) throws IOException {
31384      if (element.hasIdElement()) {
31385        composeIdCore("id", element.getIdElement(), false);
31386        composeIdExtras("id", element.getIdElement(), false);
31387      }
31388      if (element.hasMeta()) {
31389        composeMeta("meta", element.getMeta());
31390      }
31391      if (element.hasImplicitRulesElement()) {
31392        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
31393        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
31394      }
31395      if (element.hasLanguageElement()) {
31396        composeCodeCore("language", element.getLanguageElement(), false);
31397        composeCodeExtras("language", element.getLanguageElement(), false);
31398      }
31399  }
31400
31401  protected void composeAccount(String name, Account element) throws IOException {
31402    if (element != null) {
31403      prop("resourceType", name);
31404      composeAccountInner(element);
31405    }
31406  }
31407
31408  protected void composeAccountInner(Account element) throws IOException {
31409      composeDomainResourceElements(element);
31410      if (element.hasIdentifier()) {
31411        openArray("identifier");
31412        for (Identifier e : element.getIdentifier()) 
31413          composeIdentifier(null, e);
31414        closeArray();
31415      };
31416      if (element.hasStatusElement()) {
31417        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
31418        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
31419      }
31420      if (element.hasType()) {
31421        composeCodeableConcept("type", element.getType());
31422      }
31423      if (element.hasNameElement()) {
31424        composeStringCore("name", element.getNameElement(), false);
31425        composeStringExtras("name", element.getNameElement(), false);
31426      }
31427      if (element.hasSubject()) {
31428        openArray("subject");
31429        for (Reference e : element.getSubject()) 
31430          composeReference(null, e);
31431        closeArray();
31432      };
31433      if (element.hasServicePeriod()) {
31434        composePeriod("servicePeriod", element.getServicePeriod());
31435      }
31436      if (element.hasCoverage()) {
31437        openArray("coverage");
31438        for (Account.CoverageComponent e : element.getCoverage()) 
31439          composeAccountCoverageComponent(null, e);
31440        closeArray();
31441      };
31442      if (element.hasOwner()) {
31443        composeReference("owner", element.getOwner());
31444      }
31445      if (element.hasDescriptionElement()) {
31446        composeStringCore("description", element.getDescriptionElement(), false);
31447        composeStringExtras("description", element.getDescriptionElement(), false);
31448      }
31449      if (element.hasGuarantor()) {
31450        openArray("guarantor");
31451        for (Account.GuarantorComponent e : element.getGuarantor()) 
31452          composeAccountGuarantorComponent(null, e);
31453        closeArray();
31454      };
31455      if (element.hasPartOf()) {
31456        composeReference("partOf", element.getPartOf());
31457      }
31458  }
31459
31460  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
31461    if (element != null) {
31462      open(name);
31463      composeAccountCoverageComponentInner(element);
31464      close();
31465    }
31466  }
31467
31468  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
31469      composeBackbone(element);
31470      if (element.hasCoverage()) {
31471        composeReference("coverage", element.getCoverage());
31472      }
31473      if (element.hasPriorityElement()) {
31474        composePositiveIntCore("priority", element.getPriorityElement(), false);
31475        composePositiveIntExtras("priority", element.getPriorityElement(), false);
31476      }
31477  }
31478
31479  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
31480    if (element != null) {
31481      open(name);
31482      composeAccountGuarantorComponentInner(element);
31483      close();
31484    }
31485  }
31486
31487  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
31488      composeBackbone(element);
31489      if (element.hasParty()) {
31490        composeReference("party", element.getParty());
31491      }
31492      if (element.hasOnHoldElement()) {
31493        composeBooleanCore("onHold", element.getOnHoldElement(), false);
31494        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
31495      }
31496      if (element.hasPeriod()) {
31497        composePeriod("period", element.getPeriod());
31498      }
31499  }
31500
31501  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
31502    if (element != null) {
31503      prop("resourceType", name);
31504      composeActivityDefinitionInner(element);
31505    }
31506  }
31507
31508  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
31509      composeDomainResourceElements(element);
31510      if (element.hasUrlElement()) {
31511        composeUriCore("url", element.getUrlElement(), false);
31512        composeUriExtras("url", element.getUrlElement(), false);
31513      }
31514      if (element.hasIdentifier()) {
31515        openArray("identifier");
31516        for (Identifier e : element.getIdentifier()) 
31517          composeIdentifier(null, e);
31518        closeArray();
31519      };
31520      if (element.hasVersionElement()) {
31521        composeStringCore("version", element.getVersionElement(), false);
31522        composeStringExtras("version", element.getVersionElement(), false);
31523      }
31524      if (element.hasNameElement()) {
31525        composeStringCore("name", element.getNameElement(), false);
31526        composeStringExtras("name", element.getNameElement(), false);
31527      }
31528      if (element.hasTitleElement()) {
31529        composeStringCore("title", element.getTitleElement(), false);
31530        composeStringExtras("title", element.getTitleElement(), false);
31531      }
31532      if (element.hasSubtitleElement()) {
31533        composeStringCore("subtitle", element.getSubtitleElement(), false);
31534        composeStringExtras("subtitle", element.getSubtitleElement(), false);
31535      }
31536      if (element.hasStatusElement()) {
31537        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31538        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31539      }
31540      if (element.hasExperimentalElement()) {
31541        composeBooleanCore("experimental", element.getExperimentalElement(), false);
31542        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
31543      }
31544      if (element.hasSubject()) {
31545        composeType("subject", element.getSubject());
31546      }
31547      if (element.hasDateElement()) {
31548        composeDateTimeCore("date", element.getDateElement(), false);
31549        composeDateTimeExtras("date", element.getDateElement(), false);
31550      }
31551      if (element.hasPublisherElement()) {
31552        composeStringCore("publisher", element.getPublisherElement(), false);
31553        composeStringExtras("publisher", element.getPublisherElement(), false);
31554      }
31555      if (element.hasContact()) {
31556        openArray("contact");
31557        for (ContactDetail e : element.getContact()) 
31558          composeContactDetail(null, e);
31559        closeArray();
31560      };
31561      if (element.hasDescriptionElement()) {
31562        composeMarkdownCore("description", element.getDescriptionElement(), false);
31563        composeMarkdownExtras("description", element.getDescriptionElement(), false);
31564      }
31565      if (element.hasUseContext()) {
31566        openArray("useContext");
31567        for (UsageContext e : element.getUseContext()) 
31568          composeUsageContext(null, e);
31569        closeArray();
31570      };
31571      if (element.hasJurisdiction()) {
31572        openArray("jurisdiction");
31573        for (CodeableConcept e : element.getJurisdiction()) 
31574          composeCodeableConcept(null, e);
31575        closeArray();
31576      };
31577      if (element.hasPurposeElement()) {
31578        composeMarkdownCore("purpose", element.getPurposeElement(), false);
31579        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
31580      }
31581      if (element.hasUsageElement()) {
31582        composeStringCore("usage", element.getUsageElement(), false);
31583        composeStringExtras("usage", element.getUsageElement(), false);
31584      }
31585      if (element.hasCopyrightElement()) {
31586        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
31587        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
31588      }
31589      if (element.hasApprovalDateElement()) {
31590        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
31591        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
31592      }
31593      if (element.hasLastReviewDateElement()) {
31594        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
31595        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
31596      }
31597      if (element.hasEffectivePeriod()) {
31598        composePeriod("effectivePeriod", element.getEffectivePeriod());
31599      }
31600      if (element.hasTopic()) {
31601        openArray("topic");
31602        for (CodeableConcept e : element.getTopic()) 
31603          composeCodeableConcept(null, e);
31604        closeArray();
31605      };
31606      if (element.hasAuthor()) {
31607        openArray("author");
31608        for (ContactDetail e : element.getAuthor()) 
31609          composeContactDetail(null, e);
31610        closeArray();
31611      };
31612      if (element.hasEditor()) {
31613        openArray("editor");
31614        for (ContactDetail e : element.getEditor()) 
31615          composeContactDetail(null, e);
31616        closeArray();
31617      };
31618      if (element.hasReviewer()) {
31619        openArray("reviewer");
31620        for (ContactDetail e : element.getReviewer()) 
31621          composeContactDetail(null, e);
31622        closeArray();
31623      };
31624      if (element.hasEndorser()) {
31625        openArray("endorser");
31626        for (ContactDetail e : element.getEndorser()) 
31627          composeContactDetail(null, e);
31628        closeArray();
31629      };
31630      if (element.hasRelatedArtifact()) {
31631        openArray("relatedArtifact");
31632        for (RelatedArtifact e : element.getRelatedArtifact()) 
31633          composeRelatedArtifact(null, e);
31634        closeArray();
31635      };
31636      if (element.hasLibrary()) {
31637        openArray("library");
31638        for (CanonicalType e : element.getLibrary()) 
31639          composeCanonicalCore(null, e, true);
31640        closeArray();
31641        if (anyHasExtras(element.getLibrary())) {
31642          openArray("_library");
31643          for (CanonicalType e : element.getLibrary()) 
31644            composeCanonicalExtras(null, e, true);
31645          closeArray();
31646        }
31647      };
31648      if (element.hasKindElement()) {
31649        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
31650        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
31651      }
31652      if (element.hasProfileElement()) {
31653        composeCanonicalCore("profile", element.getProfileElement(), false);
31654        composeCanonicalExtras("profile", element.getProfileElement(), false);
31655      }
31656      if (element.hasCode()) {
31657        composeCodeableConcept("code", element.getCode());
31658      }
31659      if (element.hasIntentElement()) {
31660        composeEnumerationCore("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
31661        composeEnumerationExtras("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
31662      }
31663      if (element.hasPriorityElement()) {
31664        composeEnumerationCore("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
31665        composeEnumerationExtras("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
31666      }
31667      if (element.hasDoNotPerformElement()) {
31668        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
31669        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
31670      }
31671      if (element.hasTiming()) {
31672        composeType("timing", element.getTiming());
31673      }
31674      if (element.hasLocation()) {
31675        composeReference("location", element.getLocation());
31676      }
31677      if (element.hasParticipant()) {
31678        openArray("participant");
31679        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
31680          composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
31681        closeArray();
31682      };
31683      if (element.hasProduct()) {
31684        composeType("product", element.getProduct());
31685      }
31686      if (element.hasQuantity()) {
31687        composeQuantity("quantity", element.getQuantity());
31688      }
31689      if (element.hasDosage()) {
31690        openArray("dosage");
31691        for (Dosage e : element.getDosage()) 
31692          composeDosage(null, e);
31693        closeArray();
31694      };
31695      if (element.hasBodySite()) {
31696        openArray("bodySite");
31697        for (CodeableConcept e : element.getBodySite()) 
31698          composeCodeableConcept(null, e);
31699        closeArray();
31700      };
31701      if (element.hasSpecimenRequirement()) {
31702        openArray("specimenRequirement");
31703        for (Reference e : element.getSpecimenRequirement()) 
31704          composeReference(null, e);
31705        closeArray();
31706      };
31707      if (element.hasObservationRequirement()) {
31708        openArray("observationRequirement");
31709        for (Reference e : element.getObservationRequirement()) 
31710          composeReference(null, e);
31711        closeArray();
31712      };
31713      if (element.hasObservationResultRequirement()) {
31714        openArray("observationResultRequirement");
31715        for (Reference e : element.getObservationResultRequirement()) 
31716          composeReference(null, e);
31717        closeArray();
31718      };
31719      if (element.hasTransformElement()) {
31720        composeCanonicalCore("transform", element.getTransformElement(), false);
31721        composeCanonicalExtras("transform", element.getTransformElement(), false);
31722      }
31723      if (element.hasDynamicValue()) {
31724        openArray("dynamicValue");
31725        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
31726          composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
31727        closeArray();
31728      };
31729  }
31730
31731  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
31732    if (element != null) {
31733      open(name);
31734      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
31735      close();
31736    }
31737  }
31738
31739  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
31740      composeBackbone(element);
31741      if (element.hasTypeElement()) {
31742        composeEnumerationCore("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
31743        composeEnumerationExtras("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
31744      }
31745      if (element.hasRole()) {
31746        composeCodeableConcept("role", element.getRole());
31747      }
31748  }
31749
31750  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
31751    if (element != null) {
31752      open(name);
31753      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
31754      close();
31755    }
31756  }
31757
31758  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
31759      composeBackbone(element);
31760      if (element.hasPathElement()) {
31761        composeStringCore("path", element.getPathElement(), false);
31762        composeStringExtras("path", element.getPathElement(), false);
31763      }
31764      if (element.hasExpression()) {
31765        composeExpression("expression", element.getExpression());
31766      }
31767  }
31768
31769  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
31770    if (element != null) {
31771      prop("resourceType", name);
31772      composeAdverseEventInner(element);
31773    }
31774  }
31775
31776  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
31777      composeDomainResourceElements(element);
31778      if (element.hasIdentifier()) {
31779        composeIdentifier("identifier", element.getIdentifier());
31780      }
31781      if (element.hasActualityElement()) {
31782        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
31783        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
31784      }
31785      if (element.hasCategory()) {
31786        openArray("category");
31787        for (CodeableConcept e : element.getCategory()) 
31788          composeCodeableConcept(null, e);
31789        closeArray();
31790      };
31791      if (element.hasEvent()) {
31792        composeCodeableConcept("event", element.getEvent());
31793      }
31794      if (element.hasSubject()) {
31795        composeReference("subject", element.getSubject());
31796      }
31797      if (element.hasEncounter()) {
31798        composeReference("encounter", element.getEncounter());
31799      }
31800      if (element.hasDateElement()) {
31801        composeDateTimeCore("date", element.getDateElement(), false);
31802        composeDateTimeExtras("date", element.getDateElement(), false);
31803      }
31804      if (element.hasDetectedElement()) {
31805        composeDateTimeCore("detected", element.getDetectedElement(), false);
31806        composeDateTimeExtras("detected", element.getDetectedElement(), false);
31807      }
31808      if (element.hasRecordedDateElement()) {
31809        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
31810        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
31811      }
31812      if (element.hasResultingCondition()) {
31813        openArray("resultingCondition");
31814        for (Reference e : element.getResultingCondition()) 
31815          composeReference(null, e);
31816        closeArray();
31817      };
31818      if (element.hasLocation()) {
31819        composeReference("location", element.getLocation());
31820      }
31821      if (element.hasSeriousness()) {
31822        composeCodeableConcept("seriousness", element.getSeriousness());
31823      }
31824      if (element.hasSeverity()) {
31825        composeCodeableConcept("severity", element.getSeverity());
31826      }
31827      if (element.hasOutcome()) {
31828        composeCodeableConcept("outcome", element.getOutcome());
31829      }
31830      if (element.hasRecorder()) {
31831        composeReference("recorder", element.getRecorder());
31832      }
31833      if (element.hasContributor()) {
31834        openArray("contributor");
31835        for (Reference e : element.getContributor()) 
31836          composeReference(null, e);
31837        closeArray();
31838      };
31839      if (element.hasSuspectEntity()) {
31840        openArray("suspectEntity");
31841        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
31842          composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
31843        closeArray();
31844      };
31845      if (element.hasSubjectMedicalHistory()) {
31846        openArray("subjectMedicalHistory");
31847        for (Reference e : element.getSubjectMedicalHistory()) 
31848          composeReference(null, e);
31849        closeArray();
31850      };
31851      if (element.hasReferenceDocument()) {
31852        openArray("referenceDocument");
31853        for (Reference e : element.getReferenceDocument()) 
31854          composeReference(null, e);
31855        closeArray();
31856      };
31857      if (element.hasStudy()) {
31858        openArray("study");
31859        for (Reference e : element.getStudy()) 
31860          composeReference(null, e);
31861        closeArray();
31862      };
31863  }
31864
31865  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
31866    if (element != null) {
31867      open(name);
31868      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
31869      close();
31870    }
31871  }
31872
31873  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
31874      composeBackbone(element);
31875      if (element.hasInstance()) {
31876        composeReference("instance", element.getInstance());
31877      }
31878      if (element.hasCausality()) {
31879        openArray("causality");
31880        for (AdverseEvent.AdverseEventSuspectEntityCausalityComponent e : element.getCausality()) 
31881          composeAdverseEventAdverseEventSuspectEntityCausalityComponent(null, e);
31882        closeArray();
31883      };
31884  }
31885
31886  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
31887    if (element != null) {
31888      open(name);
31889      composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(element);
31890      close();
31891    }
31892  }
31893
31894  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
31895      composeBackbone(element);
31896      if (element.hasAssessment()) {
31897        composeCodeableConcept("assessment", element.getAssessment());
31898      }
31899      if (element.hasProductRelatednessElement()) {
31900        composeStringCore("productRelatedness", element.getProductRelatednessElement(), false);
31901        composeStringExtras("productRelatedness", element.getProductRelatednessElement(), false);
31902      }
31903      if (element.hasAuthor()) {
31904        composeReference("author", element.getAuthor());
31905      }
31906      if (element.hasMethod()) {
31907        composeCodeableConcept("method", element.getMethod());
31908      }
31909  }
31910
31911  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
31912    if (element != null) {
31913      prop("resourceType", name);
31914      composeAllergyIntoleranceInner(element);
31915    }
31916  }
31917
31918  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
31919      composeDomainResourceElements(element);
31920      if (element.hasIdentifier()) {
31921        openArray("identifier");
31922        for (Identifier e : element.getIdentifier()) 
31923          composeIdentifier(null, e);
31924        closeArray();
31925      };
31926      if (element.hasClinicalStatus()) {
31927        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
31928      }
31929      if (element.hasVerificationStatus()) {
31930        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
31931      }
31932      if (element.hasTypeElement()) {
31933        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
31934        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
31935      }
31936      if (element.hasCategory()) {
31937        openArray("category");
31938        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
31939          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
31940        closeArray();
31941        if (anyHasExtras(element.getCategory())) {
31942          openArray("_category");
31943          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
31944            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
31945          closeArray();
31946        }
31947      };
31948      if (element.hasCriticalityElement()) {
31949        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
31950        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
31951      }
31952      if (element.hasCode()) {
31953        composeCodeableConcept("code", element.getCode());
31954      }
31955      if (element.hasPatient()) {
31956        composeReference("patient", element.getPatient());
31957      }
31958      if (element.hasEncounter()) {
31959        composeReference("encounter", element.getEncounter());
31960      }
31961      if (element.hasOnset()) {
31962        composeType("onset", element.getOnset());
31963      }
31964      if (element.hasRecordedDateElement()) {
31965        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
31966        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
31967      }
31968      if (element.hasRecorder()) {
31969        composeReference("recorder", element.getRecorder());
31970      }
31971      if (element.hasAsserter()) {
31972        composeReference("asserter", element.getAsserter());
31973      }
31974      if (element.hasLastOccurrenceElement()) {
31975        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
31976        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
31977      }
31978      if (element.hasNote()) {
31979        openArray("note");
31980        for (Annotation e : element.getNote()) 
31981          composeAnnotation(null, e);
31982        closeArray();
31983      };
31984      if (element.hasReaction()) {
31985        openArray("reaction");
31986        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
31987          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
31988        closeArray();
31989      };
31990  }
31991
31992  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
31993    if (element != null) {
31994      open(name);
31995      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
31996      close();
31997    }
31998  }
31999
32000  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
32001      composeBackbone(element);
32002      if (element.hasSubstance()) {
32003        composeCodeableConcept("substance", element.getSubstance());
32004      }
32005      if (element.hasManifestation()) {
32006        openArray("manifestation");
32007        for (CodeableConcept e : element.getManifestation()) 
32008          composeCodeableConcept(null, e);
32009        closeArray();
32010      };
32011      if (element.hasDescriptionElement()) {
32012        composeStringCore("description", element.getDescriptionElement(), false);
32013        composeStringExtras("description", element.getDescriptionElement(), false);
32014      }
32015      if (element.hasOnsetElement()) {
32016        composeDateTimeCore("onset", element.getOnsetElement(), false);
32017        composeDateTimeExtras("onset", element.getOnsetElement(), false);
32018      }
32019      if (element.hasSeverityElement()) {
32020        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
32021        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
32022      }
32023      if (element.hasExposureRoute()) {
32024        composeCodeableConcept("exposureRoute", element.getExposureRoute());
32025      }
32026      if (element.hasNote()) {
32027        openArray("note");
32028        for (Annotation e : element.getNote()) 
32029          composeAnnotation(null, e);
32030        closeArray();
32031      };
32032  }
32033
32034  protected void composeAppointment(String name, Appointment element) throws IOException {
32035    if (element != null) {
32036      prop("resourceType", name);
32037      composeAppointmentInner(element);
32038    }
32039  }
32040
32041  protected void composeAppointmentInner(Appointment element) throws IOException {
32042      composeDomainResourceElements(element);
32043      if (element.hasIdentifier()) {
32044        openArray("identifier");
32045        for (Identifier e : element.getIdentifier()) 
32046          composeIdentifier(null, e);
32047        closeArray();
32048      };
32049      if (element.hasStatusElement()) {
32050        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
32051        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
32052      }
32053      if (element.hasCancelationReason()) {
32054        composeCodeableConcept("cancelationReason", element.getCancelationReason());
32055      }
32056      if (element.hasServiceCategory()) {
32057        openArray("serviceCategory");
32058        for (CodeableConcept e : element.getServiceCategory()) 
32059          composeCodeableConcept(null, e);
32060        closeArray();
32061      };
32062      if (element.hasServiceType()) {
32063        openArray("serviceType");
32064        for (CodeableConcept e : element.getServiceType()) 
32065          composeCodeableConcept(null, e);
32066        closeArray();
32067      };
32068      if (element.hasSpecialty()) {
32069        openArray("specialty");
32070        for (CodeableConcept e : element.getSpecialty()) 
32071          composeCodeableConcept(null, e);
32072        closeArray();
32073      };
32074      if (element.hasAppointmentType()) {
32075        composeCodeableConcept("appointmentType", element.getAppointmentType());
32076      }
32077      if (element.hasReasonCode()) {
32078        openArray("reasonCode");
32079        for (CodeableConcept e : element.getReasonCode()) 
32080          composeCodeableConcept(null, e);
32081        closeArray();
32082      };
32083      if (element.hasReasonReference()) {
32084        openArray("reasonReference");
32085        for (Reference e : element.getReasonReference()) 
32086          composeReference(null, e);
32087        closeArray();
32088      };
32089      if (element.hasPriorityElement()) {
32090        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
32091        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
32092      }
32093      if (element.hasDescriptionElement()) {
32094        composeStringCore("description", element.getDescriptionElement(), false);
32095        composeStringExtras("description", element.getDescriptionElement(), false);
32096      }
32097      if (element.hasSupportingInformation()) {
32098        openArray("supportingInformation");
32099        for (Reference e : element.getSupportingInformation()) 
32100          composeReference(null, e);
32101        closeArray();
32102      };
32103      if (element.hasStartElement()) {
32104        composeInstantCore("start", element.getStartElement(), false);
32105        composeInstantExtras("start", element.getStartElement(), false);
32106      }
32107      if (element.hasEndElement()) {
32108        composeInstantCore("end", element.getEndElement(), false);
32109        composeInstantExtras("end", element.getEndElement(), false);
32110      }
32111      if (element.hasMinutesDurationElement()) {
32112        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
32113        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
32114      }
32115      if (element.hasSlot()) {
32116        openArray("slot");
32117        for (Reference e : element.getSlot()) 
32118          composeReference(null, e);
32119        closeArray();
32120      };
32121      if (element.hasCreatedElement()) {
32122        composeDateTimeCore("created", element.getCreatedElement(), false);
32123        composeDateTimeExtras("created", element.getCreatedElement(), false);
32124      }
32125      if (element.hasCommentElement()) {
32126        composeStringCore("comment", element.getCommentElement(), false);
32127        composeStringExtras("comment", element.getCommentElement(), false);
32128      }
32129      if (element.hasPatientInstructionElement()) {
32130        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
32131        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
32132      }
32133      if (element.hasBasedOn()) {
32134        openArray("basedOn");
32135        for (Reference e : element.getBasedOn()) 
32136          composeReference(null, e);
32137        closeArray();
32138      };
32139      if (element.hasParticipant()) {
32140        openArray("participant");
32141        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
32142          composeAppointmentAppointmentParticipantComponent(null, e);
32143        closeArray();
32144      };
32145      if (element.hasRequestedPeriod()) {
32146        openArray("requestedPeriod");
32147        for (Period e : element.getRequestedPeriod()) 
32148          composePeriod(null, e);
32149        closeArray();
32150      };
32151  }
32152
32153  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
32154    if (element != null) {
32155      open(name);
32156      composeAppointmentAppointmentParticipantComponentInner(element);
32157      close();
32158    }
32159  }
32160
32161  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
32162      composeBackbone(element);
32163      if (element.hasType()) {
32164        openArray("type");
32165        for (CodeableConcept e : element.getType()) 
32166          composeCodeableConcept(null, e);
32167        closeArray();
32168      };
32169      if (element.hasActor()) {
32170        composeReference("actor", element.getActor());
32171      }
32172      if (element.hasRequiredElement()) {
32173        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
32174        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
32175      }
32176      if (element.hasStatusElement()) {
32177        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
32178        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
32179      }
32180      if (element.hasPeriod()) {
32181        composePeriod("period", element.getPeriod());
32182      }
32183  }
32184
32185  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
32186    if (element != null) {
32187      prop("resourceType", name);
32188      composeAppointmentResponseInner(element);
32189    }
32190  }
32191
32192  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
32193      composeDomainResourceElements(element);
32194      if (element.hasIdentifier()) {
32195        openArray("identifier");
32196        for (Identifier e : element.getIdentifier()) 
32197          composeIdentifier(null, e);
32198        closeArray();
32199      };
32200      if (element.hasAppointment()) {
32201        composeReference("appointment", element.getAppointment());
32202      }
32203      if (element.hasStartElement()) {
32204        composeInstantCore("start", element.getStartElement(), false);
32205        composeInstantExtras("start", element.getStartElement(), false);
32206      }
32207      if (element.hasEndElement()) {
32208        composeInstantCore("end", element.getEndElement(), false);
32209        composeInstantExtras("end", element.getEndElement(), false);
32210      }
32211      if (element.hasParticipantType()) {
32212        openArray("participantType");
32213        for (CodeableConcept e : element.getParticipantType()) 
32214          composeCodeableConcept(null, e);
32215        closeArray();
32216      };
32217      if (element.hasActor()) {
32218        composeReference("actor", element.getActor());
32219      }
32220      if (element.hasParticipantStatusElement()) {
32221        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
32222        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
32223      }
32224      if (element.hasCommentElement()) {
32225        composeStringCore("comment", element.getCommentElement(), false);
32226        composeStringExtras("comment", element.getCommentElement(), false);
32227      }
32228  }
32229
32230  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
32231    if (element != null) {
32232      prop("resourceType", name);
32233      composeAuditEventInner(element);
32234    }
32235  }
32236
32237  protected void composeAuditEventInner(AuditEvent element) throws IOException {
32238      composeDomainResourceElements(element);
32239      if (element.hasType()) {
32240        composeCoding("type", element.getType());
32241      }
32242      if (element.hasSubtype()) {
32243        openArray("subtype");
32244        for (Coding e : element.getSubtype()) 
32245          composeCoding(null, e);
32246        closeArray();
32247      };
32248      if (element.hasActionElement()) {
32249        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
32250        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
32251      }
32252      if (element.hasPeriod()) {
32253        composePeriod("period", element.getPeriod());
32254      }
32255      if (element.hasRecordedElement()) {
32256        composeInstantCore("recorded", element.getRecordedElement(), false);
32257        composeInstantExtras("recorded", element.getRecordedElement(), false);
32258      }
32259      if (element.hasOutcomeElement()) {
32260        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
32261        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
32262      }
32263      if (element.hasOutcomeDescElement()) {
32264        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
32265        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
32266      }
32267      if (element.hasPurposeOfEvent()) {
32268        openArray("purposeOfEvent");
32269        for (CodeableConcept e : element.getPurposeOfEvent()) 
32270          composeCodeableConcept(null, e);
32271        closeArray();
32272      };
32273      if (element.hasAgent()) {
32274        openArray("agent");
32275        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
32276          composeAuditEventAuditEventAgentComponent(null, e);
32277        closeArray();
32278      };
32279      if (element.hasSource()) {
32280        composeAuditEventAuditEventSourceComponent("source", element.getSource());
32281      }
32282      if (element.hasEntity()) {
32283        openArray("entity");
32284        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
32285          composeAuditEventAuditEventEntityComponent(null, e);
32286        closeArray();
32287      };
32288  }
32289
32290  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
32291    if (element != null) {
32292      open(name);
32293      composeAuditEventAuditEventAgentComponentInner(element);
32294      close();
32295    }
32296  }
32297
32298  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
32299      composeBackbone(element);
32300      if (element.hasType()) {
32301        composeCodeableConcept("type", element.getType());
32302      }
32303      if (element.hasRole()) {
32304        openArray("role");
32305        for (CodeableConcept e : element.getRole()) 
32306          composeCodeableConcept(null, e);
32307        closeArray();
32308      };
32309      if (element.hasWho()) {
32310        composeReference("who", element.getWho());
32311      }
32312      if (element.hasAltIdElement()) {
32313        composeStringCore("altId", element.getAltIdElement(), false);
32314        composeStringExtras("altId", element.getAltIdElement(), false);
32315      }
32316      if (element.hasNameElement()) {
32317        composeStringCore("name", element.getNameElement(), false);
32318        composeStringExtras("name", element.getNameElement(), false);
32319      }
32320      if (element.hasRequestorElement()) {
32321        composeBooleanCore("requestor", element.getRequestorElement(), false);
32322        composeBooleanExtras("requestor", element.getRequestorElement(), false);
32323      }
32324      if (element.hasLocation()) {
32325        composeReference("location", element.getLocation());
32326      }
32327      if (element.hasPolicy()) {
32328        openArray("policy");
32329        for (UriType e : element.getPolicy()) 
32330          composeUriCore(null, e, true);
32331        closeArray();
32332        if (anyHasExtras(element.getPolicy())) {
32333          openArray("_policy");
32334          for (UriType e : element.getPolicy()) 
32335            composeUriExtras(null, e, true);
32336          closeArray();
32337        }
32338      };
32339      if (element.hasMedia()) {
32340        composeCoding("media", element.getMedia());
32341      }
32342      if (element.hasNetwork()) {
32343        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
32344      }
32345      if (element.hasPurposeOfUse()) {
32346        openArray("purposeOfUse");
32347        for (CodeableConcept e : element.getPurposeOfUse()) 
32348          composeCodeableConcept(null, e);
32349        closeArray();
32350      };
32351  }
32352
32353  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
32354    if (element != null) {
32355      open(name);
32356      composeAuditEventAuditEventAgentNetworkComponentInner(element);
32357      close();
32358    }
32359  }
32360
32361  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
32362      composeBackbone(element);
32363      if (element.hasAddressElement()) {
32364        composeStringCore("address", element.getAddressElement(), false);
32365        composeStringExtras("address", element.getAddressElement(), false);
32366      }
32367      if (element.hasTypeElement()) {
32368        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
32369        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
32370      }
32371  }
32372
32373  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
32374    if (element != null) {
32375      open(name);
32376      composeAuditEventAuditEventSourceComponentInner(element);
32377      close();
32378    }
32379  }
32380
32381  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
32382      composeBackbone(element);
32383      if (element.hasSiteElement()) {
32384        composeStringCore("site", element.getSiteElement(), false);
32385        composeStringExtras("site", element.getSiteElement(), false);
32386      }
32387      if (element.hasObserver()) {
32388        composeReference("observer", element.getObserver());
32389      }
32390      if (element.hasType()) {
32391        openArray("type");
32392        for (Coding e : element.getType()) 
32393          composeCoding(null, e);
32394        closeArray();
32395      };
32396  }
32397
32398  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
32399    if (element != null) {
32400      open(name);
32401      composeAuditEventAuditEventEntityComponentInner(element);
32402      close();
32403    }
32404  }
32405
32406  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
32407      composeBackbone(element);
32408      if (element.hasWhat()) {
32409        composeReference("what", element.getWhat());
32410      }
32411      if (element.hasType()) {
32412        composeCoding("type", element.getType());
32413      }
32414      if (element.hasRole()) {
32415        composeCoding("role", element.getRole());
32416      }
32417      if (element.hasLifecycle()) {
32418        composeCoding("lifecycle", element.getLifecycle());
32419      }
32420      if (element.hasSecurityLabel()) {
32421        openArray("securityLabel");
32422        for (Coding e : element.getSecurityLabel()) 
32423          composeCoding(null, e);
32424        closeArray();
32425      };
32426      if (element.hasNameElement()) {
32427        composeStringCore("name", element.getNameElement(), false);
32428        composeStringExtras("name", element.getNameElement(), false);
32429      }
32430      if (element.hasDescriptionElement()) {
32431        composeStringCore("description", element.getDescriptionElement(), false);
32432        composeStringExtras("description", element.getDescriptionElement(), false);
32433      }
32434      if (element.hasQueryElement()) {
32435        composeBase64BinaryCore("query", element.getQueryElement(), false);
32436        composeBase64BinaryExtras("query", element.getQueryElement(), false);
32437      }
32438      if (element.hasDetail()) {
32439        openArray("detail");
32440        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
32441          composeAuditEventAuditEventEntityDetailComponent(null, e);
32442        closeArray();
32443      };
32444  }
32445
32446  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
32447    if (element != null) {
32448      open(name);
32449      composeAuditEventAuditEventEntityDetailComponentInner(element);
32450      close();
32451    }
32452  }
32453
32454  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
32455      composeBackbone(element);
32456      if (element.hasTypeElement()) {
32457        composeStringCore("type", element.getTypeElement(), false);
32458        composeStringExtras("type", element.getTypeElement(), false);
32459      }
32460      if (element.hasValue()) {
32461        composeType("value", element.getValue());
32462      }
32463  }
32464
32465  protected void composeBasic(String name, Basic element) throws IOException {
32466    if (element != null) {
32467      prop("resourceType", name);
32468      composeBasicInner(element);
32469    }
32470  }
32471
32472  protected void composeBasicInner(Basic element) throws IOException {
32473      composeDomainResourceElements(element);
32474      if (element.hasIdentifier()) {
32475        openArray("identifier");
32476        for (Identifier e : element.getIdentifier()) 
32477          composeIdentifier(null, e);
32478        closeArray();
32479      };
32480      if (element.hasCode()) {
32481        composeCodeableConcept("code", element.getCode());
32482      }
32483      if (element.hasSubject()) {
32484        composeReference("subject", element.getSubject());
32485      }
32486      if (element.hasCreatedElement()) {
32487        composeDateCore("created", element.getCreatedElement(), false);
32488        composeDateExtras("created", element.getCreatedElement(), false);
32489      }
32490      if (element.hasAuthor()) {
32491        composeReference("author", element.getAuthor());
32492      }
32493  }
32494
32495  protected void composeBinary(String name, Binary element) throws IOException {
32496    if (element != null) {
32497      prop("resourceType", name);
32498      composeBinaryInner(element);
32499    }
32500  }
32501
32502  protected void composeBinaryInner(Binary element) throws IOException {
32503      composeResourceElements(element);
32504      if (element.hasContentTypeElement()) {
32505        composeCodeCore("contentType", element.getContentTypeElement(), false);
32506        composeCodeExtras("contentType", element.getContentTypeElement(), false);
32507      }
32508      if (element.hasSecurityContext()) {
32509        composeReference("securityContext", element.getSecurityContext());
32510      }
32511      if (element.hasDataElement()) {
32512        composeBase64BinaryCore("data", element.getDataElement(), false);
32513        composeBase64BinaryExtras("data", element.getDataElement(), false);
32514      }
32515  }
32516
32517  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
32518    if (element != null) {
32519      prop("resourceType", name);
32520      composeBiologicallyDerivedProductInner(element);
32521    }
32522  }
32523
32524  protected void composeBiologicallyDerivedProductInner(BiologicallyDerivedProduct element) throws IOException {
32525      composeDomainResourceElements(element);
32526      if (element.hasIdentifier()) {
32527        openArray("identifier");
32528        for (Identifier e : element.getIdentifier()) 
32529          composeIdentifier(null, e);
32530        closeArray();
32531      };
32532      if (element.hasProductCategoryElement()) {
32533        composeEnumerationCore("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
32534        composeEnumerationExtras("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
32535      }
32536      if (element.hasProductCode()) {
32537        composeCodeableConcept("productCode", element.getProductCode());
32538      }
32539      if (element.hasStatusElement()) {
32540        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
32541        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
32542      }
32543      if (element.hasRequest()) {
32544        openArray("request");
32545        for (Reference e : element.getRequest()) 
32546          composeReference(null, e);
32547        closeArray();
32548      };
32549      if (element.hasQuantityElement()) {
32550        composeIntegerCore("quantity", element.getQuantityElement(), false);
32551        composeIntegerExtras("quantity", element.getQuantityElement(), false);
32552      }
32553      if (element.hasParent()) {
32554        openArray("parent");
32555        for (Reference e : element.getParent()) 
32556          composeReference(null, e);
32557        closeArray();
32558      };
32559      if (element.hasCollection()) {
32560        composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
32561      }
32562      if (element.hasProcessing()) {
32563        openArray("processing");
32564        for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing()) 
32565          composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(null, e);
32566        closeArray();
32567      };
32568      if (element.hasManipulation()) {
32569        composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent("manipulation", element.getManipulation());
32570      }
32571      if (element.hasStorage()) {
32572        openArray("storage");
32573        for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage()) 
32574          composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(null, e);
32575        closeArray();
32576      };
32577  }
32578
32579  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
32580    if (element != null) {
32581      open(name);
32582      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(element);
32583      close();
32584    }
32585  }
32586
32587  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
32588      composeBackbone(element);
32589      if (element.hasCollector()) {
32590        composeReference("collector", element.getCollector());
32591      }
32592      if (element.hasSource()) {
32593        composeReference("source", element.getSource());
32594      }
32595      if (element.hasCollected()) {
32596        composeType("collected", element.getCollected());
32597      }
32598  }
32599
32600  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
32601    if (element != null) {
32602      open(name);
32603      composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(element);
32604      close();
32605    }
32606  }
32607
32608  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
32609      composeBackbone(element);
32610      if (element.hasDescriptionElement()) {
32611        composeStringCore("description", element.getDescriptionElement(), false);
32612        composeStringExtras("description", element.getDescriptionElement(), false);
32613      }
32614      if (element.hasProcedure()) {
32615        composeCodeableConcept("procedure", element.getProcedure());
32616      }
32617      if (element.hasAdditive()) {
32618        composeReference("additive", element.getAdditive());
32619      }
32620      if (element.hasTime()) {
32621        composeType("time", element.getTime());
32622      }
32623  }
32624
32625  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
32626    if (element != null) {
32627      open(name);
32628      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(element);
32629      close();
32630    }
32631  }
32632
32633  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
32634      composeBackbone(element);
32635      if (element.hasDescriptionElement()) {
32636        composeStringCore("description", element.getDescriptionElement(), false);
32637        composeStringExtras("description", element.getDescriptionElement(), false);
32638      }
32639      if (element.hasTime()) {
32640        composeType("time", element.getTime());
32641      }
32642  }
32643
32644  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
32645    if (element != null) {
32646      open(name);
32647      composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(element);
32648      close();
32649    }
32650  }
32651
32652  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
32653      composeBackbone(element);
32654      if (element.hasDescriptionElement()) {
32655        composeStringCore("description", element.getDescriptionElement(), false);
32656        composeStringExtras("description", element.getDescriptionElement(), false);
32657      }
32658      if (element.hasTemperatureElement()) {
32659        composeDecimalCore("temperature", element.getTemperatureElement(), false);
32660        composeDecimalExtras("temperature", element.getTemperatureElement(), false);
32661      }
32662      if (element.hasScaleElement()) {
32663        composeEnumerationCore("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
32664        composeEnumerationExtras("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
32665      }
32666      if (element.hasDuration()) {
32667        composePeriod("duration", element.getDuration());
32668      }
32669  }
32670
32671  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
32672    if (element != null) {
32673      prop("resourceType", name);
32674      composeBodyStructureInner(element);
32675    }
32676  }
32677
32678  protected void composeBodyStructureInner(BodyStructure element) throws IOException {
32679      composeDomainResourceElements(element);
32680      if (element.hasIdentifier()) {
32681        openArray("identifier");
32682        for (Identifier e : element.getIdentifier()) 
32683          composeIdentifier(null, e);
32684        closeArray();
32685      };
32686      if (element.hasActiveElement()) {
32687        composeBooleanCore("active", element.getActiveElement(), false);
32688        composeBooleanExtras("active", element.getActiveElement(), false);
32689      }
32690      if (element.hasMorphology()) {
32691        composeCodeableConcept("morphology", element.getMorphology());
32692      }
32693      if (element.hasLocation()) {
32694        composeCodeableConcept("location", element.getLocation());
32695      }
32696      if (element.hasLocationQualifier()) {
32697        openArray("locationQualifier");
32698        for (CodeableConcept e : element.getLocationQualifier()) 
32699          composeCodeableConcept(null, e);
32700        closeArray();
32701      };
32702      if (element.hasDescriptionElement()) {
32703        composeStringCore("description", element.getDescriptionElement(), false);
32704        composeStringExtras("description", element.getDescriptionElement(), false);
32705      }
32706      if (element.hasImage()) {
32707        openArray("image");
32708        for (Attachment e : element.getImage()) 
32709          composeAttachment(null, e);
32710        closeArray();
32711      };
32712      if (element.hasPatient()) {
32713        composeReference("patient", element.getPatient());
32714      }
32715  }
32716
32717  protected void composeBundle(String name, Bundle element) throws IOException {
32718    if (element != null) {
32719      prop("resourceType", name);
32720      composeBundleInner(element);
32721    }
32722  }
32723
32724  protected void composeBundleInner(Bundle element) throws IOException {
32725      composeResourceElements(element);
32726      if (element.hasIdentifier()) {
32727        composeIdentifier("identifier", element.getIdentifier());
32728      }
32729      if (element.hasTypeElement()) {
32730        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
32731        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
32732      }
32733      if (element.hasTimestampElement()) {
32734        composeInstantCore("timestamp", element.getTimestampElement(), false);
32735        composeInstantExtras("timestamp", element.getTimestampElement(), false);
32736      }
32737      if (element.hasTotalElement()) {
32738        composeUnsignedIntCore("total", element.getTotalElement(), false);
32739        composeUnsignedIntExtras("total", element.getTotalElement(), false);
32740      }
32741      if (element.hasLink()) {
32742        openArray("link");
32743        for (Bundle.BundleLinkComponent e : element.getLink()) 
32744          composeBundleBundleLinkComponent(null, e);
32745        closeArray();
32746      };
32747      if (element.hasEntry()) {
32748        openArray("entry");
32749        for (Bundle.BundleEntryComponent e : element.getEntry()) 
32750          composeBundleBundleEntryComponent(null, e);
32751        closeArray();
32752      };
32753      if (element.hasSignature()) {
32754        composeSignature("signature", element.getSignature());
32755      }
32756  }
32757
32758  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
32759    if (element != null) {
32760      open(name);
32761      composeBundleBundleLinkComponentInner(element);
32762      close();
32763    }
32764  }
32765
32766  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
32767      composeBackbone(element);
32768      if (element.hasRelationElement()) {
32769        composeStringCore("relation", element.getRelationElement(), false);
32770        composeStringExtras("relation", element.getRelationElement(), false);
32771      }
32772      if (element.hasUrlElement()) {
32773        composeUriCore("url", element.getUrlElement(), false);
32774        composeUriExtras("url", element.getUrlElement(), false);
32775      }
32776  }
32777
32778  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
32779    if (element != null) {
32780      open(name);
32781      composeBundleBundleEntryComponentInner(element);
32782      close();
32783    }
32784  }
32785
32786  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
32787      composeBackbone(element);
32788      if (element.hasLink()) {
32789        openArray("link");
32790        for (Bundle.BundleLinkComponent e : element.getLink()) 
32791          composeBundleBundleLinkComponent(null, e);
32792        closeArray();
32793      };
32794      if (element.hasFullUrlElement()) {
32795        composeUriCore("fullUrl", element.getFullUrlElement(), false);
32796        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
32797      }
32798        if (element.hasResource()) {
32799          open("resource");
32800          composeResource(element.getResource());
32801          close();
32802        }
32803      if (element.hasSearch()) {
32804        composeBundleBundleEntrySearchComponent("search", element.getSearch());
32805      }
32806      if (element.hasRequest()) {
32807        composeBundleBundleEntryRequestComponent("request", element.getRequest());
32808      }
32809      if (element.hasResponse()) {
32810        composeBundleBundleEntryResponseComponent("response", element.getResponse());
32811      }
32812  }
32813
32814  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
32815    if (element != null) {
32816      open(name);
32817      composeBundleBundleEntrySearchComponentInner(element);
32818      close();
32819    }
32820  }
32821
32822  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
32823      composeBackbone(element);
32824      if (element.hasModeElement()) {
32825        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
32826        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
32827      }
32828      if (element.hasScoreElement()) {
32829        composeDecimalCore("score", element.getScoreElement(), false);
32830        composeDecimalExtras("score", element.getScoreElement(), false);
32831      }
32832  }
32833
32834  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
32835    if (element != null) {
32836      open(name);
32837      composeBundleBundleEntryRequestComponentInner(element);
32838      close();
32839    }
32840  }
32841
32842  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
32843      composeBackbone(element);
32844      if (element.hasMethodElement()) {
32845        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
32846        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
32847      }
32848      if (element.hasUrlElement()) {
32849        composeUriCore("url", element.getUrlElement(), false);
32850        composeUriExtras("url", element.getUrlElement(), false);
32851      }
32852      if (element.hasIfNoneMatchElement()) {
32853        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
32854        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
32855      }
32856      if (element.hasIfModifiedSinceElement()) {
32857        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
32858        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
32859      }
32860      if (element.hasIfMatchElement()) {
32861        composeStringCore("ifMatch", element.getIfMatchElement(), false);
32862        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
32863      }
32864      if (element.hasIfNoneExistElement()) {
32865        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
32866        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
32867      }
32868  }
32869
32870  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
32871    if (element != null) {
32872      open(name);
32873      composeBundleBundleEntryResponseComponentInner(element);
32874      close();
32875    }
32876  }
32877
32878  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
32879      composeBackbone(element);
32880      if (element.hasStatusElement()) {
32881        composeStringCore("status", element.getStatusElement(), false);
32882        composeStringExtras("status", element.getStatusElement(), false);
32883      }
32884      if (element.hasLocationElement()) {
32885        composeUriCore("location", element.getLocationElement(), false);
32886        composeUriExtras("location", element.getLocationElement(), false);
32887      }
32888      if (element.hasEtagElement()) {
32889        composeStringCore("etag", element.getEtagElement(), false);
32890        composeStringExtras("etag", element.getEtagElement(), false);
32891      }
32892      if (element.hasLastModifiedElement()) {
32893        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
32894        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
32895      }
32896        if (element.hasOutcome()) {
32897          open("outcome");
32898          composeResource(element.getOutcome());
32899          close();
32900        }
32901  }
32902
32903  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
32904    if (element != null) {
32905      prop("resourceType", name);
32906      composeCapabilityStatementInner(element);
32907    }
32908  }
32909
32910  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
32911      composeDomainResourceElements(element);
32912      if (element.hasUrlElement()) {
32913        composeUriCore("url", element.getUrlElement(), false);
32914        composeUriExtras("url", element.getUrlElement(), false);
32915      }
32916      if (element.hasVersionElement()) {
32917        composeStringCore("version", element.getVersionElement(), false);
32918        composeStringExtras("version", element.getVersionElement(), false);
32919      }
32920      if (element.hasNameElement()) {
32921        composeStringCore("name", element.getNameElement(), false);
32922        composeStringExtras("name", element.getNameElement(), false);
32923      }
32924      if (element.hasTitleElement()) {
32925        composeStringCore("title", element.getTitleElement(), false);
32926        composeStringExtras("title", element.getTitleElement(), false);
32927      }
32928      if (element.hasStatusElement()) {
32929        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32930        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32931      }
32932      if (element.hasExperimentalElement()) {
32933        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32934        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32935      }
32936      if (element.hasDateElement()) {
32937        composeDateTimeCore("date", element.getDateElement(), false);
32938        composeDateTimeExtras("date", element.getDateElement(), false);
32939      }
32940      if (element.hasPublisherElement()) {
32941        composeStringCore("publisher", element.getPublisherElement(), false);
32942        composeStringExtras("publisher", element.getPublisherElement(), false);
32943      }
32944      if (element.hasContact()) {
32945        openArray("contact");
32946        for (ContactDetail e : element.getContact()) 
32947          composeContactDetail(null, e);
32948        closeArray();
32949      };
32950      if (element.hasDescriptionElement()) {
32951        composeMarkdownCore("description", element.getDescriptionElement(), false);
32952        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32953      }
32954      if (element.hasUseContext()) {
32955        openArray("useContext");
32956        for (UsageContext e : element.getUseContext()) 
32957          composeUsageContext(null, e);
32958        closeArray();
32959      };
32960      if (element.hasJurisdiction()) {
32961        openArray("jurisdiction");
32962        for (CodeableConcept e : element.getJurisdiction()) 
32963          composeCodeableConcept(null, e);
32964        closeArray();
32965      };
32966      if (element.hasPurposeElement()) {
32967        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32968        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32969      }
32970      if (element.hasCopyrightElement()) {
32971        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32972        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32973      }
32974      if (element.hasKindElement()) {
32975        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
32976        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
32977      }
32978      if (element.hasInstantiates()) {
32979        openArray("instantiates");
32980        for (CanonicalType e : element.getInstantiates()) 
32981          composeCanonicalCore(null, e, true);
32982        closeArray();
32983        if (anyHasExtras(element.getInstantiates())) {
32984          openArray("_instantiates");
32985          for (CanonicalType e : element.getInstantiates()) 
32986            composeCanonicalExtras(null, e, true);
32987          closeArray();
32988        }
32989      };
32990      if (element.hasImports()) {
32991        openArray("imports");
32992        for (CanonicalType e : element.getImports()) 
32993          composeCanonicalCore(null, e, true);
32994        closeArray();
32995        if (anyHasExtras(element.getImports())) {
32996          openArray("_imports");
32997          for (CanonicalType e : element.getImports()) 
32998            composeCanonicalExtras(null, e, true);
32999          closeArray();
33000        }
33001      };
33002      if (element.hasSoftware()) {
33003        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
33004      }
33005      if (element.hasImplementation()) {
33006        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
33007      }
33008      if (element.hasFhirVersionElement()) {
33009        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
33010        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
33011      }
33012      if (element.hasFormat()) {
33013        openArray("format");
33014        for (CodeType e : element.getFormat()) 
33015          composeCodeCore(null, e, true);
33016        closeArray();
33017        if (anyHasExtras(element.getFormat())) {
33018          openArray("_format");
33019          for (CodeType e : element.getFormat()) 
33020            composeCodeExtras(null, e, true);
33021          closeArray();
33022        }
33023      };
33024      if (element.hasPatchFormat()) {
33025        openArray("patchFormat");
33026        for (CodeType e : element.getPatchFormat()) 
33027          composeCodeCore(null, e, true);
33028        closeArray();
33029        if (anyHasExtras(element.getPatchFormat())) {
33030          openArray("_patchFormat");
33031          for (CodeType e : element.getPatchFormat()) 
33032            composeCodeExtras(null, e, true);
33033          closeArray();
33034        }
33035      };
33036      if (element.hasImplementationGuide()) {
33037        openArray("implementationGuide");
33038        for (CanonicalType e : element.getImplementationGuide()) 
33039          composeCanonicalCore(null, e, true);
33040        closeArray();
33041        if (anyHasExtras(element.getImplementationGuide())) {
33042          openArray("_implementationGuide");
33043          for (CanonicalType e : element.getImplementationGuide()) 
33044            composeCanonicalExtras(null, e, true);
33045          closeArray();
33046        }
33047      };
33048      if (element.hasRest()) {
33049        openArray("rest");
33050        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
33051          composeCapabilityStatementCapabilityStatementRestComponent(null, e);
33052        closeArray();
33053      };
33054      if (element.hasMessaging()) {
33055        openArray("messaging");
33056        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
33057          composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
33058        closeArray();
33059      };
33060      if (element.hasDocument()) {
33061        openArray("document");
33062        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
33063          composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
33064        closeArray();
33065      };
33066  }
33067
33068  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
33069    if (element != null) {
33070      open(name);
33071      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
33072      close();
33073    }
33074  }
33075
33076  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
33077      composeBackbone(element);
33078      if (element.hasNameElement()) {
33079        composeStringCore("name", element.getNameElement(), false);
33080        composeStringExtras("name", element.getNameElement(), false);
33081      }
33082      if (element.hasVersionElement()) {
33083        composeStringCore("version", element.getVersionElement(), false);
33084        composeStringExtras("version", element.getVersionElement(), false);
33085      }
33086      if (element.hasReleaseDateElement()) {
33087        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
33088        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
33089      }
33090  }
33091
33092  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
33093    if (element != null) {
33094      open(name);
33095      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
33096      close();
33097    }
33098  }
33099
33100  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
33101      composeBackbone(element);
33102      if (element.hasDescriptionElement()) {
33103        composeStringCore("description", element.getDescriptionElement(), false);
33104        composeStringExtras("description", element.getDescriptionElement(), false);
33105      }
33106      if (element.hasUrlElement()) {
33107        composeUrlCore("url", element.getUrlElement(), false);
33108        composeUrlExtras("url", element.getUrlElement(), false);
33109      }
33110      if (element.hasCustodian()) {
33111        composeReference("custodian", element.getCustodian());
33112      }
33113  }
33114
33115  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
33116    if (element != null) {
33117      open(name);
33118      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
33119      close();
33120    }
33121  }
33122
33123  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
33124      composeBackbone(element);
33125      if (element.hasModeElement()) {
33126        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
33127        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
33128      }
33129      if (element.hasDocumentationElement()) {
33130        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33131        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33132      }
33133      if (element.hasSecurity()) {
33134        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
33135      }
33136      if (element.hasResource()) {
33137        openArray("resource");
33138        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
33139          composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
33140        closeArray();
33141      };
33142      if (element.hasInteraction()) {
33143        openArray("interaction");
33144        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
33145          composeCapabilityStatementSystemInteractionComponent(null, e);
33146        closeArray();
33147      };
33148      if (element.hasSearchParam()) {
33149        openArray("searchParam");
33150        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
33151          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
33152        closeArray();
33153      };
33154      if (element.hasOperation()) {
33155        openArray("operation");
33156        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
33157          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
33158        closeArray();
33159      };
33160      if (element.hasCompartment()) {
33161        openArray("compartment");
33162        for (CanonicalType e : element.getCompartment()) 
33163          composeCanonicalCore(null, e, true);
33164        closeArray();
33165        if (anyHasExtras(element.getCompartment())) {
33166          openArray("_compartment");
33167          for (CanonicalType e : element.getCompartment()) 
33168            composeCanonicalExtras(null, e, true);
33169          closeArray();
33170        }
33171      };
33172  }
33173
33174  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
33175    if (element != null) {
33176      open(name);
33177      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
33178      close();
33179    }
33180  }
33181
33182  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
33183      composeBackbone(element);
33184      if (element.hasCorsElement()) {
33185        composeBooleanCore("cors", element.getCorsElement(), false);
33186        composeBooleanExtras("cors", element.getCorsElement(), false);
33187      }
33188      if (element.hasService()) {
33189        openArray("service");
33190        for (CodeableConcept e : element.getService()) 
33191          composeCodeableConcept(null, e);
33192        closeArray();
33193      };
33194      if (element.hasDescriptionElement()) {
33195        composeMarkdownCore("description", element.getDescriptionElement(), false);
33196        composeMarkdownExtras("description", element.getDescriptionElement(), false);
33197      }
33198  }
33199
33200  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
33201    if (element != null) {
33202      open(name);
33203      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
33204      close();
33205    }
33206  }
33207
33208  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
33209      composeBackbone(element);
33210      if (element.hasTypeElement()) {
33211        composeCodeCore("type", element.getTypeElement(), false);
33212        composeCodeExtras("type", element.getTypeElement(), false);
33213      }
33214      if (element.hasProfileElement()) {
33215        composeCanonicalCore("profile", element.getProfileElement(), false);
33216        composeCanonicalExtras("profile", element.getProfileElement(), false);
33217      }
33218      if (element.hasSupportedProfile()) {
33219        openArray("supportedProfile");
33220        for (CanonicalType e : element.getSupportedProfile()) 
33221          composeCanonicalCore(null, e, true);
33222        closeArray();
33223        if (anyHasExtras(element.getSupportedProfile())) {
33224          openArray("_supportedProfile");
33225          for (CanonicalType e : element.getSupportedProfile()) 
33226            composeCanonicalExtras(null, e, true);
33227          closeArray();
33228        }
33229      };
33230      if (element.hasDocumentationElement()) {
33231        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33232        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33233      }
33234      if (element.hasInteraction()) {
33235        openArray("interaction");
33236        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
33237          composeCapabilityStatementResourceInteractionComponent(null, e);
33238        closeArray();
33239      };
33240      if (element.hasVersioningElement()) {
33241        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
33242        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
33243      }
33244      if (element.hasReadHistoryElement()) {
33245        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
33246        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
33247      }
33248      if (element.hasUpdateCreateElement()) {
33249        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
33250        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
33251      }
33252      if (element.hasConditionalCreateElement()) {
33253        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
33254        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
33255      }
33256      if (element.hasConditionalReadElement()) {
33257        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
33258        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
33259      }
33260      if (element.hasConditionalUpdateElement()) {
33261        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
33262        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
33263      }
33264      if (element.hasConditionalDeleteElement()) {
33265        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
33266        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
33267      }
33268      if (element.hasReferencePolicy()) {
33269        openArray("referencePolicy");
33270        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
33271          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
33272        closeArray();
33273        if (anyHasExtras(element.getReferencePolicy())) {
33274          openArray("_referencePolicy");
33275          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
33276            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
33277          closeArray();
33278        }
33279      };
33280      if (element.hasSearchInclude()) {
33281        openArray("searchInclude");
33282        for (StringType e : element.getSearchInclude()) 
33283          composeStringCore(null, e, true);
33284        closeArray();
33285        if (anyHasExtras(element.getSearchInclude())) {
33286          openArray("_searchInclude");
33287          for (StringType e : element.getSearchInclude()) 
33288            composeStringExtras(null, e, true);
33289          closeArray();
33290        }
33291      };
33292      if (element.hasSearchRevInclude()) {
33293        openArray("searchRevInclude");
33294        for (StringType e : element.getSearchRevInclude()) 
33295          composeStringCore(null, e, true);
33296        closeArray();
33297        if (anyHasExtras(element.getSearchRevInclude())) {
33298          openArray("_searchRevInclude");
33299          for (StringType e : element.getSearchRevInclude()) 
33300            composeStringExtras(null, e, true);
33301          closeArray();
33302        }
33303      };
33304      if (element.hasSearchParam()) {
33305        openArray("searchParam");
33306        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
33307          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
33308        closeArray();
33309      };
33310      if (element.hasOperation()) {
33311        openArray("operation");
33312        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
33313          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
33314        closeArray();
33315      };
33316  }
33317
33318  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
33319    if (element != null) {
33320      open(name);
33321      composeCapabilityStatementResourceInteractionComponentInner(element);
33322      close();
33323    }
33324  }
33325
33326  protected void composeCapabilityStatementResourceInteractionComponentInner(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
33327      composeBackbone(element);
33328      if (element.hasCodeElement()) {
33329        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
33330        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
33331      }
33332      if (element.hasDocumentationElement()) {
33333        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33334        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33335      }
33336  }
33337
33338  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
33339    if (element != null) {
33340      open(name);
33341      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
33342      close();
33343    }
33344  }
33345
33346  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
33347      composeBackbone(element);
33348      if (element.hasNameElement()) {
33349        composeStringCore("name", element.getNameElement(), false);
33350        composeStringExtras("name", element.getNameElement(), false);
33351      }
33352      if (element.hasDefinitionElement()) {
33353        composeCanonicalCore("definition", element.getDefinitionElement(), false);
33354        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
33355      }
33356      if (element.hasTypeElement()) {
33357        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
33358        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
33359      }
33360      if (element.hasDocumentationElement()) {
33361        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33362        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33363      }
33364  }
33365
33366  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
33367    if (element != null) {
33368      open(name);
33369      composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(element);
33370      close();
33371    }
33372  }
33373
33374  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
33375      composeBackbone(element);
33376      if (element.hasNameElement()) {
33377        composeStringCore("name", element.getNameElement(), false);
33378        composeStringExtras("name", element.getNameElement(), false);
33379      }
33380      if (element.hasDefinitionElement()) {
33381        composeCanonicalCore("definition", element.getDefinitionElement(), false);
33382        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
33383      }
33384      if (element.hasDocumentationElement()) {
33385        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33386        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33387      }
33388  }
33389
33390  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
33391    if (element != null) {
33392      open(name);
33393      composeCapabilityStatementSystemInteractionComponentInner(element);
33394      close();
33395    }
33396  }
33397
33398  protected void composeCapabilityStatementSystemInteractionComponentInner(CapabilityStatement.SystemInteractionComponent element) throws IOException {
33399      composeBackbone(element);
33400      if (element.hasCodeElement()) {
33401        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
33402        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
33403      }
33404      if (element.hasDocumentationElement()) {
33405        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33406        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33407      }
33408  }
33409
33410  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
33411    if (element != null) {
33412      open(name);
33413      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
33414      close();
33415    }
33416  }
33417
33418  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
33419      composeBackbone(element);
33420      if (element.hasEndpoint()) {
33421        openArray("endpoint");
33422        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
33423          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
33424        closeArray();
33425      };
33426      if (element.hasReliableCacheElement()) {
33427        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
33428        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
33429      }
33430      if (element.hasDocumentationElement()) {
33431        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33432        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33433      }
33434      if (element.hasSupportedMessage()) {
33435        openArray("supportedMessage");
33436        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
33437          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
33438        closeArray();
33439      };
33440  }
33441
33442  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
33443    if (element != null) {
33444      open(name);
33445      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
33446      close();
33447    }
33448  }
33449
33450  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
33451      composeBackbone(element);
33452      if (element.hasProtocol()) {
33453        composeCoding("protocol", element.getProtocol());
33454      }
33455      if (element.hasAddressElement()) {
33456        composeUrlCore("address", element.getAddressElement(), false);
33457        composeUrlExtras("address", element.getAddressElement(), false);
33458      }
33459  }
33460
33461  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
33462    if (element != null) {
33463      open(name);
33464      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
33465      close();
33466    }
33467  }
33468
33469  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
33470      composeBackbone(element);
33471      if (element.hasModeElement()) {
33472        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
33473        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
33474      }
33475      if (element.hasDefinitionElement()) {
33476        composeCanonicalCore("definition", element.getDefinitionElement(), false);
33477        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
33478      }
33479  }
33480
33481  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
33482    if (element != null) {
33483      open(name);
33484      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
33485      close();
33486    }
33487  }
33488
33489  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
33490      composeBackbone(element);
33491      if (element.hasModeElement()) {
33492        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
33493        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
33494      }
33495      if (element.hasDocumentationElement()) {
33496        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
33497        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
33498      }
33499      if (element.hasProfileElement()) {
33500        composeCanonicalCore("profile", element.getProfileElement(), false);
33501        composeCanonicalExtras("profile", element.getProfileElement(), false);
33502      }
33503  }
33504
33505  protected void composeCarePlan(String name, CarePlan element) throws IOException {
33506    if (element != null) {
33507      prop("resourceType", name);
33508      composeCarePlanInner(element);
33509    }
33510  }
33511
33512  protected void composeCarePlanInner(CarePlan element) throws IOException {
33513      composeDomainResourceElements(element);
33514      if (element.hasIdentifier()) {
33515        openArray("identifier");
33516        for (Identifier e : element.getIdentifier()) 
33517          composeIdentifier(null, e);
33518        closeArray();
33519      };
33520      if (element.hasInstantiatesCanonical()) {
33521        openArray("instantiatesCanonical");
33522        for (CanonicalType e : element.getInstantiatesCanonical()) 
33523          composeCanonicalCore(null, e, true);
33524        closeArray();
33525        if (anyHasExtras(element.getInstantiatesCanonical())) {
33526          openArray("_instantiatesCanonical");
33527          for (CanonicalType e : element.getInstantiatesCanonical()) 
33528            composeCanonicalExtras(null, e, true);
33529          closeArray();
33530        }
33531      };
33532      if (element.hasInstantiatesUri()) {
33533        openArray("instantiatesUri");
33534        for (UriType e : element.getInstantiatesUri()) 
33535          composeUriCore(null, e, true);
33536        closeArray();
33537        if (anyHasExtras(element.getInstantiatesUri())) {
33538          openArray("_instantiatesUri");
33539          for (UriType e : element.getInstantiatesUri()) 
33540            composeUriExtras(null, e, true);
33541          closeArray();
33542        }
33543      };
33544      if (element.hasBasedOn()) {
33545        openArray("basedOn");
33546        for (Reference e : element.getBasedOn()) 
33547          composeReference(null, e);
33548        closeArray();
33549      };
33550      if (element.hasReplaces()) {
33551        openArray("replaces");
33552        for (Reference e : element.getReplaces()) 
33553          composeReference(null, e);
33554        closeArray();
33555      };
33556      if (element.hasPartOf()) {
33557        openArray("partOf");
33558        for (Reference e : element.getPartOf()) 
33559          composeReference(null, e);
33560        closeArray();
33561      };
33562      if (element.hasStatusElement()) {
33563        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
33564        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
33565      }
33566      if (element.hasIntentElement()) {
33567        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
33568        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
33569      }
33570      if (element.hasCategory()) {
33571        openArray("category");
33572        for (CodeableConcept e : element.getCategory()) 
33573          composeCodeableConcept(null, e);
33574        closeArray();
33575      };
33576      if (element.hasTitleElement()) {
33577        composeStringCore("title", element.getTitleElement(), false);
33578        composeStringExtras("title", element.getTitleElement(), false);
33579      }
33580      if (element.hasDescriptionElement()) {
33581        composeStringCore("description", element.getDescriptionElement(), false);
33582        composeStringExtras("description", element.getDescriptionElement(), false);
33583      }
33584      if (element.hasSubject()) {
33585        composeReference("subject", element.getSubject());
33586      }
33587      if (element.hasEncounter()) {
33588        composeReference("encounter", element.getEncounter());
33589      }
33590      if (element.hasPeriod()) {
33591        composePeriod("period", element.getPeriod());
33592      }
33593      if (element.hasCreatedElement()) {
33594        composeDateTimeCore("created", element.getCreatedElement(), false);
33595        composeDateTimeExtras("created", element.getCreatedElement(), false);
33596      }
33597      if (element.hasAuthor()) {
33598        composeReference("author", element.getAuthor());
33599      }
33600      if (element.hasContributor()) {
33601        openArray("contributor");
33602        for (Reference e : element.getContributor()) 
33603          composeReference(null, e);
33604        closeArray();
33605      };
33606      if (element.hasCareTeam()) {
33607        openArray("careTeam");
33608        for (Reference e : element.getCareTeam()) 
33609          composeReference(null, e);
33610        closeArray();
33611      };
33612      if (element.hasAddresses()) {
33613        openArray("addresses");
33614        for (Reference e : element.getAddresses()) 
33615          composeReference(null, e);
33616        closeArray();
33617      };
33618      if (element.hasSupportingInfo()) {
33619        openArray("supportingInfo");
33620        for (Reference e : element.getSupportingInfo()) 
33621          composeReference(null, e);
33622        closeArray();
33623      };
33624      if (element.hasGoal()) {
33625        openArray("goal");
33626        for (Reference e : element.getGoal()) 
33627          composeReference(null, e);
33628        closeArray();
33629      };
33630      if (element.hasActivity()) {
33631        openArray("activity");
33632        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
33633          composeCarePlanCarePlanActivityComponent(null, e);
33634        closeArray();
33635      };
33636      if (element.hasNote()) {
33637        openArray("note");
33638        for (Annotation e : element.getNote()) 
33639          composeAnnotation(null, e);
33640        closeArray();
33641      };
33642  }
33643
33644  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
33645    if (element != null) {
33646      open(name);
33647      composeCarePlanCarePlanActivityComponentInner(element);
33648      close();
33649    }
33650  }
33651
33652  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
33653      composeBackbone(element);
33654      if (element.hasOutcomeCodeableConcept()) {
33655        openArray("outcomeCodeableConcept");
33656        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
33657          composeCodeableConcept(null, e);
33658        closeArray();
33659      };
33660      if (element.hasOutcomeReference()) {
33661        openArray("outcomeReference");
33662        for (Reference e : element.getOutcomeReference()) 
33663          composeReference(null, e);
33664        closeArray();
33665      };
33666      if (element.hasProgress()) {
33667        openArray("progress");
33668        for (Annotation e : element.getProgress()) 
33669          composeAnnotation(null, e);
33670        closeArray();
33671      };
33672      if (element.hasReference()) {
33673        composeReference("reference", element.getReference());
33674      }
33675      if (element.hasDetail()) {
33676        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
33677      }
33678  }
33679
33680  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
33681    if (element != null) {
33682      open(name);
33683      composeCarePlanCarePlanActivityDetailComponentInner(element);
33684      close();
33685    }
33686  }
33687
33688  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
33689      composeBackbone(element);
33690      if (element.hasKindElement()) {
33691        composeEnumerationCore("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
33692        composeEnumerationExtras("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
33693      }
33694      if (element.hasInstantiatesCanonical()) {
33695        openArray("instantiatesCanonical");
33696        for (CanonicalType e : element.getInstantiatesCanonical()) 
33697          composeCanonicalCore(null, e, true);
33698        closeArray();
33699        if (anyHasExtras(element.getInstantiatesCanonical())) {
33700          openArray("_instantiatesCanonical");
33701          for (CanonicalType e : element.getInstantiatesCanonical()) 
33702            composeCanonicalExtras(null, e, true);
33703          closeArray();
33704        }
33705      };
33706      if (element.hasInstantiatesUri()) {
33707        openArray("instantiatesUri");
33708        for (UriType e : element.getInstantiatesUri()) 
33709          composeUriCore(null, e, true);
33710        closeArray();
33711        if (anyHasExtras(element.getInstantiatesUri())) {
33712          openArray("_instantiatesUri");
33713          for (UriType e : element.getInstantiatesUri()) 
33714            composeUriExtras(null, e, true);
33715          closeArray();
33716        }
33717      };
33718      if (element.hasCode()) {
33719        composeCodeableConcept("code", element.getCode());
33720      }
33721      if (element.hasReasonCode()) {
33722        openArray("reasonCode");
33723        for (CodeableConcept e : element.getReasonCode()) 
33724          composeCodeableConcept(null, e);
33725        closeArray();
33726      };
33727      if (element.hasReasonReference()) {
33728        openArray("reasonReference");
33729        for (Reference e : element.getReasonReference()) 
33730          composeReference(null, e);
33731        closeArray();
33732      };
33733      if (element.hasGoal()) {
33734        openArray("goal");
33735        for (Reference e : element.getGoal()) 
33736          composeReference(null, e);
33737        closeArray();
33738      };
33739      if (element.hasStatusElement()) {
33740        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
33741        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
33742      }
33743      if (element.hasStatusReason()) {
33744        composeCodeableConcept("statusReason", element.getStatusReason());
33745      }
33746      if (element.hasDoNotPerformElement()) {
33747        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
33748        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
33749      }
33750      if (element.hasScheduled()) {
33751        composeType("scheduled", element.getScheduled());
33752      }
33753      if (element.hasLocation()) {
33754        composeReference("location", element.getLocation());
33755      }
33756      if (element.hasPerformer()) {
33757        openArray("performer");
33758        for (Reference e : element.getPerformer()) 
33759          composeReference(null, e);
33760        closeArray();
33761      };
33762      if (element.hasProduct()) {
33763        composeType("product", element.getProduct());
33764      }
33765      if (element.hasDailyAmount()) {
33766        composeQuantity("dailyAmount", element.getDailyAmount());
33767      }
33768      if (element.hasQuantity()) {
33769        composeQuantity("quantity", element.getQuantity());
33770      }
33771      if (element.hasDescriptionElement()) {
33772        composeStringCore("description", element.getDescriptionElement(), false);
33773        composeStringExtras("description", element.getDescriptionElement(), false);
33774      }
33775  }
33776
33777  protected void composeCareTeam(String name, CareTeam element) throws IOException {
33778    if (element != null) {
33779      prop("resourceType", name);
33780      composeCareTeamInner(element);
33781    }
33782  }
33783
33784  protected void composeCareTeamInner(CareTeam element) throws IOException {
33785      composeDomainResourceElements(element);
33786      if (element.hasIdentifier()) {
33787        openArray("identifier");
33788        for (Identifier e : element.getIdentifier()) 
33789          composeIdentifier(null, e);
33790        closeArray();
33791      };
33792      if (element.hasStatusElement()) {
33793        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
33794        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
33795      }
33796      if (element.hasCategory()) {
33797        openArray("category");
33798        for (CodeableConcept e : element.getCategory()) 
33799          composeCodeableConcept(null, e);
33800        closeArray();
33801      };
33802      if (element.hasNameElement()) {
33803        composeStringCore("name", element.getNameElement(), false);
33804        composeStringExtras("name", element.getNameElement(), false);
33805      }
33806      if (element.hasSubject()) {
33807        composeReference("subject", element.getSubject());
33808      }
33809      if (element.hasEncounter()) {
33810        composeReference("encounter", element.getEncounter());
33811      }
33812      if (element.hasPeriod()) {
33813        composePeriod("period", element.getPeriod());
33814      }
33815      if (element.hasParticipant()) {
33816        openArray("participant");
33817        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
33818          composeCareTeamCareTeamParticipantComponent(null, e);
33819        closeArray();
33820      };
33821      if (element.hasReasonCode()) {
33822        openArray("reasonCode");
33823        for (CodeableConcept e : element.getReasonCode()) 
33824          composeCodeableConcept(null, e);
33825        closeArray();
33826      };
33827      if (element.hasReasonReference()) {
33828        openArray("reasonReference");
33829        for (Reference e : element.getReasonReference()) 
33830          composeReference(null, e);
33831        closeArray();
33832      };
33833      if (element.hasManagingOrganization()) {
33834        openArray("managingOrganization");
33835        for (Reference e : element.getManagingOrganization()) 
33836          composeReference(null, e);
33837        closeArray();
33838      };
33839      if (element.hasTelecom()) {
33840        openArray("telecom");
33841        for (ContactPoint e : element.getTelecom()) 
33842          composeContactPoint(null, e);
33843        closeArray();
33844      };
33845      if (element.hasNote()) {
33846        openArray("note");
33847        for (Annotation e : element.getNote()) 
33848          composeAnnotation(null, e);
33849        closeArray();
33850      };
33851  }
33852
33853  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
33854    if (element != null) {
33855      open(name);
33856      composeCareTeamCareTeamParticipantComponentInner(element);
33857      close();
33858    }
33859  }
33860
33861  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
33862      composeBackbone(element);
33863      if (element.hasRole()) {
33864        openArray("role");
33865        for (CodeableConcept e : element.getRole()) 
33866          composeCodeableConcept(null, e);
33867        closeArray();
33868      };
33869      if (element.hasMember()) {
33870        composeReference("member", element.getMember());
33871      }
33872      if (element.hasOnBehalfOf()) {
33873        composeReference("onBehalfOf", element.getOnBehalfOf());
33874      }
33875      if (element.hasPeriod()) {
33876        composePeriod("period", element.getPeriod());
33877      }
33878  }
33879
33880  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
33881    if (element != null) {
33882      prop("resourceType", name);
33883      composeCatalogEntryInner(element);
33884    }
33885  }
33886
33887  protected void composeCatalogEntryInner(CatalogEntry element) throws IOException {
33888      composeDomainResourceElements(element);
33889      if (element.hasIdentifier()) {
33890        openArray("identifier");
33891        for (Identifier e : element.getIdentifier()) 
33892          composeIdentifier(null, e);
33893        closeArray();
33894      };
33895      if (element.hasType()) {
33896        composeCodeableConcept("type", element.getType());
33897      }
33898      if (element.hasOrderableElement()) {
33899        composeBooleanCore("orderable", element.getOrderableElement(), false);
33900        composeBooleanExtras("orderable", element.getOrderableElement(), false);
33901      }
33902      if (element.hasReferencedItem()) {
33903        composeReference("referencedItem", element.getReferencedItem());
33904      }
33905      if (element.hasAdditionalIdentifier()) {
33906        openArray("additionalIdentifier");
33907        for (Identifier e : element.getAdditionalIdentifier()) 
33908          composeIdentifier(null, e);
33909        closeArray();
33910      };
33911      if (element.hasClassification()) {
33912        openArray("classification");
33913        for (CodeableConcept e : element.getClassification()) 
33914          composeCodeableConcept(null, e);
33915        closeArray();
33916      };
33917      if (element.hasStatusElement()) {
33918        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33919        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33920      }
33921      if (element.hasValidityPeriod()) {
33922        composePeriod("validityPeriod", element.getValidityPeriod());
33923      }
33924      if (element.hasValidToElement()) {
33925        composeDateTimeCore("validTo", element.getValidToElement(), false);
33926        composeDateTimeExtras("validTo", element.getValidToElement(), false);
33927      }
33928      if (element.hasLastUpdatedElement()) {
33929        composeDateTimeCore("lastUpdated", element.getLastUpdatedElement(), false);
33930        composeDateTimeExtras("lastUpdated", element.getLastUpdatedElement(), false);
33931      }
33932      if (element.hasAdditionalCharacteristic()) {
33933        openArray("additionalCharacteristic");
33934        for (CodeableConcept e : element.getAdditionalCharacteristic()) 
33935          composeCodeableConcept(null, e);
33936        closeArray();
33937      };
33938      if (element.hasAdditionalClassification()) {
33939        openArray("additionalClassification");
33940        for (CodeableConcept e : element.getAdditionalClassification()) 
33941          composeCodeableConcept(null, e);
33942        closeArray();
33943      };
33944      if (element.hasRelatedEntry()) {
33945        openArray("relatedEntry");
33946        for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry()) 
33947          composeCatalogEntryCatalogEntryRelatedEntryComponent(null, e);
33948        closeArray();
33949      };
33950  }
33951
33952  protected void composeCatalogEntryCatalogEntryRelatedEntryComponent(String name, CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
33953    if (element != null) {
33954      open(name);
33955      composeCatalogEntryCatalogEntryRelatedEntryComponentInner(element);
33956      close();
33957    }
33958  }
33959
33960  protected void composeCatalogEntryCatalogEntryRelatedEntryComponentInner(CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
33961      composeBackbone(element);
33962      if (element.hasRelationtypeElement()) {
33963        composeEnumerationCore("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
33964        composeEnumerationExtras("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
33965      }
33966      if (element.hasItem()) {
33967        composeReference("item", element.getItem());
33968      }
33969  }
33970
33971  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
33972    if (element != null) {
33973      prop("resourceType", name);
33974      composeChargeItemInner(element);
33975    }
33976  }
33977
33978  protected void composeChargeItemInner(ChargeItem element) throws IOException {
33979      composeDomainResourceElements(element);
33980      if (element.hasIdentifier()) {
33981        openArray("identifier");
33982        for (Identifier e : element.getIdentifier()) 
33983          composeIdentifier(null, e);
33984        closeArray();
33985      };
33986      if (element.hasDefinitionUri()) {
33987        openArray("definitionUri");
33988        for (UriType e : element.getDefinitionUri()) 
33989          composeUriCore(null, e, true);
33990        closeArray();
33991        if (anyHasExtras(element.getDefinitionUri())) {
33992          openArray("_definitionUri");
33993          for (UriType e : element.getDefinitionUri()) 
33994            composeUriExtras(null, e, true);
33995          closeArray();
33996        }
33997      };
33998      if (element.hasDefinitionCanonical()) {
33999        openArray("definitionCanonical");
34000        for (CanonicalType e : element.getDefinitionCanonical()) 
34001          composeCanonicalCore(null, e, true);
34002        closeArray();
34003        if (anyHasExtras(element.getDefinitionCanonical())) {
34004          openArray("_definitionCanonical");
34005          for (CanonicalType e : element.getDefinitionCanonical()) 
34006            composeCanonicalExtras(null, e, true);
34007          closeArray();
34008        }
34009      };
34010      if (element.hasStatusElement()) {
34011        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
34012        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
34013      }
34014      if (element.hasPartOf()) {
34015        openArray("partOf");
34016        for (Reference e : element.getPartOf()) 
34017          composeReference(null, e);
34018        closeArray();
34019      };
34020      if (element.hasCode()) {
34021        composeCodeableConcept("code", element.getCode());
34022      }
34023      if (element.hasSubject()) {
34024        composeReference("subject", element.getSubject());
34025      }
34026      if (element.hasContext()) {
34027        composeReference("context", element.getContext());
34028      }
34029      if (element.hasOccurrence()) {
34030        composeType("occurrence", element.getOccurrence());
34031      }
34032      if (element.hasPerformer()) {
34033        openArray("performer");
34034        for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer()) 
34035          composeChargeItemChargeItemPerformerComponent(null, e);
34036        closeArray();
34037      };
34038      if (element.hasPerformingOrganization()) {
34039        composeReference("performingOrganization", element.getPerformingOrganization());
34040      }
34041      if (element.hasRequestingOrganization()) {
34042        composeReference("requestingOrganization", element.getRequestingOrganization());
34043      }
34044      if (element.hasCostCenter()) {
34045        composeReference("costCenter", element.getCostCenter());
34046      }
34047      if (element.hasQuantity()) {
34048        composeQuantity("quantity", element.getQuantity());
34049      }
34050      if (element.hasBodysite()) {
34051        openArray("bodysite");
34052        for (CodeableConcept e : element.getBodysite()) 
34053          composeCodeableConcept(null, e);
34054        closeArray();
34055      };
34056      if (element.hasFactorOverrideElement()) {
34057        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
34058        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
34059      }
34060      if (element.hasPriceOverride()) {
34061        composeMoney("priceOverride", element.getPriceOverride());
34062      }
34063      if (element.hasOverrideReasonElement()) {
34064        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
34065        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
34066      }
34067      if (element.hasEnterer()) {
34068        composeReference("enterer", element.getEnterer());
34069      }
34070      if (element.hasEnteredDateElement()) {
34071        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
34072        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
34073      }
34074      if (element.hasReason()) {
34075        openArray("reason");
34076        for (CodeableConcept e : element.getReason()) 
34077          composeCodeableConcept(null, e);
34078        closeArray();
34079      };
34080      if (element.hasService()) {
34081        openArray("service");
34082        for (Reference e : element.getService()) 
34083          composeReference(null, e);
34084        closeArray();
34085      };
34086      if (element.hasProduct()) {
34087        composeType("product", element.getProduct());
34088      }
34089      if (element.hasAccount()) {
34090        openArray("account");
34091        for (Reference e : element.getAccount()) 
34092          composeReference(null, e);
34093        closeArray();
34094      };
34095      if (element.hasNote()) {
34096        openArray("note");
34097        for (Annotation e : element.getNote()) 
34098          composeAnnotation(null, e);
34099        closeArray();
34100      };
34101      if (element.hasSupportingInformation()) {
34102        openArray("supportingInformation");
34103        for (Reference e : element.getSupportingInformation()) 
34104          composeReference(null, e);
34105        closeArray();
34106      };
34107  }
34108
34109  protected void composeChargeItemChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
34110    if (element != null) {
34111      open(name);
34112      composeChargeItemChargeItemPerformerComponentInner(element);
34113      close();
34114    }
34115  }
34116
34117  protected void composeChargeItemChargeItemPerformerComponentInner(ChargeItem.ChargeItemPerformerComponent element) throws IOException {
34118      composeBackbone(element);
34119      if (element.hasFunction()) {
34120        composeCodeableConcept("function", element.getFunction());
34121      }
34122      if (element.hasActor()) {
34123        composeReference("actor", element.getActor());
34124      }
34125  }
34126
34127  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
34128    if (element != null) {
34129      prop("resourceType", name);
34130      composeChargeItemDefinitionInner(element);
34131    }
34132  }
34133
34134  protected void composeChargeItemDefinitionInner(ChargeItemDefinition element) throws IOException {
34135      composeDomainResourceElements(element);
34136      if (element.hasUrlElement()) {
34137        composeUriCore("url", element.getUrlElement(), false);
34138        composeUriExtras("url", element.getUrlElement(), false);
34139      }
34140      if (element.hasIdentifier()) {
34141        openArray("identifier");
34142        for (Identifier e : element.getIdentifier()) 
34143          composeIdentifier(null, e);
34144        closeArray();
34145      };
34146      if (element.hasVersionElement()) {
34147        composeStringCore("version", element.getVersionElement(), false);
34148        composeStringExtras("version", element.getVersionElement(), false);
34149      }
34150      if (element.hasTitleElement()) {
34151        composeStringCore("title", element.getTitleElement(), false);
34152        composeStringExtras("title", element.getTitleElement(), false);
34153      }
34154      if (element.hasDerivedFromUri()) {
34155        openArray("derivedFromUri");
34156        for (UriType e : element.getDerivedFromUri()) 
34157          composeUriCore(null, e, true);
34158        closeArray();
34159        if (anyHasExtras(element.getDerivedFromUri())) {
34160          openArray("_derivedFromUri");
34161          for (UriType e : element.getDerivedFromUri()) 
34162            composeUriExtras(null, e, true);
34163          closeArray();
34164        }
34165      };
34166      if (element.hasPartOf()) {
34167        openArray("partOf");
34168        for (CanonicalType e : element.getPartOf()) 
34169          composeCanonicalCore(null, e, true);
34170        closeArray();
34171        if (anyHasExtras(element.getPartOf())) {
34172          openArray("_partOf");
34173          for (CanonicalType e : element.getPartOf()) 
34174            composeCanonicalExtras(null, e, true);
34175          closeArray();
34176        }
34177      };
34178      if (element.hasReplaces()) {
34179        openArray("replaces");
34180        for (CanonicalType e : element.getReplaces()) 
34181          composeCanonicalCore(null, e, true);
34182        closeArray();
34183        if (anyHasExtras(element.getReplaces())) {
34184          openArray("_replaces");
34185          for (CanonicalType e : element.getReplaces()) 
34186            composeCanonicalExtras(null, e, true);
34187          closeArray();
34188        }
34189      };
34190      if (element.hasStatusElement()) {
34191        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34192        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34193      }
34194      if (element.hasExperimentalElement()) {
34195        composeBooleanCore("experimental", element.getExperimentalElement(), false);
34196        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
34197      }
34198      if (element.hasDateElement()) {
34199        composeDateTimeCore("date", element.getDateElement(), false);
34200        composeDateTimeExtras("date", element.getDateElement(), false);
34201      }
34202      if (element.hasPublisherElement()) {
34203        composeStringCore("publisher", element.getPublisherElement(), false);
34204        composeStringExtras("publisher", element.getPublisherElement(), false);
34205      }
34206      if (element.hasContact()) {
34207        openArray("contact");
34208        for (ContactDetail e : element.getContact()) 
34209          composeContactDetail(null, e);
34210        closeArray();
34211      };
34212      if (element.hasDescriptionElement()) {
34213        composeMarkdownCore("description", element.getDescriptionElement(), false);
34214        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34215      }
34216      if (element.hasUseContext()) {
34217        openArray("useContext");
34218        for (UsageContext e : element.getUseContext()) 
34219          composeUsageContext(null, e);
34220        closeArray();
34221      };
34222      if (element.hasJurisdiction()) {
34223        openArray("jurisdiction");
34224        for (CodeableConcept e : element.getJurisdiction()) 
34225          composeCodeableConcept(null, e);
34226        closeArray();
34227      };
34228      if (element.hasCopyrightElement()) {
34229        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
34230        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
34231      }
34232      if (element.hasApprovalDateElement()) {
34233        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
34234        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
34235      }
34236      if (element.hasLastReviewDateElement()) {
34237        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
34238        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
34239      }
34240      if (element.hasEffectivePeriod()) {
34241        composePeriod("effectivePeriod", element.getEffectivePeriod());
34242      }
34243      if (element.hasCode()) {
34244        composeCodeableConcept("code", element.getCode());
34245      }
34246      if (element.hasInstance()) {
34247        openArray("instance");
34248        for (Reference e : element.getInstance()) 
34249          composeReference(null, e);
34250        closeArray();
34251      };
34252      if (element.hasApplicability()) {
34253        openArray("applicability");
34254        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
34255          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
34256        closeArray();
34257      };
34258      if (element.hasPropertyGroup()) {
34259        openArray("propertyGroup");
34260        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
34261          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(null, e);
34262        closeArray();
34263      };
34264  }
34265
34266  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(String name, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
34267    if (element != null) {
34268      open(name);
34269      composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(element);
34270      close();
34271    }
34272  }
34273
34274  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
34275      composeBackbone(element);
34276      if (element.hasDescriptionElement()) {
34277        composeStringCore("description", element.getDescriptionElement(), false);
34278        composeStringExtras("description", element.getDescriptionElement(), false);
34279      }
34280      if (element.hasLanguageElement()) {
34281        composeStringCore("language", element.getLanguageElement(), false);
34282        composeStringExtras("language", element.getLanguageElement(), false);
34283      }
34284      if (element.hasExpressionElement()) {
34285        composeStringCore("expression", element.getExpressionElement(), false);
34286        composeStringExtras("expression", element.getExpressionElement(), false);
34287      }
34288  }
34289
34290  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
34291    if (element != null) {
34292      open(name);
34293      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(element);
34294      close();
34295    }
34296  }
34297
34298  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
34299      composeBackbone(element);
34300      if (element.hasApplicability()) {
34301        openArray("applicability");
34302        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
34303          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
34304        closeArray();
34305      };
34306      if (element.hasPriceComponent()) {
34307        openArray("priceComponent");
34308        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent e : element.getPriceComponent()) 
34309          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(null, e);
34310        closeArray();
34311      };
34312  }
34313
34314  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
34315    if (element != null) {
34316      open(name);
34317      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(element);
34318      close();
34319    }
34320  }
34321
34322  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
34323      composeBackbone(element);
34324      if (element.hasTypeElement()) {
34325        composeEnumerationCore("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
34326        composeEnumerationExtras("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
34327      }
34328      if (element.hasCode()) {
34329        composeCodeableConcept("code", element.getCode());
34330      }
34331      if (element.hasFactorElement()) {
34332        composeDecimalCore("factor", element.getFactorElement(), false);
34333        composeDecimalExtras("factor", element.getFactorElement(), false);
34334      }
34335      if (element.hasAmount()) {
34336        composeMoney("amount", element.getAmount());
34337      }
34338  }
34339
34340  protected void composeClaim(String name, Claim element) throws IOException {
34341    if (element != null) {
34342      prop("resourceType", name);
34343      composeClaimInner(element);
34344    }
34345  }
34346
34347  protected void composeClaimInner(Claim element) throws IOException {
34348      composeDomainResourceElements(element);
34349      if (element.hasIdentifier()) {
34350        openArray("identifier");
34351        for (Identifier e : element.getIdentifier()) 
34352          composeIdentifier(null, e);
34353        closeArray();
34354      };
34355      if (element.hasStatusElement()) {
34356        composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
34357        composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
34358      }
34359      if (element.hasType()) {
34360        composeCodeableConcept("type", element.getType());
34361      }
34362      if (element.hasSubType()) {
34363        composeCodeableConcept("subType", element.getSubType());
34364      }
34365      if (element.hasUseElement()) {
34366        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
34367        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
34368      }
34369      if (element.hasPatient()) {
34370        composeReference("patient", element.getPatient());
34371      }
34372      if (element.hasBillablePeriod()) {
34373        composePeriod("billablePeriod", element.getBillablePeriod());
34374      }
34375      if (element.hasCreatedElement()) {
34376        composeDateTimeCore("created", element.getCreatedElement(), false);
34377        composeDateTimeExtras("created", element.getCreatedElement(), false);
34378      }
34379      if (element.hasEnterer()) {
34380        composeReference("enterer", element.getEnterer());
34381      }
34382      if (element.hasInsurer()) {
34383        composeReference("insurer", element.getInsurer());
34384      }
34385      if (element.hasProvider()) {
34386        composeReference("provider", element.getProvider());
34387      }
34388      if (element.hasPriority()) {
34389        composeCodeableConcept("priority", element.getPriority());
34390      }
34391      if (element.hasFundsReserve()) {
34392        composeCodeableConcept("fundsReserve", element.getFundsReserve());
34393      }
34394      if (element.hasRelated()) {
34395        openArray("related");
34396        for (Claim.RelatedClaimComponent e : element.getRelated()) 
34397          composeClaimRelatedClaimComponent(null, e);
34398        closeArray();
34399      };
34400      if (element.hasPrescription()) {
34401        composeReference("prescription", element.getPrescription());
34402      }
34403      if (element.hasOriginalPrescription()) {
34404        composeReference("originalPrescription", element.getOriginalPrescription());
34405      }
34406      if (element.hasPayee()) {
34407        composeClaimPayeeComponent("payee", element.getPayee());
34408      }
34409      if (element.hasReferral()) {
34410        composeReference("referral", element.getReferral());
34411      }
34412      if (element.hasFacility()) {
34413        composeReference("facility", element.getFacility());
34414      }
34415      if (element.hasCareTeam()) {
34416        openArray("careTeam");
34417        for (Claim.CareTeamComponent e : element.getCareTeam()) 
34418          composeClaimCareTeamComponent(null, e);
34419        closeArray();
34420      };
34421      if (element.hasSupportingInfo()) {
34422        openArray("supportingInfo");
34423        for (Claim.SupportingInformationComponent e : element.getSupportingInfo()) 
34424          composeClaimSupportingInformationComponent(null, e);
34425        closeArray();
34426      };
34427      if (element.hasDiagnosis()) {
34428        openArray("diagnosis");
34429        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
34430          composeClaimDiagnosisComponent(null, e);
34431        closeArray();
34432      };
34433      if (element.hasProcedure()) {
34434        openArray("procedure");
34435        for (Claim.ProcedureComponent e : element.getProcedure()) 
34436          composeClaimProcedureComponent(null, e);
34437        closeArray();
34438      };
34439      if (element.hasInsurance()) {
34440        openArray("insurance");
34441        for (Claim.InsuranceComponent e : element.getInsurance()) 
34442          composeClaimInsuranceComponent(null, e);
34443        closeArray();
34444      };
34445      if (element.hasAccident()) {
34446        composeClaimAccidentComponent("accident", element.getAccident());
34447      }
34448      if (element.hasItem()) {
34449        openArray("item");
34450        for (Claim.ItemComponent e : element.getItem()) 
34451          composeClaimItemComponent(null, e);
34452        closeArray();
34453      };
34454      if (element.hasTotal()) {
34455        composeMoney("total", element.getTotal());
34456      }
34457  }
34458
34459  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
34460    if (element != null) {
34461      open(name);
34462      composeClaimRelatedClaimComponentInner(element);
34463      close();
34464    }
34465  }
34466
34467  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
34468      composeBackbone(element);
34469      if (element.hasClaim()) {
34470        composeReference("claim", element.getClaim());
34471      }
34472      if (element.hasRelationship()) {
34473        composeCodeableConcept("relationship", element.getRelationship());
34474      }
34475      if (element.hasReference()) {
34476        composeIdentifier("reference", element.getReference());
34477      }
34478  }
34479
34480  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
34481    if (element != null) {
34482      open(name);
34483      composeClaimPayeeComponentInner(element);
34484      close();
34485    }
34486  }
34487
34488  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
34489      composeBackbone(element);
34490      if (element.hasType()) {
34491        composeCodeableConcept("type", element.getType());
34492      }
34493      if (element.hasParty()) {
34494        composeReference("party", element.getParty());
34495      }
34496  }
34497
34498  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
34499    if (element != null) {
34500      open(name);
34501      composeClaimCareTeamComponentInner(element);
34502      close();
34503    }
34504  }
34505
34506  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
34507      composeBackbone(element);
34508      if (element.hasSequenceElement()) {
34509        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34510        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34511      }
34512      if (element.hasProvider()) {
34513        composeReference("provider", element.getProvider());
34514      }
34515      if (element.hasResponsibleElement()) {
34516        composeBooleanCore("responsible", element.getResponsibleElement(), false);
34517        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
34518      }
34519      if (element.hasRole()) {
34520        composeCodeableConcept("role", element.getRole());
34521      }
34522      if (element.hasQualification()) {
34523        composeCodeableConcept("qualification", element.getQualification());
34524      }
34525  }
34526
34527  protected void composeClaimSupportingInformationComponent(String name, Claim.SupportingInformationComponent element) throws IOException {
34528    if (element != null) {
34529      open(name);
34530      composeClaimSupportingInformationComponentInner(element);
34531      close();
34532    }
34533  }
34534
34535  protected void composeClaimSupportingInformationComponentInner(Claim.SupportingInformationComponent element) throws IOException {
34536      composeBackbone(element);
34537      if (element.hasSequenceElement()) {
34538        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34539        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34540      }
34541      if (element.hasCategory()) {
34542        composeCodeableConcept("category", element.getCategory());
34543      }
34544      if (element.hasCode()) {
34545        composeCodeableConcept("code", element.getCode());
34546      }
34547      if (element.hasTiming()) {
34548        composeType("timing", element.getTiming());
34549      }
34550      if (element.hasValue()) {
34551        composeType("value", element.getValue());
34552      }
34553      if (element.hasReason()) {
34554        composeCodeableConcept("reason", element.getReason());
34555      }
34556  }
34557
34558  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
34559    if (element != null) {
34560      open(name);
34561      composeClaimDiagnosisComponentInner(element);
34562      close();
34563    }
34564  }
34565
34566  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
34567      composeBackbone(element);
34568      if (element.hasSequenceElement()) {
34569        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34570        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34571      }
34572      if (element.hasDiagnosis()) {
34573        composeType("diagnosis", element.getDiagnosis());
34574      }
34575      if (element.hasType()) {
34576        openArray("type");
34577        for (CodeableConcept e : element.getType()) 
34578          composeCodeableConcept(null, e);
34579        closeArray();
34580      };
34581      if (element.hasOnAdmission()) {
34582        composeCodeableConcept("onAdmission", element.getOnAdmission());
34583      }
34584      if (element.hasPackageCode()) {
34585        composeCodeableConcept("packageCode", element.getPackageCode());
34586      }
34587  }
34588
34589  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
34590    if (element != null) {
34591      open(name);
34592      composeClaimProcedureComponentInner(element);
34593      close();
34594    }
34595  }
34596
34597  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
34598      composeBackbone(element);
34599      if (element.hasSequenceElement()) {
34600        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34601        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34602      }
34603      if (element.hasType()) {
34604        openArray("type");
34605        for (CodeableConcept e : element.getType()) 
34606          composeCodeableConcept(null, e);
34607        closeArray();
34608      };
34609      if (element.hasDateElement()) {
34610        composeDateTimeCore("date", element.getDateElement(), false);
34611        composeDateTimeExtras("date", element.getDateElement(), false);
34612      }
34613      if (element.hasProcedure()) {
34614        composeType("procedure", element.getProcedure());
34615      }
34616      if (element.hasUdi()) {
34617        openArray("udi");
34618        for (Reference e : element.getUdi()) 
34619          composeReference(null, e);
34620        closeArray();
34621      };
34622  }
34623
34624  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
34625    if (element != null) {
34626      open(name);
34627      composeClaimInsuranceComponentInner(element);
34628      close();
34629    }
34630  }
34631
34632  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
34633      composeBackbone(element);
34634      if (element.hasSequenceElement()) {
34635        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34636        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34637      }
34638      if (element.hasFocalElement()) {
34639        composeBooleanCore("focal", element.getFocalElement(), false);
34640        composeBooleanExtras("focal", element.getFocalElement(), false);
34641      }
34642      if (element.hasIdentifier()) {
34643        composeIdentifier("identifier", element.getIdentifier());
34644      }
34645      if (element.hasCoverage()) {
34646        composeReference("coverage", element.getCoverage());
34647      }
34648      if (element.hasBusinessArrangementElement()) {
34649        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
34650        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
34651      }
34652      if (element.hasPreAuthRef()) {
34653        openArray("preAuthRef");
34654        for (StringType e : element.getPreAuthRef()) 
34655          composeStringCore(null, e, true);
34656        closeArray();
34657        if (anyHasExtras(element.getPreAuthRef())) {
34658          openArray("_preAuthRef");
34659          for (StringType e : element.getPreAuthRef()) 
34660            composeStringExtras(null, e, true);
34661          closeArray();
34662        }
34663      };
34664      if (element.hasClaimResponse()) {
34665        composeReference("claimResponse", element.getClaimResponse());
34666      }
34667  }
34668
34669  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
34670    if (element != null) {
34671      open(name);
34672      composeClaimAccidentComponentInner(element);
34673      close();
34674    }
34675  }
34676
34677  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
34678      composeBackbone(element);
34679      if (element.hasDateElement()) {
34680        composeDateCore("date", element.getDateElement(), false);
34681        composeDateExtras("date", element.getDateElement(), false);
34682      }
34683      if (element.hasType()) {
34684        composeCodeableConcept("type", element.getType());
34685      }
34686      if (element.hasLocation()) {
34687        composeType("location", element.getLocation());
34688      }
34689  }
34690
34691  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
34692    if (element != null) {
34693      open(name);
34694      composeClaimItemComponentInner(element);
34695      close();
34696    }
34697  }
34698
34699  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
34700      composeBackbone(element);
34701      if (element.hasSequenceElement()) {
34702        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34703        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34704      }
34705      if (element.hasCareTeamSequence()) {
34706        openArray("careTeamSequence");
34707        for (PositiveIntType e : element.getCareTeamSequence()) 
34708          composePositiveIntCore(null, e, true);
34709        closeArray();
34710        if (anyHasExtras(element.getCareTeamSequence())) {
34711          openArray("_careTeamSequence");
34712          for (PositiveIntType e : element.getCareTeamSequence()) 
34713            composePositiveIntExtras(null, e, true);
34714          closeArray();
34715        }
34716      };
34717      if (element.hasDiagnosisSequence()) {
34718        openArray("diagnosisSequence");
34719        for (PositiveIntType e : element.getDiagnosisSequence()) 
34720          composePositiveIntCore(null, e, true);
34721        closeArray();
34722        if (anyHasExtras(element.getDiagnosisSequence())) {
34723          openArray("_diagnosisSequence");
34724          for (PositiveIntType e : element.getDiagnosisSequence()) 
34725            composePositiveIntExtras(null, e, true);
34726          closeArray();
34727        }
34728      };
34729      if (element.hasProcedureSequence()) {
34730        openArray("procedureSequence");
34731        for (PositiveIntType e : element.getProcedureSequence()) 
34732          composePositiveIntCore(null, e, true);
34733        closeArray();
34734        if (anyHasExtras(element.getProcedureSequence())) {
34735          openArray("_procedureSequence");
34736          for (PositiveIntType e : element.getProcedureSequence()) 
34737            composePositiveIntExtras(null, e, true);
34738          closeArray();
34739        }
34740      };
34741      if (element.hasInformationSequence()) {
34742        openArray("informationSequence");
34743        for (PositiveIntType e : element.getInformationSequence()) 
34744          composePositiveIntCore(null, e, true);
34745        closeArray();
34746        if (anyHasExtras(element.getInformationSequence())) {
34747          openArray("_informationSequence");
34748          for (PositiveIntType e : element.getInformationSequence()) 
34749            composePositiveIntExtras(null, e, true);
34750          closeArray();
34751        }
34752      };
34753      if (element.hasRevenue()) {
34754        composeCodeableConcept("revenue", element.getRevenue());
34755      }
34756      if (element.hasCategory()) {
34757        composeCodeableConcept("category", element.getCategory());
34758      }
34759      if (element.hasProductOrService()) {
34760        composeCodeableConcept("productOrService", element.getProductOrService());
34761      }
34762      if (element.hasModifier()) {
34763        openArray("modifier");
34764        for (CodeableConcept e : element.getModifier()) 
34765          composeCodeableConcept(null, e);
34766        closeArray();
34767      };
34768      if (element.hasProgramCode()) {
34769        openArray("programCode");
34770        for (CodeableConcept e : element.getProgramCode()) 
34771          composeCodeableConcept(null, e);
34772        closeArray();
34773      };
34774      if (element.hasServiced()) {
34775        composeType("serviced", element.getServiced());
34776      }
34777      if (element.hasLocation()) {
34778        composeType("location", element.getLocation());
34779      }
34780      if (element.hasQuantity()) {
34781        composeQuantity("quantity", element.getQuantity());
34782      }
34783      if (element.hasUnitPrice()) {
34784        composeMoney("unitPrice", element.getUnitPrice());
34785      }
34786      if (element.hasFactorElement()) {
34787        composeDecimalCore("factor", element.getFactorElement(), false);
34788        composeDecimalExtras("factor", element.getFactorElement(), false);
34789      }
34790      if (element.hasNet()) {
34791        composeMoney("net", element.getNet());
34792      }
34793      if (element.hasUdi()) {
34794        openArray("udi");
34795        for (Reference e : element.getUdi()) 
34796          composeReference(null, e);
34797        closeArray();
34798      };
34799      if (element.hasBodySite()) {
34800        composeCodeableConcept("bodySite", element.getBodySite());
34801      }
34802      if (element.hasSubSite()) {
34803        openArray("subSite");
34804        for (CodeableConcept e : element.getSubSite()) 
34805          composeCodeableConcept(null, e);
34806        closeArray();
34807      };
34808      if (element.hasEncounter()) {
34809        openArray("encounter");
34810        for (Reference e : element.getEncounter()) 
34811          composeReference(null, e);
34812        closeArray();
34813      };
34814      if (element.hasDetail()) {
34815        openArray("detail");
34816        for (Claim.DetailComponent e : element.getDetail()) 
34817          composeClaimDetailComponent(null, e);
34818        closeArray();
34819      };
34820  }
34821
34822  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
34823    if (element != null) {
34824      open(name);
34825      composeClaimDetailComponentInner(element);
34826      close();
34827    }
34828  }
34829
34830  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
34831      composeBackbone(element);
34832      if (element.hasSequenceElement()) {
34833        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34834        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34835      }
34836      if (element.hasRevenue()) {
34837        composeCodeableConcept("revenue", element.getRevenue());
34838      }
34839      if (element.hasCategory()) {
34840        composeCodeableConcept("category", element.getCategory());
34841      }
34842      if (element.hasProductOrService()) {
34843        composeCodeableConcept("productOrService", element.getProductOrService());
34844      }
34845      if (element.hasModifier()) {
34846        openArray("modifier");
34847        for (CodeableConcept e : element.getModifier()) 
34848          composeCodeableConcept(null, e);
34849        closeArray();
34850      };
34851      if (element.hasProgramCode()) {
34852        openArray("programCode");
34853        for (CodeableConcept e : element.getProgramCode()) 
34854          composeCodeableConcept(null, e);
34855        closeArray();
34856      };
34857      if (element.hasQuantity()) {
34858        composeQuantity("quantity", element.getQuantity());
34859      }
34860      if (element.hasUnitPrice()) {
34861        composeMoney("unitPrice", element.getUnitPrice());
34862      }
34863      if (element.hasFactorElement()) {
34864        composeDecimalCore("factor", element.getFactorElement(), false);
34865        composeDecimalExtras("factor", element.getFactorElement(), false);
34866      }
34867      if (element.hasNet()) {
34868        composeMoney("net", element.getNet());
34869      }
34870      if (element.hasUdi()) {
34871        openArray("udi");
34872        for (Reference e : element.getUdi()) 
34873          composeReference(null, e);
34874        closeArray();
34875      };
34876      if (element.hasSubDetail()) {
34877        openArray("subDetail");
34878        for (Claim.SubDetailComponent e : element.getSubDetail()) 
34879          composeClaimSubDetailComponent(null, e);
34880        closeArray();
34881      };
34882  }
34883
34884  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
34885    if (element != null) {
34886      open(name);
34887      composeClaimSubDetailComponentInner(element);
34888      close();
34889    }
34890  }
34891
34892  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
34893      composeBackbone(element);
34894      if (element.hasSequenceElement()) {
34895        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34896        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34897      }
34898      if (element.hasRevenue()) {
34899        composeCodeableConcept("revenue", element.getRevenue());
34900      }
34901      if (element.hasCategory()) {
34902        composeCodeableConcept("category", element.getCategory());
34903      }
34904      if (element.hasProductOrService()) {
34905        composeCodeableConcept("productOrService", element.getProductOrService());
34906      }
34907      if (element.hasModifier()) {
34908        openArray("modifier");
34909        for (CodeableConcept e : element.getModifier()) 
34910          composeCodeableConcept(null, e);
34911        closeArray();
34912      };
34913      if (element.hasProgramCode()) {
34914        openArray("programCode");
34915        for (CodeableConcept e : element.getProgramCode()) 
34916          composeCodeableConcept(null, e);
34917        closeArray();
34918      };
34919      if (element.hasQuantity()) {
34920        composeQuantity("quantity", element.getQuantity());
34921      }
34922      if (element.hasUnitPrice()) {
34923        composeMoney("unitPrice", element.getUnitPrice());
34924      }
34925      if (element.hasFactorElement()) {
34926        composeDecimalCore("factor", element.getFactorElement(), false);
34927        composeDecimalExtras("factor", element.getFactorElement(), false);
34928      }
34929      if (element.hasNet()) {
34930        composeMoney("net", element.getNet());
34931      }
34932      if (element.hasUdi()) {
34933        openArray("udi");
34934        for (Reference e : element.getUdi()) 
34935          composeReference(null, e);
34936        closeArray();
34937      };
34938  }
34939
34940  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
34941    if (element != null) {
34942      prop("resourceType", name);
34943      composeClaimResponseInner(element);
34944    }
34945  }
34946
34947  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
34948      composeDomainResourceElements(element);
34949      if (element.hasIdentifier()) {
34950        openArray("identifier");
34951        for (Identifier e : element.getIdentifier()) 
34952          composeIdentifier(null, e);
34953        closeArray();
34954      };
34955      if (element.hasStatusElement()) {
34956        composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
34957        composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
34958      }
34959      if (element.hasType()) {
34960        composeCodeableConcept("type", element.getType());
34961      }
34962      if (element.hasSubType()) {
34963        composeCodeableConcept("subType", element.getSubType());
34964      }
34965      if (element.hasUseElement()) {
34966        composeEnumerationCore("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
34967        composeEnumerationExtras("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
34968      }
34969      if (element.hasPatient()) {
34970        composeReference("patient", element.getPatient());
34971      }
34972      if (element.hasCreatedElement()) {
34973        composeDateTimeCore("created", element.getCreatedElement(), false);
34974        composeDateTimeExtras("created", element.getCreatedElement(), false);
34975      }
34976      if (element.hasInsurer()) {
34977        composeReference("insurer", element.getInsurer());
34978      }
34979      if (element.hasRequestor()) {
34980        composeReference("requestor", element.getRequestor());
34981      }
34982      if (element.hasRequest()) {
34983        composeReference("request", element.getRequest());
34984      }
34985      if (element.hasOutcomeElement()) {
34986        composeEnumerationCore("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
34987        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
34988      }
34989      if (element.hasDispositionElement()) {
34990        composeStringCore("disposition", element.getDispositionElement(), false);
34991        composeStringExtras("disposition", element.getDispositionElement(), false);
34992      }
34993      if (element.hasPreAuthRefElement()) {
34994        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
34995        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
34996      }
34997      if (element.hasPreAuthPeriod()) {
34998        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
34999      }
35000      if (element.hasPayeeType()) {
35001        composeCodeableConcept("payeeType", element.getPayeeType());
35002      }
35003      if (element.hasItem()) {
35004        openArray("item");
35005        for (ClaimResponse.ItemComponent e : element.getItem()) 
35006          composeClaimResponseItemComponent(null, e);
35007        closeArray();
35008      };
35009      if (element.hasAddItem()) {
35010        openArray("addItem");
35011        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
35012          composeClaimResponseAddedItemComponent(null, e);
35013        closeArray();
35014      };
35015      if (element.hasAdjudication()) {
35016        openArray("adjudication");
35017        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
35018          composeClaimResponseAdjudicationComponent(null, e);
35019        closeArray();
35020      };
35021      if (element.hasTotal()) {
35022        openArray("total");
35023        for (ClaimResponse.TotalComponent e : element.getTotal()) 
35024          composeClaimResponseTotalComponent(null, e);
35025        closeArray();
35026      };
35027      if (element.hasPayment()) {
35028        composeClaimResponsePaymentComponent("payment", element.getPayment());
35029      }
35030      if (element.hasFundsReserve()) {
35031        composeCodeableConcept("fundsReserve", element.getFundsReserve());
35032      }
35033      if (element.hasFormCode()) {
35034        composeCodeableConcept("formCode", element.getFormCode());
35035      }
35036      if (element.hasForm()) {
35037        composeAttachment("form", element.getForm());
35038      }
35039      if (element.hasProcessNote()) {
35040        openArray("processNote");
35041        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
35042          composeClaimResponseNoteComponent(null, e);
35043        closeArray();
35044      };
35045      if (element.hasCommunicationRequest()) {
35046        openArray("communicationRequest");
35047        for (Reference e : element.getCommunicationRequest()) 
35048          composeReference(null, e);
35049        closeArray();
35050      };
35051      if (element.hasInsurance()) {
35052        openArray("insurance");
35053        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
35054          composeClaimResponseInsuranceComponent(null, e);
35055        closeArray();
35056      };
35057      if (element.hasError()) {
35058        openArray("error");
35059        for (ClaimResponse.ErrorComponent e : element.getError()) 
35060          composeClaimResponseErrorComponent(null, e);
35061        closeArray();
35062      };
35063  }
35064
35065  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
35066    if (element != null) {
35067      open(name);
35068      composeClaimResponseItemComponentInner(element);
35069      close();
35070    }
35071  }
35072
35073  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
35074      composeBackbone(element);
35075      if (element.hasItemSequenceElement()) {
35076        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
35077        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
35078      }
35079      if (element.hasNoteNumber()) {
35080        openArray("noteNumber");
35081        for (PositiveIntType e : element.getNoteNumber()) 
35082          composePositiveIntCore(null, e, true);
35083        closeArray();
35084        if (anyHasExtras(element.getNoteNumber())) {
35085          openArray("_noteNumber");
35086          for (PositiveIntType e : element.getNoteNumber()) 
35087            composePositiveIntExtras(null, e, true);
35088          closeArray();
35089        }
35090      };
35091      if (element.hasAdjudication()) {
35092        openArray("adjudication");
35093        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
35094          composeClaimResponseAdjudicationComponent(null, e);
35095        closeArray();
35096      };
35097      if (element.hasDetail()) {
35098        openArray("detail");
35099        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
35100          composeClaimResponseItemDetailComponent(null, e);
35101        closeArray();
35102      };
35103  }
35104
35105  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
35106    if (element != null) {
35107      open(name);
35108      composeClaimResponseAdjudicationComponentInner(element);
35109      close();
35110    }
35111  }
35112
35113  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element) throws IOException {
35114      composeBackbone(element);
35115      if (element.hasCategory()) {
35116        composeCodeableConcept("category", element.getCategory());
35117      }
35118      if (element.hasReason()) {
35119        composeCodeableConcept("reason", element.getReason());
35120      }
35121      if (element.hasAmount()) {
35122        composeMoney("amount", element.getAmount());
35123      }
35124      if (element.hasValueElement()) {
35125        composeDecimalCore("value", element.getValueElement(), false);
35126        composeDecimalExtras("value", element.getValueElement(), false);
35127      }
35128  }
35129
35130  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
35131    if (element != null) {
35132      open(name);
35133      composeClaimResponseItemDetailComponentInner(element);
35134      close();
35135    }
35136  }
35137
35138  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
35139      composeBackbone(element);
35140      if (element.hasDetailSequenceElement()) {
35141        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
35142        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
35143      }
35144      if (element.hasNoteNumber()) {
35145        openArray("noteNumber");
35146        for (PositiveIntType e : element.getNoteNumber()) 
35147          composePositiveIntCore(null, e, true);
35148        closeArray();
35149        if (anyHasExtras(element.getNoteNumber())) {
35150          openArray("_noteNumber");
35151          for (PositiveIntType e : element.getNoteNumber()) 
35152            composePositiveIntExtras(null, e, true);
35153          closeArray();
35154        }
35155      };
35156      if (element.hasAdjudication()) {
35157        openArray("adjudication");
35158        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
35159          composeClaimResponseAdjudicationComponent(null, e);
35160        closeArray();
35161      };
35162      if (element.hasSubDetail()) {
35163        openArray("subDetail");
35164        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
35165          composeClaimResponseSubDetailComponent(null, e);
35166        closeArray();
35167      };
35168  }
35169
35170  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
35171    if (element != null) {
35172      open(name);
35173      composeClaimResponseSubDetailComponentInner(element);
35174      close();
35175    }
35176  }
35177
35178  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
35179      composeBackbone(element);
35180      if (element.hasSubDetailSequenceElement()) {
35181        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
35182        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
35183      }
35184      if (element.hasNoteNumber()) {
35185        openArray("noteNumber");
35186        for (PositiveIntType e : element.getNoteNumber()) 
35187          composePositiveIntCore(null, e, true);
35188        closeArray();
35189        if (anyHasExtras(element.getNoteNumber())) {
35190          openArray("_noteNumber");
35191          for (PositiveIntType e : element.getNoteNumber()) 
35192            composePositiveIntExtras(null, e, true);
35193          closeArray();
35194        }
35195      };
35196      if (element.hasAdjudication()) {
35197        openArray("adjudication");
35198        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
35199          composeClaimResponseAdjudicationComponent(null, e);
35200        closeArray();
35201      };
35202  }
35203
35204  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
35205    if (element != null) {
35206      open(name);
35207      composeClaimResponseAddedItemComponentInner(element);
35208      close();
35209    }
35210  }
35211
35212  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
35213      composeBackbone(element);
35214      if (element.hasItemSequence()) {
35215        openArray("itemSequence");
35216        for (PositiveIntType e : element.getItemSequence()) 
35217          composePositiveIntCore(null, e, true);
35218        closeArray();
35219        if (anyHasExtras(element.getItemSequence())) {
35220          openArray("_itemSequence");
35221          for (PositiveIntType e : element.getItemSequence()) 
35222            composePositiveIntExtras(null, e, true);
35223          closeArray();
35224        }
35225      };
35226      if (element.hasDetailSequence()) {
35227        openArray("detailSequence");
35228        for (PositiveIntType e : element.getDetailSequence()) 
35229          composePositiveIntCore(null, e, true);
35230        closeArray();
35231        if (anyHasExtras(element.getDetailSequence())) {
35232          openArray("_detailSequence");
35233          for (PositiveIntType e : element.getDetailSequence()) 
35234            composePositiveIntExtras(null, e, true);
35235          closeArray();
35236        }
35237      };
35238      if (element.hasSubdetailSequence()) {
35239        openArray("subdetailSequence");
35240        for (PositiveIntType e : element.getSubdetailSequence()) 
35241          composePositiveIntCore(null, e, true);
35242        closeArray();
35243        if (anyHasExtras(element.getSubdetailSequence())) {
35244          openArray("_subdetailSequence");
35245          for (PositiveIntType e : element.getSubdetailSequence()) 
35246            composePositiveIntExtras(null, e, true);
35247          closeArray();
35248        }
35249      };
35250      if (element.hasProvider()) {
35251        openArray("provider");
35252        for (Reference e : element.getProvider()) 
35253          composeReference(null, e);
35254        closeArray();
35255      };
35256      if (element.hasProductOrService()) {
35257        composeCodeableConcept("productOrService", element.getProductOrService());
35258      }
35259      if (element.hasModifier()) {
35260        openArray("modifier");
35261        for (CodeableConcept e : element.getModifier()) 
35262          composeCodeableConcept(null, e);
35263        closeArray();
35264      };
35265      if (element.hasProgramCode()) {
35266        openArray("programCode");
35267        for (CodeableConcept e : element.getProgramCode()) 
35268          composeCodeableConcept(null, e);
35269        closeArray();
35270      };
35271      if (element.hasServiced()) {
35272        composeType("serviced", element.getServiced());
35273      }
35274      if (element.hasLocation()) {
35275        composeType("location", element.getLocation());
35276      }
35277      if (element.hasQuantity()) {
35278        composeQuantity("quantity", element.getQuantity());
35279      }
35280      if (element.hasUnitPrice()) {
35281        composeMoney("unitPrice", element.getUnitPrice());
35282      }
35283      if (element.hasFactorElement()) {
35284        composeDecimalCore("factor", element.getFactorElement(), false);
35285        composeDecimalExtras("factor", element.getFactorElement(), false);
35286      }
35287      if (element.hasNet()) {
35288        composeMoney("net", element.getNet());
35289      }
35290      if (element.hasBodySite()) {
35291        composeCodeableConcept("bodySite", element.getBodySite());
35292      }
35293      if (element.hasSubSite()) {
35294        openArray("subSite");
35295        for (CodeableConcept e : element.getSubSite()) 
35296          composeCodeableConcept(null, e);
35297        closeArray();
35298      };
35299      if (element.hasNoteNumber()) {
35300        openArray("noteNumber");
35301        for (PositiveIntType e : element.getNoteNumber()) 
35302          composePositiveIntCore(null, e, true);
35303        closeArray();
35304        if (anyHasExtras(element.getNoteNumber())) {
35305          openArray("_noteNumber");
35306          for (PositiveIntType e : element.getNoteNumber()) 
35307            composePositiveIntExtras(null, e, true);
35308          closeArray();
35309        }
35310      };
35311      if (element.hasAdjudication()) {
35312        openArray("adjudication");
35313        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
35314          composeClaimResponseAdjudicationComponent(null, e);
35315        closeArray();
35316      };
35317      if (element.hasDetail()) {
35318        openArray("detail");
35319        for (ClaimResponse.AddedItemDetailComponent e : element.getDetail()) 
35320          composeClaimResponseAddedItemDetailComponent(null, e);
35321        closeArray();
35322      };
35323  }
35324
35325  protected void composeClaimResponseAddedItemDetailComponent(String name, ClaimResponse.AddedItemDetailComponent element) throws IOException {
35326    if (element != null) {
35327      open(name);
35328      composeClaimResponseAddedItemDetailComponentInner(element);
35329      close();
35330    }
35331  }
35332
35333  protected void composeClaimResponseAddedItemDetailComponentInner(ClaimResponse.AddedItemDetailComponent element) throws IOException {
35334      composeBackbone(element);
35335      if (element.hasProductOrService()) {
35336        composeCodeableConcept("productOrService", element.getProductOrService());
35337      }
35338      if (element.hasModifier()) {
35339        openArray("modifier");
35340        for (CodeableConcept e : element.getModifier()) 
35341          composeCodeableConcept(null, e);
35342        closeArray();
35343      };
35344      if (element.hasQuantity()) {
35345        composeQuantity("quantity", element.getQuantity());
35346      }
35347      if (element.hasUnitPrice()) {
35348        composeMoney("unitPrice", element.getUnitPrice());
35349      }
35350      if (element.hasFactorElement()) {
35351        composeDecimalCore("factor", element.getFactorElement(), false);
35352        composeDecimalExtras("factor", element.getFactorElement(), false);
35353      }
35354      if (element.hasNet()) {
35355        composeMoney("net", element.getNet());
35356      }
35357      if (element.hasNoteNumber()) {
35358        openArray("noteNumber");
35359        for (PositiveIntType e : element.getNoteNumber()) 
35360          composePositiveIntCore(null, e, true);
35361        closeArray();
35362        if (anyHasExtras(element.getNoteNumber())) {
35363          openArray("_noteNumber");
35364          for (PositiveIntType e : element.getNoteNumber()) 
35365            composePositiveIntExtras(null, e, true);
35366          closeArray();
35367        }
35368      };
35369      if (element.hasAdjudication()) {
35370        openArray("adjudication");
35371        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
35372          composeClaimResponseAdjudicationComponent(null, e);
35373        closeArray();
35374      };
35375      if (element.hasSubDetail()) {
35376        openArray("subDetail");
35377        for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail()) 
35378          composeClaimResponseAddedItemSubDetailComponent(null, e);
35379        closeArray();
35380      };
35381  }
35382
35383  protected void composeClaimResponseAddedItemSubDetailComponent(String name, ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
35384    if (element != null) {
35385      open(name);
35386      composeClaimResponseAddedItemSubDetailComponentInner(element);
35387      close();
35388    }
35389  }
35390
35391  protected void composeClaimResponseAddedItemSubDetailComponentInner(ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
35392      composeBackbone(element);
35393      if (element.hasProductOrService()) {
35394        composeCodeableConcept("productOrService", element.getProductOrService());
35395      }
35396      if (element.hasModifier()) {
35397        openArray("modifier");
35398        for (CodeableConcept e : element.getModifier()) 
35399          composeCodeableConcept(null, e);
35400        closeArray();
35401      };
35402      if (element.hasQuantity()) {
35403        composeQuantity("quantity", element.getQuantity());
35404      }
35405      if (element.hasUnitPrice()) {
35406        composeMoney("unitPrice", element.getUnitPrice());
35407      }
35408      if (element.hasFactorElement()) {
35409        composeDecimalCore("factor", element.getFactorElement(), false);
35410        composeDecimalExtras("factor", element.getFactorElement(), false);
35411      }
35412      if (element.hasNet()) {
35413        composeMoney("net", element.getNet());
35414      }
35415      if (element.hasNoteNumber()) {
35416        openArray("noteNumber");
35417        for (PositiveIntType e : element.getNoteNumber()) 
35418          composePositiveIntCore(null, e, true);
35419        closeArray();
35420        if (anyHasExtras(element.getNoteNumber())) {
35421          openArray("_noteNumber");
35422          for (PositiveIntType e : element.getNoteNumber()) 
35423            composePositiveIntExtras(null, e, true);
35424          closeArray();
35425        }
35426      };
35427      if (element.hasAdjudication()) {
35428        openArray("adjudication");
35429        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
35430          composeClaimResponseAdjudicationComponent(null, e);
35431        closeArray();
35432      };
35433  }
35434
35435  protected void composeClaimResponseTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
35436    if (element != null) {
35437      open(name);
35438      composeClaimResponseTotalComponentInner(element);
35439      close();
35440    }
35441  }
35442
35443  protected void composeClaimResponseTotalComponentInner(ClaimResponse.TotalComponent element) throws IOException {
35444      composeBackbone(element);
35445      if (element.hasCategory()) {
35446        composeCodeableConcept("category", element.getCategory());
35447      }
35448      if (element.hasAmount()) {
35449        composeMoney("amount", element.getAmount());
35450      }
35451  }
35452
35453  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
35454    if (element != null) {
35455      open(name);
35456      composeClaimResponsePaymentComponentInner(element);
35457      close();
35458    }
35459  }
35460
35461  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
35462      composeBackbone(element);
35463      if (element.hasType()) {
35464        composeCodeableConcept("type", element.getType());
35465      }
35466      if (element.hasAdjustment()) {
35467        composeMoney("adjustment", element.getAdjustment());
35468      }
35469      if (element.hasAdjustmentReason()) {
35470        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
35471      }
35472      if (element.hasDateElement()) {
35473        composeDateCore("date", element.getDateElement(), false);
35474        composeDateExtras("date", element.getDateElement(), false);
35475      }
35476      if (element.hasAmount()) {
35477        composeMoney("amount", element.getAmount());
35478      }
35479      if (element.hasIdentifier()) {
35480        composeIdentifier("identifier", element.getIdentifier());
35481      }
35482  }
35483
35484  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
35485    if (element != null) {
35486      open(name);
35487      composeClaimResponseNoteComponentInner(element);
35488      close();
35489    }
35490  }
35491
35492  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
35493      composeBackbone(element);
35494      if (element.hasNumberElement()) {
35495        composePositiveIntCore("number", element.getNumberElement(), false);
35496        composePositiveIntExtras("number", element.getNumberElement(), false);
35497      }
35498      if (element.hasTypeElement()) {
35499        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
35500        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
35501      }
35502      if (element.hasTextElement()) {
35503        composeStringCore("text", element.getTextElement(), false);
35504        composeStringExtras("text", element.getTextElement(), false);
35505      }
35506      if (element.hasLanguage()) {
35507        composeCodeableConcept("language", element.getLanguage());
35508      }
35509  }
35510
35511  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
35512    if (element != null) {
35513      open(name);
35514      composeClaimResponseInsuranceComponentInner(element);
35515      close();
35516    }
35517  }
35518
35519  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element) throws IOException {
35520      composeBackbone(element);
35521      if (element.hasSequenceElement()) {
35522        composePositiveIntCore("sequence", element.getSequenceElement(), false);
35523        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
35524      }
35525      if (element.hasFocalElement()) {
35526        composeBooleanCore("focal", element.getFocalElement(), false);
35527        composeBooleanExtras("focal", element.getFocalElement(), false);
35528      }
35529      if (element.hasCoverage()) {
35530        composeReference("coverage", element.getCoverage());
35531      }
35532      if (element.hasBusinessArrangementElement()) {
35533        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
35534        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
35535      }
35536      if (element.hasClaimResponse()) {
35537        composeReference("claimResponse", element.getClaimResponse());
35538      }
35539  }
35540
35541  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
35542    if (element != null) {
35543      open(name);
35544      composeClaimResponseErrorComponentInner(element);
35545      close();
35546    }
35547  }
35548
35549  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
35550      composeBackbone(element);
35551      if (element.hasItemSequenceElement()) {
35552        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
35553        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
35554      }
35555      if (element.hasDetailSequenceElement()) {
35556        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
35557        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
35558      }
35559      if (element.hasSubDetailSequenceElement()) {
35560        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
35561        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
35562      }
35563      if (element.hasCode()) {
35564        composeCodeableConcept("code", element.getCode());
35565      }
35566  }
35567
35568  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
35569    if (element != null) {
35570      prop("resourceType", name);
35571      composeClinicalImpressionInner(element);
35572    }
35573  }
35574
35575  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
35576      composeDomainResourceElements(element);
35577      if (element.hasIdentifier()) {
35578        openArray("identifier");
35579        for (Identifier e : element.getIdentifier()) 
35580          composeIdentifier(null, e);
35581        closeArray();
35582      };
35583      if (element.hasStatusElement()) {
35584        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
35585        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
35586      }
35587      if (element.hasStatusReason()) {
35588        composeCodeableConcept("statusReason", element.getStatusReason());
35589      }
35590      if (element.hasCode()) {
35591        composeCodeableConcept("code", element.getCode());
35592      }
35593      if (element.hasDescriptionElement()) {
35594        composeStringCore("description", element.getDescriptionElement(), false);
35595        composeStringExtras("description", element.getDescriptionElement(), false);
35596      }
35597      if (element.hasSubject()) {
35598        composeReference("subject", element.getSubject());
35599      }
35600      if (element.hasEncounter()) {
35601        composeReference("encounter", element.getEncounter());
35602      }
35603      if (element.hasEffective()) {
35604        composeType("effective", element.getEffective());
35605      }
35606      if (element.hasDateElement()) {
35607        composeDateTimeCore("date", element.getDateElement(), false);
35608        composeDateTimeExtras("date", element.getDateElement(), false);
35609      }
35610      if (element.hasAssessor()) {
35611        composeReference("assessor", element.getAssessor());
35612      }
35613      if (element.hasPrevious()) {
35614        composeReference("previous", element.getPrevious());
35615      }
35616      if (element.hasProblem()) {
35617        openArray("problem");
35618        for (Reference e : element.getProblem()) 
35619          composeReference(null, e);
35620        closeArray();
35621      };
35622      if (element.hasInvestigation()) {
35623        openArray("investigation");
35624        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
35625          composeClinicalImpressionClinicalImpressionInvestigationComponent(null, e);
35626        closeArray();
35627      };
35628      if (element.hasProtocol()) {
35629        openArray("protocol");
35630        for (UriType e : element.getProtocol()) 
35631          composeUriCore(null, e, true);
35632        closeArray();
35633        if (anyHasExtras(element.getProtocol())) {
35634          openArray("_protocol");
35635          for (UriType e : element.getProtocol()) 
35636            composeUriExtras(null, e, true);
35637          closeArray();
35638        }
35639      };
35640      if (element.hasSummaryElement()) {
35641        composeStringCore("summary", element.getSummaryElement(), false);
35642        composeStringExtras("summary", element.getSummaryElement(), false);
35643      }
35644      if (element.hasFinding()) {
35645        openArray("finding");
35646        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
35647          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
35648        closeArray();
35649      };
35650      if (element.hasPrognosisCodeableConcept()) {
35651        openArray("prognosisCodeableConcept");
35652        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
35653          composeCodeableConcept(null, e);
35654        closeArray();
35655      };
35656      if (element.hasPrognosisReference()) {
35657        openArray("prognosisReference");
35658        for (Reference e : element.getPrognosisReference()) 
35659          composeReference(null, e);
35660        closeArray();
35661      };
35662      if (element.hasSupportingInfo()) {
35663        openArray("supportingInfo");
35664        for (Reference e : element.getSupportingInfo()) 
35665          composeReference(null, e);
35666        closeArray();
35667      };
35668      if (element.hasNote()) {
35669        openArray("note");
35670        for (Annotation e : element.getNote()) 
35671          composeAnnotation(null, e);
35672        closeArray();
35673      };
35674  }
35675
35676  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
35677    if (element != null) {
35678      open(name);
35679      composeClinicalImpressionClinicalImpressionInvestigationComponentInner(element);
35680      close();
35681    }
35682  }
35683
35684  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentInner(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
35685      composeBackbone(element);
35686      if (element.hasCode()) {
35687        composeCodeableConcept("code", element.getCode());
35688      }
35689      if (element.hasItem()) {
35690        openArray("item");
35691        for (Reference e : element.getItem()) 
35692          composeReference(null, e);
35693        closeArray();
35694      };
35695  }
35696
35697  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
35698    if (element != null) {
35699      open(name);
35700      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
35701      close();
35702    }
35703  }
35704
35705  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
35706      composeBackbone(element);
35707      if (element.hasItemCodeableConcept()) {
35708        composeCodeableConcept("itemCodeableConcept", element.getItemCodeableConcept());
35709      }
35710      if (element.hasItemReference()) {
35711        composeReference("itemReference", element.getItemReference());
35712      }
35713      if (element.hasBasisElement()) {
35714        composeStringCore("basis", element.getBasisElement(), false);
35715        composeStringExtras("basis", element.getBasisElement(), false);
35716      }
35717  }
35718
35719  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
35720    if (element != null) {
35721      prop("resourceType", name);
35722      composeCodeSystemInner(element);
35723    }
35724  }
35725
35726  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
35727      composeDomainResourceElements(element);
35728      if (element.hasUrlElement()) {
35729        composeUriCore("url", element.getUrlElement(), false);
35730        composeUriExtras("url", element.getUrlElement(), false);
35731      }
35732      if (element.hasIdentifier()) {
35733        openArray("identifier");
35734        for (Identifier e : element.getIdentifier()) 
35735          composeIdentifier(null, e);
35736        closeArray();
35737      };
35738      if (element.hasVersionElement()) {
35739        composeStringCore("version", element.getVersionElement(), false);
35740        composeStringExtras("version", element.getVersionElement(), false);
35741      }
35742      if (element.hasNameElement()) {
35743        composeStringCore("name", element.getNameElement(), false);
35744        composeStringExtras("name", element.getNameElement(), false);
35745      }
35746      if (element.hasTitleElement()) {
35747        composeStringCore("title", element.getTitleElement(), false);
35748        composeStringExtras("title", element.getTitleElement(), false);
35749      }
35750      if (element.hasStatusElement()) {
35751        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35752        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35753      }
35754      if (element.hasExperimentalElement()) {
35755        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35756        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35757      }
35758      if (element.hasDateElement()) {
35759        composeDateTimeCore("date", element.getDateElement(), false);
35760        composeDateTimeExtras("date", element.getDateElement(), false);
35761      }
35762      if (element.hasPublisherElement()) {
35763        composeStringCore("publisher", element.getPublisherElement(), false);
35764        composeStringExtras("publisher", element.getPublisherElement(), false);
35765      }
35766      if (element.hasContact()) {
35767        openArray("contact");
35768        for (ContactDetail e : element.getContact()) 
35769          composeContactDetail(null, e);
35770        closeArray();
35771      };
35772      if (element.hasDescriptionElement()) {
35773        composeMarkdownCore("description", element.getDescriptionElement(), false);
35774        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35775      }
35776      if (element.hasUseContext()) {
35777        openArray("useContext");
35778        for (UsageContext e : element.getUseContext()) 
35779          composeUsageContext(null, e);
35780        closeArray();
35781      };
35782      if (element.hasJurisdiction()) {
35783        openArray("jurisdiction");
35784        for (CodeableConcept e : element.getJurisdiction()) 
35785          composeCodeableConcept(null, e);
35786        closeArray();
35787      };
35788      if (element.hasPurposeElement()) {
35789        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35790        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35791      }
35792      if (element.hasCopyrightElement()) {
35793        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35794        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35795      }
35796      if (element.hasCaseSensitiveElement()) {
35797        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
35798        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
35799      }
35800      if (element.hasValueSetElement()) {
35801        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
35802        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
35803      }
35804      if (element.hasHierarchyMeaningElement()) {
35805        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
35806        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
35807      }
35808      if (element.hasCompositionalElement()) {
35809        composeBooleanCore("compositional", element.getCompositionalElement(), false);
35810        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
35811      }
35812      if (element.hasVersionNeededElement()) {
35813        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
35814        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
35815      }
35816      if (element.hasContentElement()) {
35817        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
35818        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
35819      }
35820      if (element.hasSupplementsElement()) {
35821        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
35822        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
35823      }
35824      if (element.hasCountElement()) {
35825        composeUnsignedIntCore("count", element.getCountElement(), false);
35826        composeUnsignedIntExtras("count", element.getCountElement(), false);
35827      }
35828      if (element.hasFilter()) {
35829        openArray("filter");
35830        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
35831          composeCodeSystemCodeSystemFilterComponent(null, e);
35832        closeArray();
35833      };
35834      if (element.hasProperty()) {
35835        openArray("property");
35836        for (CodeSystem.PropertyComponent e : element.getProperty()) 
35837          composeCodeSystemPropertyComponent(null, e);
35838        closeArray();
35839      };
35840      if (element.hasConcept()) {
35841        openArray("concept");
35842        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
35843          composeCodeSystemConceptDefinitionComponent(null, e);
35844        closeArray();
35845      };
35846  }
35847
35848  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
35849    if (element != null) {
35850      open(name);
35851      composeCodeSystemCodeSystemFilterComponentInner(element);
35852      close();
35853    }
35854  }
35855
35856  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
35857      composeBackbone(element);
35858      if (element.hasCodeElement()) {
35859        composeCodeCore("code", element.getCodeElement(), false);
35860        composeCodeExtras("code", element.getCodeElement(), false);
35861      }
35862      if (element.hasDescriptionElement()) {
35863        composeStringCore("description", element.getDescriptionElement(), false);
35864        composeStringExtras("description", element.getDescriptionElement(), false);
35865      }
35866      if (element.hasOperator()) {
35867        openArray("operator");
35868        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
35869          composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
35870        closeArray();
35871        if (anyHasExtras(element.getOperator())) {
35872          openArray("_operator");
35873          for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
35874            composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
35875          closeArray();
35876        }
35877      };
35878      if (element.hasValueElement()) {
35879        composeStringCore("value", element.getValueElement(), false);
35880        composeStringExtras("value", element.getValueElement(), false);
35881      }
35882  }
35883
35884  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
35885    if (element != null) {
35886      open(name);
35887      composeCodeSystemPropertyComponentInner(element);
35888      close();
35889    }
35890  }
35891
35892  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
35893      composeBackbone(element);
35894      if (element.hasCodeElement()) {
35895        composeCodeCore("code", element.getCodeElement(), false);
35896        composeCodeExtras("code", element.getCodeElement(), false);
35897      }
35898      if (element.hasUriElement()) {
35899        composeUriCore("uri", element.getUriElement(), false);
35900        composeUriExtras("uri", element.getUriElement(), false);
35901      }
35902      if (element.hasDescriptionElement()) {
35903        composeStringCore("description", element.getDescriptionElement(), false);
35904        composeStringExtras("description", element.getDescriptionElement(), false);
35905      }
35906      if (element.hasTypeElement()) {
35907        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
35908        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
35909      }
35910  }
35911
35912  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
35913    if (element != null) {
35914      open(name);
35915      composeCodeSystemConceptDefinitionComponentInner(element);
35916      close();
35917    }
35918  }
35919
35920  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
35921      composeBackbone(element);
35922      if (element.hasCodeElement()) {
35923        composeCodeCore("code", element.getCodeElement(), false);
35924        composeCodeExtras("code", element.getCodeElement(), false);
35925      }
35926      if (element.hasDisplayElement()) {
35927        composeStringCore("display", element.getDisplayElement(), false);
35928        composeStringExtras("display", element.getDisplayElement(), false);
35929      }
35930      if (element.hasDefinitionElement()) {
35931        composeStringCore("definition", element.getDefinitionElement(), false);
35932        composeStringExtras("definition", element.getDefinitionElement(), false);
35933      }
35934      if (element.hasDesignation()) {
35935        openArray("designation");
35936        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
35937          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
35938        closeArray();
35939      };
35940      if (element.hasProperty()) {
35941        openArray("property");
35942        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
35943          composeCodeSystemConceptPropertyComponent(null, e);
35944        closeArray();
35945      };
35946      if (element.hasConcept()) {
35947        openArray("concept");
35948        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
35949          composeCodeSystemConceptDefinitionComponent(null, e);
35950        closeArray();
35951      };
35952  }
35953
35954  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
35955    if (element != null) {
35956      open(name);
35957      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
35958      close();
35959    }
35960  }
35961
35962  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
35963      composeBackbone(element);
35964      if (element.hasLanguageElement()) {
35965        composeCodeCore("language", element.getLanguageElement(), false);
35966        composeCodeExtras("language", element.getLanguageElement(), false);
35967      }
35968      if (element.hasUse()) {
35969        composeCoding("use", element.getUse());
35970      }
35971      if (element.hasValueElement()) {
35972        composeStringCore("value", element.getValueElement(), false);
35973        composeStringExtras("value", element.getValueElement(), false);
35974      }
35975  }
35976
35977  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
35978    if (element != null) {
35979      open(name);
35980      composeCodeSystemConceptPropertyComponentInner(element);
35981      close();
35982    }
35983  }
35984
35985  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element) throws IOException {
35986      composeBackbone(element);
35987      if (element.hasCodeElement()) {
35988        composeCodeCore("code", element.getCodeElement(), false);
35989        composeCodeExtras("code", element.getCodeElement(), false);
35990      }
35991      if (element.hasValue()) {
35992        composeType("value", element.getValue());
35993      }
35994  }
35995
35996  protected void composeCommunication(String name, Communication element) throws IOException {
35997    if (element != null) {
35998      prop("resourceType", name);
35999      composeCommunicationInner(element);
36000    }
36001  }
36002
36003  protected void composeCommunicationInner(Communication element) throws IOException {
36004      composeDomainResourceElements(element);
36005      if (element.hasIdentifier()) {
36006        openArray("identifier");
36007        for (Identifier e : element.getIdentifier()) 
36008          composeIdentifier(null, e);
36009        closeArray();
36010      };
36011      if (element.hasInstantiatesCanonical()) {
36012        openArray("instantiatesCanonical");
36013        for (CanonicalType e : element.getInstantiatesCanonical()) 
36014          composeCanonicalCore(null, e, true);
36015        closeArray();
36016        if (anyHasExtras(element.getInstantiatesCanonical())) {
36017          openArray("_instantiatesCanonical");
36018          for (CanonicalType e : element.getInstantiatesCanonical()) 
36019            composeCanonicalExtras(null, e, true);
36020          closeArray();
36021        }
36022      };
36023      if (element.hasInstantiatesUri()) {
36024        openArray("instantiatesUri");
36025        for (UriType e : element.getInstantiatesUri()) 
36026          composeUriCore(null, e, true);
36027        closeArray();
36028        if (anyHasExtras(element.getInstantiatesUri())) {
36029          openArray("_instantiatesUri");
36030          for (UriType e : element.getInstantiatesUri()) 
36031            composeUriExtras(null, e, true);
36032          closeArray();
36033        }
36034      };
36035      if (element.hasBasedOn()) {
36036        openArray("basedOn");
36037        for (Reference e : element.getBasedOn()) 
36038          composeReference(null, e);
36039        closeArray();
36040      };
36041      if (element.hasPartOf()) {
36042        openArray("partOf");
36043        for (Reference e : element.getPartOf()) 
36044          composeReference(null, e);
36045        closeArray();
36046      };
36047      if (element.hasInResponseTo()) {
36048        openArray("inResponseTo");
36049        for (Reference e : element.getInResponseTo()) 
36050          composeReference(null, e);
36051        closeArray();
36052      };
36053      if (element.hasStatusElement()) {
36054        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
36055        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
36056      }
36057      if (element.hasStatusReason()) {
36058        composeCodeableConcept("statusReason", element.getStatusReason());
36059      }
36060      if (element.hasCategory()) {
36061        openArray("category");
36062        for (CodeableConcept e : element.getCategory()) 
36063          composeCodeableConcept(null, e);
36064        closeArray();
36065      };
36066      if (element.hasPriorityElement()) {
36067        composeEnumerationCore("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
36068        composeEnumerationExtras("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
36069      }
36070      if (element.hasMedium()) {
36071        openArray("medium");
36072        for (CodeableConcept e : element.getMedium()) 
36073          composeCodeableConcept(null, e);
36074        closeArray();
36075      };
36076      if (element.hasSubject()) {
36077        composeReference("subject", element.getSubject());
36078      }
36079      if (element.hasTopic()) {
36080        composeCodeableConcept("topic", element.getTopic());
36081      }
36082      if (element.hasAbout()) {
36083        openArray("about");
36084        for (Reference e : element.getAbout()) 
36085          composeReference(null, e);
36086        closeArray();
36087      };
36088      if (element.hasEncounter()) {
36089        composeReference("encounter", element.getEncounter());
36090      }
36091      if (element.hasSentElement()) {
36092        composeDateTimeCore("sent", element.getSentElement(), false);
36093        composeDateTimeExtras("sent", element.getSentElement(), false);
36094      }
36095      if (element.hasReceivedElement()) {
36096        composeDateTimeCore("received", element.getReceivedElement(), false);
36097        composeDateTimeExtras("received", element.getReceivedElement(), false);
36098      }
36099      if (element.hasRecipient()) {
36100        openArray("recipient");
36101        for (Reference e : element.getRecipient()) 
36102          composeReference(null, e);
36103        closeArray();
36104      };
36105      if (element.hasSender()) {
36106        composeReference("sender", element.getSender());
36107      }
36108      if (element.hasReasonCode()) {
36109        openArray("reasonCode");
36110        for (CodeableConcept e : element.getReasonCode()) 
36111          composeCodeableConcept(null, e);
36112        closeArray();
36113      };
36114      if (element.hasReasonReference()) {
36115        openArray("reasonReference");
36116        for (Reference e : element.getReasonReference()) 
36117          composeReference(null, e);
36118        closeArray();
36119      };
36120      if (element.hasPayload()) {
36121        openArray("payload");
36122        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
36123          composeCommunicationCommunicationPayloadComponent(null, e);
36124        closeArray();
36125      };
36126      if (element.hasNote()) {
36127        openArray("note");
36128        for (Annotation e : element.getNote()) 
36129          composeAnnotation(null, e);
36130        closeArray();
36131      };
36132  }
36133
36134  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
36135    if (element != null) {
36136      open(name);
36137      composeCommunicationCommunicationPayloadComponentInner(element);
36138      close();
36139    }
36140  }
36141
36142  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
36143      composeBackbone(element);
36144      if (element.hasContent()) {
36145        composeType("content", element.getContent());
36146      }
36147  }
36148
36149  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
36150    if (element != null) {
36151      prop("resourceType", name);
36152      composeCommunicationRequestInner(element);
36153    }
36154  }
36155
36156  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
36157      composeDomainResourceElements(element);
36158      if (element.hasIdentifier()) {
36159        openArray("identifier");
36160        for (Identifier e : element.getIdentifier()) 
36161          composeIdentifier(null, e);
36162        closeArray();
36163      };
36164      if (element.hasBasedOn()) {
36165        openArray("basedOn");
36166        for (Reference e : element.getBasedOn()) 
36167          composeReference(null, e);
36168        closeArray();
36169      };
36170      if (element.hasReplaces()) {
36171        openArray("replaces");
36172        for (Reference e : element.getReplaces()) 
36173          composeReference(null, e);
36174        closeArray();
36175      };
36176      if (element.hasGroupIdentifier()) {
36177        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
36178      }
36179      if (element.hasStatusElement()) {
36180        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
36181        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
36182      }
36183      if (element.hasStatusReason()) {
36184        composeCodeableConcept("statusReason", element.getStatusReason());
36185      }
36186      if (element.hasCategory()) {
36187        openArray("category");
36188        for (CodeableConcept e : element.getCategory()) 
36189          composeCodeableConcept(null, e);
36190        closeArray();
36191      };
36192      if (element.hasPriorityElement()) {
36193        composeEnumerationCore("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
36194        composeEnumerationExtras("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
36195      }
36196      if (element.hasDoNotPerformElement()) {
36197        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
36198        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
36199      }
36200      if (element.hasMedium()) {
36201        openArray("medium");
36202        for (CodeableConcept e : element.getMedium()) 
36203          composeCodeableConcept(null, e);
36204        closeArray();
36205      };
36206      if (element.hasSubject()) {
36207        composeReference("subject", element.getSubject());
36208      }
36209      if (element.hasAbout()) {
36210        openArray("about");
36211        for (Reference e : element.getAbout()) 
36212          composeReference(null, e);
36213        closeArray();
36214      };
36215      if (element.hasEncounter()) {
36216        composeReference("encounter", element.getEncounter());
36217      }
36218      if (element.hasPayload()) {
36219        openArray("payload");
36220        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
36221          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
36222        closeArray();
36223      };
36224      if (element.hasOccurrence()) {
36225        composeType("occurrence", element.getOccurrence());
36226      }
36227      if (element.hasAuthoredOnElement()) {
36228        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
36229        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
36230      }
36231      if (element.hasRequester()) {
36232        composeReference("requester", element.getRequester());
36233      }
36234      if (element.hasRecipient()) {
36235        openArray("recipient");
36236        for (Reference e : element.getRecipient()) 
36237          composeReference(null, e);
36238        closeArray();
36239      };
36240      if (element.hasSender()) {
36241        composeReference("sender", element.getSender());
36242      }
36243      if (element.hasReasonCode()) {
36244        openArray("reasonCode");
36245        for (CodeableConcept e : element.getReasonCode()) 
36246          composeCodeableConcept(null, e);
36247        closeArray();
36248      };
36249      if (element.hasReasonReference()) {
36250        openArray("reasonReference");
36251        for (Reference e : element.getReasonReference()) 
36252          composeReference(null, e);
36253        closeArray();
36254      };
36255      if (element.hasNote()) {
36256        openArray("note");
36257        for (Annotation e : element.getNote()) 
36258          composeAnnotation(null, e);
36259        closeArray();
36260      };
36261  }
36262
36263  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
36264    if (element != null) {
36265      open(name);
36266      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
36267      close();
36268    }
36269  }
36270
36271  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
36272      composeBackbone(element);
36273      if (element.hasContent()) {
36274        composeType("content", element.getContent());
36275      }
36276  }
36277
36278  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
36279    if (element != null) {
36280      prop("resourceType", name);
36281      composeCompartmentDefinitionInner(element);
36282    }
36283  }
36284
36285  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
36286      composeDomainResourceElements(element);
36287      if (element.hasUrlElement()) {
36288        composeUriCore("url", element.getUrlElement(), false);
36289        composeUriExtras("url", element.getUrlElement(), false);
36290      }
36291      if (element.hasVersionElement()) {
36292        composeStringCore("version", element.getVersionElement(), false);
36293        composeStringExtras("version", element.getVersionElement(), false);
36294      }
36295      if (element.hasNameElement()) {
36296        composeStringCore("name", element.getNameElement(), false);
36297        composeStringExtras("name", element.getNameElement(), false);
36298      }
36299      if (element.hasStatusElement()) {
36300        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
36301        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
36302      }
36303      if (element.hasExperimentalElement()) {
36304        composeBooleanCore("experimental", element.getExperimentalElement(), false);
36305        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
36306      }
36307      if (element.hasDateElement()) {
36308        composeDateTimeCore("date", element.getDateElement(), false);
36309        composeDateTimeExtras("date", element.getDateElement(), false);
36310      }
36311      if (element.hasPublisherElement()) {
36312        composeStringCore("publisher", element.getPublisherElement(), false);
36313        composeStringExtras("publisher", element.getPublisherElement(), false);
36314      }
36315      if (element.hasContact()) {
36316        openArray("contact");
36317        for (ContactDetail e : element.getContact()) 
36318          composeContactDetail(null, e);
36319        closeArray();
36320      };
36321      if (element.hasDescriptionElement()) {
36322        composeMarkdownCore("description", element.getDescriptionElement(), false);
36323        composeMarkdownExtras("description", element.getDescriptionElement(), false);
36324      }
36325      if (element.hasUseContext()) {
36326        openArray("useContext");
36327        for (UsageContext e : element.getUseContext()) 
36328          composeUsageContext(null, e);
36329        closeArray();
36330      };
36331      if (element.hasPurposeElement()) {
36332        composeMarkdownCore("purpose", element.getPurposeElement(), false);
36333        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
36334      }
36335      if (element.hasCodeElement()) {
36336        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
36337        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
36338      }
36339      if (element.hasSearchElement()) {
36340        composeBooleanCore("search", element.getSearchElement(), false);
36341        composeBooleanExtras("search", element.getSearchElement(), false);
36342      }
36343      if (element.hasResource()) {
36344        openArray("resource");
36345        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
36346          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
36347        closeArray();
36348      };
36349  }
36350
36351  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
36352    if (element != null) {
36353      open(name);
36354      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
36355      close();
36356    }
36357  }
36358
36359  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
36360      composeBackbone(element);
36361      if (element.hasCodeElement()) {
36362        composeCodeCore("code", element.getCodeElement(), false);
36363        composeCodeExtras("code", element.getCodeElement(), false);
36364      }
36365      if (element.hasParam()) {
36366        openArray("param");
36367        for (StringType e : element.getParam()) 
36368          composeStringCore(null, e, true);
36369        closeArray();
36370        if (anyHasExtras(element.getParam())) {
36371          openArray("_param");
36372          for (StringType e : element.getParam()) 
36373            composeStringExtras(null, e, true);
36374          closeArray();
36375        }
36376      };
36377      if (element.hasDocumentationElement()) {
36378        composeStringCore("documentation", element.getDocumentationElement(), false);
36379        composeStringExtras("documentation", element.getDocumentationElement(), false);
36380      }
36381  }
36382
36383  protected void composeComposition(String name, Composition element) throws IOException {
36384    if (element != null) {
36385      prop("resourceType", name);
36386      composeCompositionInner(element);
36387    }
36388  }
36389
36390  protected void composeCompositionInner(Composition element) throws IOException {
36391      composeDomainResourceElements(element);
36392      if (element.hasIdentifier()) {
36393        composeIdentifier("identifier", element.getIdentifier());
36394      }
36395      if (element.hasStatusElement()) {
36396        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
36397        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
36398      }
36399      if (element.hasType()) {
36400        composeCodeableConcept("type", element.getType());
36401      }
36402      if (element.hasCategory()) {
36403        openArray("category");
36404        for (CodeableConcept e : element.getCategory()) 
36405          composeCodeableConcept(null, e);
36406        closeArray();
36407      };
36408      if (element.hasSubject()) {
36409        composeReference("subject", element.getSubject());
36410      }
36411      if (element.hasEncounter()) {
36412        composeReference("encounter", element.getEncounter());
36413      }
36414      if (element.hasDateElement()) {
36415        composeDateTimeCore("date", element.getDateElement(), false);
36416        composeDateTimeExtras("date", element.getDateElement(), false);
36417      }
36418      if (element.hasAuthor()) {
36419        openArray("author");
36420        for (Reference e : element.getAuthor()) 
36421          composeReference(null, e);
36422        closeArray();
36423      };
36424      if (element.hasTitleElement()) {
36425        composeStringCore("title", element.getTitleElement(), false);
36426        composeStringExtras("title", element.getTitleElement(), false);
36427      }
36428      if (element.hasConfidentialityElement()) {
36429        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
36430        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
36431      }
36432      if (element.hasAttester()) {
36433        openArray("attester");
36434        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
36435          composeCompositionCompositionAttesterComponent(null, e);
36436        closeArray();
36437      };
36438      if (element.hasCustodian()) {
36439        composeReference("custodian", element.getCustodian());
36440      }
36441      if (element.hasRelatesTo()) {
36442        openArray("relatesTo");
36443        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
36444          composeCompositionCompositionRelatesToComponent(null, e);
36445        closeArray();
36446      };
36447      if (element.hasEvent()) {
36448        openArray("event");
36449        for (Composition.CompositionEventComponent e : element.getEvent()) 
36450          composeCompositionCompositionEventComponent(null, e);
36451        closeArray();
36452      };
36453      if (element.hasSection()) {
36454        openArray("section");
36455        for (Composition.SectionComponent e : element.getSection()) 
36456          composeCompositionSectionComponent(null, e);
36457        closeArray();
36458      };
36459  }
36460
36461  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
36462    if (element != null) {
36463      open(name);
36464      composeCompositionCompositionAttesterComponentInner(element);
36465      close();
36466    }
36467  }
36468
36469  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
36470      composeBackbone(element);
36471      if (element.hasModeElement()) {
36472        composeEnumerationCore("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
36473        composeEnumerationExtras("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
36474      }
36475      if (element.hasTimeElement()) {
36476        composeDateTimeCore("time", element.getTimeElement(), false);
36477        composeDateTimeExtras("time", element.getTimeElement(), false);
36478      }
36479      if (element.hasParty()) {
36480        composeReference("party", element.getParty());
36481      }
36482  }
36483
36484  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
36485    if (element != null) {
36486      open(name);
36487      composeCompositionCompositionRelatesToComponentInner(element);
36488      close();
36489    }
36490  }
36491
36492  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element) throws IOException {
36493      composeBackbone(element);
36494      if (element.hasCodeElement()) {
36495        composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
36496        composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
36497      }
36498      if (element.hasTarget()) {
36499        composeType("target", element.getTarget());
36500      }
36501  }
36502
36503  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
36504    if (element != null) {
36505      open(name);
36506      composeCompositionCompositionEventComponentInner(element);
36507      close();
36508    }
36509  }
36510
36511  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
36512      composeBackbone(element);
36513      if (element.hasCode()) {
36514        openArray("code");
36515        for (CodeableConcept e : element.getCode()) 
36516          composeCodeableConcept(null, e);
36517        closeArray();
36518      };
36519      if (element.hasPeriod()) {
36520        composePeriod("period", element.getPeriod());
36521      }
36522      if (element.hasDetail()) {
36523        openArray("detail");
36524        for (Reference e : element.getDetail()) 
36525          composeReference(null, e);
36526        closeArray();
36527      };
36528  }
36529
36530  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
36531    if (element != null) {
36532      open(name);
36533      composeCompositionSectionComponentInner(element);
36534      close();
36535    }
36536  }
36537
36538  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
36539      composeBackbone(element);
36540      if (element.hasTitleElement()) {
36541        composeStringCore("title", element.getTitleElement(), false);
36542        composeStringExtras("title", element.getTitleElement(), false);
36543      }
36544      if (element.hasCode()) {
36545        composeCodeableConcept("code", element.getCode());
36546      }
36547      if (element.hasAuthor()) {
36548        openArray("author");
36549        for (Reference e : element.getAuthor()) 
36550          composeReference(null, e);
36551        closeArray();
36552      };
36553      if (element.hasFocus()) {
36554        composeReference("focus", element.getFocus());
36555      }
36556      if (element.hasText()) {
36557        composeNarrative("text", element.getText());
36558      }
36559      if (element.hasModeElement()) {
36560        composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
36561        composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
36562      }
36563      if (element.hasOrderedBy()) {
36564        composeCodeableConcept("orderedBy", element.getOrderedBy());
36565      }
36566      if (element.hasEntry()) {
36567        openArray("entry");
36568        for (Reference e : element.getEntry()) 
36569          composeReference(null, e);
36570        closeArray();
36571      };
36572      if (element.hasEmptyReason()) {
36573        composeCodeableConcept("emptyReason", element.getEmptyReason());
36574      }
36575      if (element.hasSection()) {
36576        openArray("section");
36577        for (Composition.SectionComponent e : element.getSection()) 
36578          composeCompositionSectionComponent(null, e);
36579        closeArray();
36580      };
36581  }
36582
36583  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
36584    if (element != null) {
36585      prop("resourceType", name);
36586      composeConceptMapInner(element);
36587    }
36588  }
36589
36590  protected void composeConceptMapInner(ConceptMap element) throws IOException {
36591      composeDomainResourceElements(element);
36592      if (element.hasUrlElement()) {
36593        composeUriCore("url", element.getUrlElement(), false);
36594        composeUriExtras("url", element.getUrlElement(), false);
36595      }
36596      if (element.hasIdentifier()) {
36597        composeIdentifier("identifier", element.getIdentifier());
36598      }
36599      if (element.hasVersionElement()) {
36600        composeStringCore("version", element.getVersionElement(), false);
36601        composeStringExtras("version", element.getVersionElement(), false);
36602      }
36603      if (element.hasNameElement()) {
36604        composeStringCore("name", element.getNameElement(), false);
36605        composeStringExtras("name", element.getNameElement(), false);
36606      }
36607      if (element.hasTitleElement()) {
36608        composeStringCore("title", element.getTitleElement(), false);
36609        composeStringExtras("title", element.getTitleElement(), false);
36610      }
36611      if (element.hasStatusElement()) {
36612        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
36613        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
36614      }
36615      if (element.hasExperimentalElement()) {
36616        composeBooleanCore("experimental", element.getExperimentalElement(), false);
36617        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
36618      }
36619      if (element.hasDateElement()) {
36620        composeDateTimeCore("date", element.getDateElement(), false);
36621        composeDateTimeExtras("date", element.getDateElement(), false);
36622      }
36623      if (element.hasPublisherElement()) {
36624        composeStringCore("publisher", element.getPublisherElement(), false);
36625        composeStringExtras("publisher", element.getPublisherElement(), false);
36626      }
36627      if (element.hasContact()) {
36628        openArray("contact");
36629        for (ContactDetail e : element.getContact()) 
36630          composeContactDetail(null, e);
36631        closeArray();
36632      };
36633      if (element.hasDescriptionElement()) {
36634        composeMarkdownCore("description", element.getDescriptionElement(), false);
36635        composeMarkdownExtras("description", element.getDescriptionElement(), false);
36636      }
36637      if (element.hasUseContext()) {
36638        openArray("useContext");
36639        for (UsageContext e : element.getUseContext()) 
36640          composeUsageContext(null, e);
36641        closeArray();
36642      };
36643      if (element.hasJurisdiction()) {
36644        openArray("jurisdiction");
36645        for (CodeableConcept e : element.getJurisdiction()) 
36646          composeCodeableConcept(null, e);
36647        closeArray();
36648      };
36649      if (element.hasPurposeElement()) {
36650        composeMarkdownCore("purpose", element.getPurposeElement(), false);
36651        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
36652      }
36653      if (element.hasCopyrightElement()) {
36654        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
36655        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
36656      }
36657      if (element.hasSource()) {
36658        composeType("source", element.getSource());
36659      }
36660      if (element.hasTarget()) {
36661        composeType("target", element.getTarget());
36662      }
36663      if (element.hasGroup()) {
36664        openArray("group");
36665        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
36666          composeConceptMapConceptMapGroupComponent(null, e);
36667        closeArray();
36668      };
36669  }
36670
36671  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
36672    if (element != null) {
36673      open(name);
36674      composeConceptMapConceptMapGroupComponentInner(element);
36675      close();
36676    }
36677  }
36678
36679  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element) throws IOException {
36680      composeBackbone(element);
36681      if (element.hasSourceElement()) {
36682        composeUriCore("source", element.getSourceElement(), false);
36683        composeUriExtras("source", element.getSourceElement(), false);
36684      }
36685      if (element.hasSourceVersionElement()) {
36686        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
36687        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
36688      }
36689      if (element.hasTargetElement()) {
36690        composeUriCore("target", element.getTargetElement(), false);
36691        composeUriExtras("target", element.getTargetElement(), false);
36692      }
36693      if (element.hasTargetVersionElement()) {
36694        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
36695        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
36696      }
36697      if (element.hasElement()) {
36698        openArray("element");
36699        for (ConceptMap.SourceElementComponent e : element.getElement()) 
36700          composeConceptMapSourceElementComponent(null, e);
36701        closeArray();
36702      };
36703      if (element.hasUnmapped()) {
36704        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
36705      }
36706  }
36707
36708  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
36709    if (element != null) {
36710      open(name);
36711      composeConceptMapSourceElementComponentInner(element);
36712      close();
36713    }
36714  }
36715
36716  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
36717      composeBackbone(element);
36718      if (element.hasCodeElement()) {
36719        composeCodeCore("code", element.getCodeElement(), false);
36720        composeCodeExtras("code", element.getCodeElement(), false);
36721      }
36722      if (element.hasDisplayElement()) {
36723        composeStringCore("display", element.getDisplayElement(), false);
36724        composeStringExtras("display", element.getDisplayElement(), false);
36725      }
36726      if (element.hasTarget()) {
36727        openArray("target");
36728        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
36729          composeConceptMapTargetElementComponent(null, e);
36730        closeArray();
36731      };
36732  }
36733
36734  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
36735    if (element != null) {
36736      open(name);
36737      composeConceptMapTargetElementComponentInner(element);
36738      close();
36739    }
36740  }
36741
36742  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
36743      composeBackbone(element);
36744      if (element.hasCodeElement()) {
36745        composeCodeCore("code", element.getCodeElement(), false);
36746        composeCodeExtras("code", element.getCodeElement(), false);
36747      }
36748      if (element.hasDisplayElement()) {
36749        composeStringCore("display", element.getDisplayElement(), false);
36750        composeStringExtras("display", element.getDisplayElement(), false);
36751      }
36752      if (element.hasEquivalenceElement()) {
36753        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
36754        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
36755      }
36756      if (element.hasCommentElement()) {
36757        composeStringCore("comment", element.getCommentElement(), false);
36758        composeStringExtras("comment", element.getCommentElement(), false);
36759      }
36760      if (element.hasDependsOn()) {
36761        openArray("dependsOn");
36762        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
36763          composeConceptMapOtherElementComponent(null, e);
36764        closeArray();
36765      };
36766      if (element.hasProduct()) {
36767        openArray("product");
36768        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
36769          composeConceptMapOtherElementComponent(null, e);
36770        closeArray();
36771      };
36772  }
36773
36774  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
36775    if (element != null) {
36776      open(name);
36777      composeConceptMapOtherElementComponentInner(element);
36778      close();
36779    }
36780  }
36781
36782  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
36783      composeBackbone(element);
36784      if (element.hasPropertyElement()) {
36785        composeUriCore("property", element.getPropertyElement(), false);
36786        composeUriExtras("property", element.getPropertyElement(), false);
36787      }
36788      if (element.hasSystemElement()) {
36789        composeCanonicalCore("system", element.getSystemElement(), false);
36790        composeCanonicalExtras("system", element.getSystemElement(), false);
36791      }
36792      if (element.hasValueElement()) {
36793        composeStringCore("value", element.getValueElement(), false);
36794        composeStringExtras("value", element.getValueElement(), false);
36795      }
36796      if (element.hasDisplayElement()) {
36797        composeStringCore("display", element.getDisplayElement(), false);
36798        composeStringExtras("display", element.getDisplayElement(), false);
36799      }
36800  }
36801
36802  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
36803    if (element != null) {
36804      open(name);
36805      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
36806      close();
36807    }
36808  }
36809
36810  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
36811      composeBackbone(element);
36812      if (element.hasModeElement()) {
36813        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
36814        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
36815      }
36816      if (element.hasCodeElement()) {
36817        composeCodeCore("code", element.getCodeElement(), false);
36818        composeCodeExtras("code", element.getCodeElement(), false);
36819      }
36820      if (element.hasDisplayElement()) {
36821        composeStringCore("display", element.getDisplayElement(), false);
36822        composeStringExtras("display", element.getDisplayElement(), false);
36823      }
36824      if (element.hasUrlElement()) {
36825        composeCanonicalCore("url", element.getUrlElement(), false);
36826        composeCanonicalExtras("url", element.getUrlElement(), false);
36827      }
36828  }
36829
36830  protected void composeCondition(String name, Condition element) throws IOException {
36831    if (element != null) {
36832      prop("resourceType", name);
36833      composeConditionInner(element);
36834    }
36835  }
36836
36837  protected void composeConditionInner(Condition element) throws IOException {
36838      composeDomainResourceElements(element);
36839      if (element.hasIdentifier()) {
36840        openArray("identifier");
36841        for (Identifier e : element.getIdentifier()) 
36842          composeIdentifier(null, e);
36843        closeArray();
36844      };
36845      if (element.hasClinicalStatus()) {
36846        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
36847      }
36848      if (element.hasVerificationStatus()) {
36849        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
36850      }
36851      if (element.hasCategory()) {
36852        openArray("category");
36853        for (CodeableConcept e : element.getCategory()) 
36854          composeCodeableConcept(null, e);
36855        closeArray();
36856      };
36857      if (element.hasSeverity()) {
36858        composeCodeableConcept("severity", element.getSeverity());
36859      }
36860      if (element.hasCode()) {
36861        composeCodeableConcept("code", element.getCode());
36862      }
36863      if (element.hasBodySite()) {
36864        openArray("bodySite");
36865        for (CodeableConcept e : element.getBodySite()) 
36866          composeCodeableConcept(null, e);
36867        closeArray();
36868      };
36869      if (element.hasSubject()) {
36870        composeReference("subject", element.getSubject());
36871      }
36872      if (element.hasEncounter()) {
36873        composeReference("encounter", element.getEncounter());
36874      }
36875      if (element.hasOnset()) {
36876        composeType("onset", element.getOnset());
36877      }
36878      if (element.hasAbatement()) {
36879        composeType("abatement", element.getAbatement());
36880      }
36881      if (element.hasRecordedDateElement()) {
36882        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
36883        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
36884      }
36885      if (element.hasRecorder()) {
36886        composeReference("recorder", element.getRecorder());
36887      }
36888      if (element.hasAsserter()) {
36889        composeReference("asserter", element.getAsserter());
36890      }
36891      if (element.hasStage()) {
36892        openArray("stage");
36893        for (Condition.ConditionStageComponent e : element.getStage()) 
36894          composeConditionConditionStageComponent(null, e);
36895        closeArray();
36896      };
36897      if (element.hasEvidence()) {
36898        openArray("evidence");
36899        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
36900          composeConditionConditionEvidenceComponent(null, e);
36901        closeArray();
36902      };
36903      if (element.hasNote()) {
36904        openArray("note");
36905        for (Annotation e : element.getNote()) 
36906          composeAnnotation(null, e);
36907        closeArray();
36908      };
36909  }
36910
36911  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
36912    if (element != null) {
36913      open(name);
36914      composeConditionConditionStageComponentInner(element);
36915      close();
36916    }
36917  }
36918
36919  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
36920      composeBackbone(element);
36921      if (element.hasSummary()) {
36922        composeCodeableConcept("summary", element.getSummary());
36923      }
36924      if (element.hasAssessment()) {
36925        openArray("assessment");
36926        for (Reference e : element.getAssessment()) 
36927          composeReference(null, e);
36928        closeArray();
36929      };
36930      if (element.hasType()) {
36931        composeCodeableConcept("type", element.getType());
36932      }
36933  }
36934
36935  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
36936    if (element != null) {
36937      open(name);
36938      composeConditionConditionEvidenceComponentInner(element);
36939      close();
36940    }
36941  }
36942
36943  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
36944      composeBackbone(element);
36945      if (element.hasCode()) {
36946        openArray("code");
36947        for (CodeableConcept e : element.getCode()) 
36948          composeCodeableConcept(null, e);
36949        closeArray();
36950      };
36951      if (element.hasDetail()) {
36952        openArray("detail");
36953        for (Reference e : element.getDetail()) 
36954          composeReference(null, e);
36955        closeArray();
36956      };
36957  }
36958
36959  protected void composeConsent(String name, Consent element) throws IOException {
36960    if (element != null) {
36961      prop("resourceType", name);
36962      composeConsentInner(element);
36963    }
36964  }
36965
36966  protected void composeConsentInner(Consent element) throws IOException {
36967      composeDomainResourceElements(element);
36968      if (element.hasIdentifier()) {
36969        openArray("identifier");
36970        for (Identifier e : element.getIdentifier()) 
36971          composeIdentifier(null, e);
36972        closeArray();
36973      };
36974      if (element.hasStatusElement()) {
36975        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
36976        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
36977      }
36978      if (element.hasScope()) {
36979        composeCodeableConcept("scope", element.getScope());
36980      }
36981      if (element.hasCategory()) {
36982        openArray("category");
36983        for (CodeableConcept e : element.getCategory()) 
36984          composeCodeableConcept(null, e);
36985        closeArray();
36986      };
36987      if (element.hasPatient()) {
36988        composeReference("patient", element.getPatient());
36989      }
36990      if (element.hasDateTimeElement()) {
36991        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
36992        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
36993      }
36994      if (element.hasPerformer()) {
36995        openArray("performer");
36996        for (Reference e : element.getPerformer()) 
36997          composeReference(null, e);
36998        closeArray();
36999      };
37000      if (element.hasOrganization()) {
37001        openArray("organization");
37002        for (Reference e : element.getOrganization()) 
37003          composeReference(null, e);
37004        closeArray();
37005      };
37006      if (element.hasSource()) {
37007        composeType("source", element.getSource());
37008      }
37009      if (element.hasPolicy()) {
37010        openArray("policy");
37011        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
37012          composeConsentConsentPolicyComponent(null, e);
37013        closeArray();
37014      };
37015      if (element.hasPolicyRule()) {
37016        composeCodeableConcept("policyRule", element.getPolicyRule());
37017      }
37018      if (element.hasVerification()) {
37019        openArray("verification");
37020        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
37021          composeConsentConsentVerificationComponent(null, e);
37022        closeArray();
37023      };
37024      if (element.hasProvision()) {
37025        composeConsentprovisionComponent("provision", element.getProvision());
37026      }
37027  }
37028
37029  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
37030    if (element != null) {
37031      open(name);
37032      composeConsentConsentPolicyComponentInner(element);
37033      close();
37034    }
37035  }
37036
37037  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
37038      composeBackbone(element);
37039      if (element.hasAuthorityElement()) {
37040        composeUriCore("authority", element.getAuthorityElement(), false);
37041        composeUriExtras("authority", element.getAuthorityElement(), false);
37042      }
37043      if (element.hasUriElement()) {
37044        composeUriCore("uri", element.getUriElement(), false);
37045        composeUriExtras("uri", element.getUriElement(), false);
37046      }
37047  }
37048
37049  protected void composeConsentConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
37050    if (element != null) {
37051      open(name);
37052      composeConsentConsentVerificationComponentInner(element);
37053      close();
37054    }
37055  }
37056
37057  protected void composeConsentConsentVerificationComponentInner(Consent.ConsentVerificationComponent element) throws IOException {
37058      composeBackbone(element);
37059      if (element.hasVerifiedElement()) {
37060        composeBooleanCore("verified", element.getVerifiedElement(), false);
37061        composeBooleanExtras("verified", element.getVerifiedElement(), false);
37062      }
37063      if (element.hasVerifiedWith()) {
37064        composeReference("verifiedWith", element.getVerifiedWith());
37065      }
37066      if (element.hasVerificationDateElement()) {
37067        composeDateTimeCore("verificationDate", element.getVerificationDateElement(), false);
37068        composeDateTimeExtras("verificationDate", element.getVerificationDateElement(), false);
37069      }
37070  }
37071
37072  protected void composeConsentprovisionComponent(String name, Consent.provisionComponent element) throws IOException {
37073    if (element != null) {
37074      open(name);
37075      composeConsentprovisionComponentInner(element);
37076      close();
37077    }
37078  }
37079
37080  protected void composeConsentprovisionComponentInner(Consent.provisionComponent element) throws IOException {
37081      composeBackbone(element);
37082      if (element.hasTypeElement()) {
37083        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
37084        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
37085      }
37086      if (element.hasPeriod()) {
37087        composePeriod("period", element.getPeriod());
37088      }
37089      if (element.hasActor()) {
37090        openArray("actor");
37091        for (Consent.provisionActorComponent e : element.getActor()) 
37092          composeConsentprovisionActorComponent(null, e);
37093        closeArray();
37094      };
37095      if (element.hasAction()) {
37096        openArray("action");
37097        for (CodeableConcept e : element.getAction()) 
37098          composeCodeableConcept(null, e);
37099        closeArray();
37100      };
37101      if (element.hasSecurityLabel()) {
37102        openArray("securityLabel");
37103        for (Coding e : element.getSecurityLabel()) 
37104          composeCoding(null, e);
37105        closeArray();
37106      };
37107      if (element.hasPurpose()) {
37108        openArray("purpose");
37109        for (Coding e : element.getPurpose()) 
37110          composeCoding(null, e);
37111        closeArray();
37112      };
37113      if (element.hasClass_()) {
37114        openArray("class");
37115        for (Coding e : element.getClass_()) 
37116          composeCoding(null, e);
37117        closeArray();
37118      };
37119      if (element.hasCode()) {
37120        openArray("code");
37121        for (CodeableConcept e : element.getCode()) 
37122          composeCodeableConcept(null, e);
37123        closeArray();
37124      };
37125      if (element.hasDataPeriod()) {
37126        composePeriod("dataPeriod", element.getDataPeriod());
37127      }
37128      if (element.hasData()) {
37129        openArray("data");
37130        for (Consent.provisionDataComponent e : element.getData()) 
37131          composeConsentprovisionDataComponent(null, e);
37132        closeArray();
37133      };
37134      if (element.hasProvision()) {
37135        openArray("provision");
37136        for (Consent.provisionComponent e : element.getProvision()) 
37137          composeConsentprovisionComponent(null, e);
37138        closeArray();
37139      };
37140  }
37141
37142  protected void composeConsentprovisionActorComponent(String name, Consent.provisionActorComponent element) throws IOException {
37143    if (element != null) {
37144      open(name);
37145      composeConsentprovisionActorComponentInner(element);
37146      close();
37147    }
37148  }
37149
37150  protected void composeConsentprovisionActorComponentInner(Consent.provisionActorComponent element) throws IOException {
37151      composeBackbone(element);
37152      if (element.hasRole()) {
37153        composeCodeableConcept("role", element.getRole());
37154      }
37155      if (element.hasReference()) {
37156        composeReference("reference", element.getReference());
37157      }
37158  }
37159
37160  protected void composeConsentprovisionDataComponent(String name, Consent.provisionDataComponent element) throws IOException {
37161    if (element != null) {
37162      open(name);
37163      composeConsentprovisionDataComponentInner(element);
37164      close();
37165    }
37166  }
37167
37168  protected void composeConsentprovisionDataComponentInner(Consent.provisionDataComponent element) throws IOException {
37169      composeBackbone(element);
37170      if (element.hasMeaningElement()) {
37171        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
37172        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
37173      }
37174      if (element.hasReference()) {
37175        composeReference("reference", element.getReference());
37176      }
37177  }
37178
37179  protected void composeContract(String name, Contract element) throws IOException {
37180    if (element != null) {
37181      prop("resourceType", name);
37182      composeContractInner(element);
37183    }
37184  }
37185
37186  protected void composeContractInner(Contract element) throws IOException {
37187      composeDomainResourceElements(element);
37188      if (element.hasIdentifier()) {
37189        openArray("identifier");
37190        for (Identifier e : element.getIdentifier()) 
37191          composeIdentifier(null, e);
37192        closeArray();
37193      };
37194      if (element.hasUrlElement()) {
37195        composeUriCore("url", element.getUrlElement(), false);
37196        composeUriExtras("url", element.getUrlElement(), false);
37197      }
37198      if (element.hasVersionElement()) {
37199        composeStringCore("version", element.getVersionElement(), false);
37200        composeStringExtras("version", element.getVersionElement(), false);
37201      }
37202      if (element.hasStatusElement()) {
37203        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
37204        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
37205      }
37206      if (element.hasLegalState()) {
37207        composeCodeableConcept("legalState", element.getLegalState());
37208      }
37209      if (element.hasInstantiatesCanonical()) {
37210        composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
37211      }
37212      if (element.hasInstantiatesUriElement()) {
37213        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
37214        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
37215      }
37216      if (element.hasContentDerivative()) {
37217        composeCodeableConcept("contentDerivative", element.getContentDerivative());
37218      }
37219      if (element.hasIssuedElement()) {
37220        composeDateTimeCore("issued", element.getIssuedElement(), false);
37221        composeDateTimeExtras("issued", element.getIssuedElement(), false);
37222      }
37223      if (element.hasApplies()) {
37224        composePeriod("applies", element.getApplies());
37225      }
37226      if (element.hasExpirationType()) {
37227        composeCodeableConcept("expirationType", element.getExpirationType());
37228      }
37229      if (element.hasSubject()) {
37230        openArray("subject");
37231        for (Reference e : element.getSubject()) 
37232          composeReference(null, e);
37233        closeArray();
37234      };
37235      if (element.hasAuthority()) {
37236        openArray("authority");
37237        for (Reference e : element.getAuthority()) 
37238          composeReference(null, e);
37239        closeArray();
37240      };
37241      if (element.hasDomain()) {
37242        openArray("domain");
37243        for (Reference e : element.getDomain()) 
37244          composeReference(null, e);
37245        closeArray();
37246      };
37247      if (element.hasSite()) {
37248        openArray("site");
37249        for (Reference e : element.getSite()) 
37250          composeReference(null, e);
37251        closeArray();
37252      };
37253      if (element.hasNameElement()) {
37254        composeStringCore("name", element.getNameElement(), false);
37255        composeStringExtras("name", element.getNameElement(), false);
37256      }
37257      if (element.hasTitleElement()) {
37258        composeStringCore("title", element.getTitleElement(), false);
37259        composeStringExtras("title", element.getTitleElement(), false);
37260      }
37261      if (element.hasSubtitleElement()) {
37262        composeStringCore("subtitle", element.getSubtitleElement(), false);
37263        composeStringExtras("subtitle", element.getSubtitleElement(), false);
37264      }
37265      if (element.hasAlias()) {
37266        openArray("alias");
37267        for (StringType e : element.getAlias()) 
37268          composeStringCore(null, e, true);
37269        closeArray();
37270        if (anyHasExtras(element.getAlias())) {
37271          openArray("_alias");
37272          for (StringType e : element.getAlias()) 
37273            composeStringExtras(null, e, true);
37274          closeArray();
37275        }
37276      };
37277      if (element.hasAuthor()) {
37278        composeReference("author", element.getAuthor());
37279      }
37280      if (element.hasScope()) {
37281        composeCodeableConcept("scope", element.getScope());
37282      }
37283      if (element.hasTopic()) {
37284        composeType("topic", element.getTopic());
37285      }
37286      if (element.hasType()) {
37287        composeCodeableConcept("type", element.getType());
37288      }
37289      if (element.hasSubType()) {
37290        openArray("subType");
37291        for (CodeableConcept e : element.getSubType()) 
37292          composeCodeableConcept(null, e);
37293        closeArray();
37294      };
37295      if (element.hasContentDefinition()) {
37296        composeContractContentDefinitionComponent("contentDefinition", element.getContentDefinition());
37297      }
37298      if (element.hasTerm()) {
37299        openArray("term");
37300        for (Contract.TermComponent e : element.getTerm()) 
37301          composeContractTermComponent(null, e);
37302        closeArray();
37303      };
37304      if (element.hasSupportingInfo()) {
37305        openArray("supportingInfo");
37306        for (Reference e : element.getSupportingInfo()) 
37307          composeReference(null, e);
37308        closeArray();
37309      };
37310      if (element.hasRelevantHistory()) {
37311        openArray("relevantHistory");
37312        for (Reference e : element.getRelevantHistory()) 
37313          composeReference(null, e);
37314        closeArray();
37315      };
37316      if (element.hasSigner()) {
37317        openArray("signer");
37318        for (Contract.SignatoryComponent e : element.getSigner()) 
37319          composeContractSignatoryComponent(null, e);
37320        closeArray();
37321      };
37322      if (element.hasFriendly()) {
37323        openArray("friendly");
37324        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
37325          composeContractFriendlyLanguageComponent(null, e);
37326        closeArray();
37327      };
37328      if (element.hasLegal()) {
37329        openArray("legal");
37330        for (Contract.LegalLanguageComponent e : element.getLegal()) 
37331          composeContractLegalLanguageComponent(null, e);
37332        closeArray();
37333      };
37334      if (element.hasRule()) {
37335        openArray("rule");
37336        for (Contract.ComputableLanguageComponent e : element.getRule()) 
37337          composeContractComputableLanguageComponent(null, e);
37338        closeArray();
37339      };
37340      if (element.hasLegallyBinding()) {
37341        composeType("legallyBinding", element.getLegallyBinding());
37342      }
37343  }
37344
37345  protected void composeContractContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element) throws IOException {
37346    if (element != null) {
37347      open(name);
37348      composeContractContentDefinitionComponentInner(element);
37349      close();
37350    }
37351  }
37352
37353  protected void composeContractContentDefinitionComponentInner(Contract.ContentDefinitionComponent element) throws IOException {
37354      composeBackbone(element);
37355      if (element.hasType()) {
37356        composeCodeableConcept("type", element.getType());
37357      }
37358      if (element.hasSubType()) {
37359        composeCodeableConcept("subType", element.getSubType());
37360      }
37361      if (element.hasPublisher()) {
37362        composeReference("publisher", element.getPublisher());
37363      }
37364      if (element.hasPublicationDateElement()) {
37365        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
37366        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
37367      }
37368      if (element.hasPublicationStatusElement()) {
37369        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
37370        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
37371      }
37372      if (element.hasCopyrightElement()) {
37373        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
37374        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
37375      }
37376  }
37377
37378  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
37379    if (element != null) {
37380      open(name);
37381      composeContractTermComponentInner(element);
37382      close();
37383    }
37384  }
37385
37386  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
37387      composeBackbone(element);
37388      if (element.hasIdentifier()) {
37389        composeIdentifier("identifier", element.getIdentifier());
37390      }
37391      if (element.hasIssuedElement()) {
37392        composeDateTimeCore("issued", element.getIssuedElement(), false);
37393        composeDateTimeExtras("issued", element.getIssuedElement(), false);
37394      }
37395      if (element.hasApplies()) {
37396        composePeriod("applies", element.getApplies());
37397      }
37398      if (element.hasTopic()) {
37399        composeType("topic", element.getTopic());
37400      }
37401      if (element.hasType()) {
37402        composeCodeableConcept("type", element.getType());
37403      }
37404      if (element.hasSubType()) {
37405        composeCodeableConcept("subType", element.getSubType());
37406      }
37407      if (element.hasTextElement()) {
37408        composeStringCore("text", element.getTextElement(), false);
37409        composeStringExtras("text", element.getTextElement(), false);
37410      }
37411      if (element.hasSecurityLabel()) {
37412        openArray("securityLabel");
37413        for (Contract.SecurityLabelComponent e : element.getSecurityLabel()) 
37414          composeContractSecurityLabelComponent(null, e);
37415        closeArray();
37416      };
37417      if (element.hasOffer()) {
37418        composeContractContractOfferComponent("offer", element.getOffer());
37419      }
37420      if (element.hasAsset()) {
37421        openArray("asset");
37422        for (Contract.ContractAssetComponent e : element.getAsset()) 
37423          composeContractContractAssetComponent(null, e);
37424        closeArray();
37425      };
37426      if (element.hasAction()) {
37427        openArray("action");
37428        for (Contract.ActionComponent e : element.getAction()) 
37429          composeContractActionComponent(null, e);
37430        closeArray();
37431      };
37432      if (element.hasGroup()) {
37433        openArray("group");
37434        for (Contract.TermComponent e : element.getGroup()) 
37435          composeContractTermComponent(null, e);
37436        closeArray();
37437      };
37438  }
37439
37440  protected void composeContractSecurityLabelComponent(String name, Contract.SecurityLabelComponent element) throws IOException {
37441    if (element != null) {
37442      open(name);
37443      composeContractSecurityLabelComponentInner(element);
37444      close();
37445    }
37446  }
37447
37448  protected void composeContractSecurityLabelComponentInner(Contract.SecurityLabelComponent element) throws IOException {
37449      composeBackbone(element);
37450      if (element.hasNumber()) {
37451        openArray("number");
37452        for (UnsignedIntType e : element.getNumber()) 
37453          composeUnsignedIntCore(null, e, true);
37454        closeArray();
37455        if (anyHasExtras(element.getNumber())) {
37456          openArray("_number");
37457          for (UnsignedIntType e : element.getNumber()) 
37458            composeUnsignedIntExtras(null, e, true);
37459          closeArray();
37460        }
37461      };
37462      if (element.hasClassification()) {
37463        composeCoding("classification", element.getClassification());
37464      }
37465      if (element.hasCategory()) {
37466        openArray("category");
37467        for (Coding e : element.getCategory()) 
37468          composeCoding(null, e);
37469        closeArray();
37470      };
37471      if (element.hasControl()) {
37472        openArray("control");
37473        for (Coding e : element.getControl()) 
37474          composeCoding(null, e);
37475        closeArray();
37476      };
37477  }
37478
37479  protected void composeContractContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
37480    if (element != null) {
37481      open(name);
37482      composeContractContractOfferComponentInner(element);
37483      close();
37484    }
37485  }
37486
37487  protected void composeContractContractOfferComponentInner(Contract.ContractOfferComponent element) throws IOException {
37488      composeBackbone(element);
37489      if (element.hasIdentifier()) {
37490        openArray("identifier");
37491        for (Identifier e : element.getIdentifier()) 
37492          composeIdentifier(null, e);
37493        closeArray();
37494      };
37495      if (element.hasParty()) {
37496        openArray("party");
37497        for (Contract.ContractPartyComponent e : element.getParty()) 
37498          composeContractContractPartyComponent(null, e);
37499        closeArray();
37500      };
37501      if (element.hasTopic()) {
37502        composeReference("topic", element.getTopic());
37503      }
37504      if (element.hasType()) {
37505        composeCodeableConcept("type", element.getType());
37506      }
37507      if (element.hasDecision()) {
37508        composeCodeableConcept("decision", element.getDecision());
37509      }
37510      if (element.hasDecisionMode()) {
37511        openArray("decisionMode");
37512        for (CodeableConcept e : element.getDecisionMode()) 
37513          composeCodeableConcept(null, e);
37514        closeArray();
37515      };
37516      if (element.hasAnswer()) {
37517        openArray("answer");
37518        for (Contract.AnswerComponent e : element.getAnswer()) 
37519          composeContractAnswerComponent(null, e);
37520        closeArray();
37521      };
37522      if (element.hasTextElement()) {
37523        composeStringCore("text", element.getTextElement(), false);
37524        composeStringExtras("text", element.getTextElement(), false);
37525      }
37526      if (element.hasLinkId()) {
37527        openArray("linkId");
37528        for (StringType e : element.getLinkId()) 
37529          composeStringCore(null, e, true);
37530        closeArray();
37531        if (anyHasExtras(element.getLinkId())) {
37532          openArray("_linkId");
37533          for (StringType e : element.getLinkId()) 
37534            composeStringExtras(null, e, true);
37535          closeArray();
37536        }
37537      };
37538      if (element.hasSecurityLabelNumber()) {
37539        openArray("securityLabelNumber");
37540        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37541          composeUnsignedIntCore(null, e, true);
37542        closeArray();
37543        if (anyHasExtras(element.getSecurityLabelNumber())) {
37544          openArray("_securityLabelNumber");
37545          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37546            composeUnsignedIntExtras(null, e, true);
37547          closeArray();
37548        }
37549      };
37550  }
37551
37552  protected void composeContractContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
37553    if (element != null) {
37554      open(name);
37555      composeContractContractPartyComponentInner(element);
37556      close();
37557    }
37558  }
37559
37560  protected void composeContractContractPartyComponentInner(Contract.ContractPartyComponent element) throws IOException {
37561      composeBackbone(element);
37562      if (element.hasReference()) {
37563        openArray("reference");
37564        for (Reference e : element.getReference()) 
37565          composeReference(null, e);
37566        closeArray();
37567      };
37568      if (element.hasRole()) {
37569        composeCodeableConcept("role", element.getRole());
37570      }
37571  }
37572
37573  protected void composeContractAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
37574    if (element != null) {
37575      open(name);
37576      composeContractAnswerComponentInner(element);
37577      close();
37578    }
37579  }
37580
37581  protected void composeContractAnswerComponentInner(Contract.AnswerComponent element) throws IOException {
37582      composeBackbone(element);
37583      if (element.hasValue()) {
37584        composeType("value", element.getValue());
37585      }
37586  }
37587
37588  protected void composeContractContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
37589    if (element != null) {
37590      open(name);
37591      composeContractContractAssetComponentInner(element);
37592      close();
37593    }
37594  }
37595
37596  protected void composeContractContractAssetComponentInner(Contract.ContractAssetComponent element) throws IOException {
37597      composeBackbone(element);
37598      if (element.hasScope()) {
37599        composeCodeableConcept("scope", element.getScope());
37600      }
37601      if (element.hasType()) {
37602        openArray("type");
37603        for (CodeableConcept e : element.getType()) 
37604          composeCodeableConcept(null, e);
37605        closeArray();
37606      };
37607      if (element.hasTypeReference()) {
37608        openArray("typeReference");
37609        for (Reference e : element.getTypeReference()) 
37610          composeReference(null, e);
37611        closeArray();
37612      };
37613      if (element.hasSubtype()) {
37614        openArray("subtype");
37615        for (CodeableConcept e : element.getSubtype()) 
37616          composeCodeableConcept(null, e);
37617        closeArray();
37618      };
37619      if (element.hasRelationship()) {
37620        composeCoding("relationship", element.getRelationship());
37621      }
37622      if (element.hasContext()) {
37623        openArray("context");
37624        for (Contract.AssetContextComponent e : element.getContext()) 
37625          composeContractAssetContextComponent(null, e);
37626        closeArray();
37627      };
37628      if (element.hasConditionElement()) {
37629        composeStringCore("condition", element.getConditionElement(), false);
37630        composeStringExtras("condition", element.getConditionElement(), false);
37631      }
37632      if (element.hasPeriodType()) {
37633        openArray("periodType");
37634        for (CodeableConcept e : element.getPeriodType()) 
37635          composeCodeableConcept(null, e);
37636        closeArray();
37637      };
37638      if (element.hasPeriod()) {
37639        openArray("period");
37640        for (Period e : element.getPeriod()) 
37641          composePeriod(null, e);
37642        closeArray();
37643      };
37644      if (element.hasUsePeriod()) {
37645        openArray("usePeriod");
37646        for (Period e : element.getUsePeriod()) 
37647          composePeriod(null, e);
37648        closeArray();
37649      };
37650      if (element.hasTextElement()) {
37651        composeStringCore("text", element.getTextElement(), false);
37652        composeStringExtras("text", element.getTextElement(), false);
37653      }
37654      if (element.hasLinkId()) {
37655        openArray("linkId");
37656        for (StringType e : element.getLinkId()) 
37657          composeStringCore(null, e, true);
37658        closeArray();
37659        if (anyHasExtras(element.getLinkId())) {
37660          openArray("_linkId");
37661          for (StringType e : element.getLinkId()) 
37662            composeStringExtras(null, e, true);
37663          closeArray();
37664        }
37665      };
37666      if (element.hasAnswer()) {
37667        openArray("answer");
37668        for (Contract.AnswerComponent e : element.getAnswer()) 
37669          composeContractAnswerComponent(null, e);
37670        closeArray();
37671      };
37672      if (element.hasSecurityLabelNumber()) {
37673        openArray("securityLabelNumber");
37674        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37675          composeUnsignedIntCore(null, e, true);
37676        closeArray();
37677        if (anyHasExtras(element.getSecurityLabelNumber())) {
37678          openArray("_securityLabelNumber");
37679          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37680            composeUnsignedIntExtras(null, e, true);
37681          closeArray();
37682        }
37683      };
37684      if (element.hasValuedItem()) {
37685        openArray("valuedItem");
37686        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
37687          composeContractValuedItemComponent(null, e);
37688        closeArray();
37689      };
37690  }
37691
37692  protected void composeContractAssetContextComponent(String name, Contract.AssetContextComponent element) throws IOException {
37693    if (element != null) {
37694      open(name);
37695      composeContractAssetContextComponentInner(element);
37696      close();
37697    }
37698  }
37699
37700  protected void composeContractAssetContextComponentInner(Contract.AssetContextComponent element) throws IOException {
37701      composeBackbone(element);
37702      if (element.hasReference()) {
37703        composeReference("reference", element.getReference());
37704      }
37705      if (element.hasCode()) {
37706        openArray("code");
37707        for (CodeableConcept e : element.getCode()) 
37708          composeCodeableConcept(null, e);
37709        closeArray();
37710      };
37711      if (element.hasTextElement()) {
37712        composeStringCore("text", element.getTextElement(), false);
37713        composeStringExtras("text", element.getTextElement(), false);
37714      }
37715  }
37716
37717  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
37718    if (element != null) {
37719      open(name);
37720      composeContractValuedItemComponentInner(element);
37721      close();
37722    }
37723  }
37724
37725  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
37726      composeBackbone(element);
37727      if (element.hasEntity()) {
37728        composeType("entity", element.getEntity());
37729      }
37730      if (element.hasIdentifier()) {
37731        composeIdentifier("identifier", element.getIdentifier());
37732      }
37733      if (element.hasEffectiveTimeElement()) {
37734        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
37735        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
37736      }
37737      if (element.hasQuantity()) {
37738        composeQuantity("quantity", element.getQuantity());
37739      }
37740      if (element.hasUnitPrice()) {
37741        composeMoney("unitPrice", element.getUnitPrice());
37742      }
37743      if (element.hasFactorElement()) {
37744        composeDecimalCore("factor", element.getFactorElement(), false);
37745        composeDecimalExtras("factor", element.getFactorElement(), false);
37746      }
37747      if (element.hasPointsElement()) {
37748        composeDecimalCore("points", element.getPointsElement(), false);
37749        composeDecimalExtras("points", element.getPointsElement(), false);
37750      }
37751      if (element.hasNet()) {
37752        composeMoney("net", element.getNet());
37753      }
37754      if (element.hasPaymentElement()) {
37755        composeStringCore("payment", element.getPaymentElement(), false);
37756        composeStringExtras("payment", element.getPaymentElement(), false);
37757      }
37758      if (element.hasPaymentDateElement()) {
37759        composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
37760        composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
37761      }
37762      if (element.hasResponsible()) {
37763        composeReference("responsible", element.getResponsible());
37764      }
37765      if (element.hasRecipient()) {
37766        composeReference("recipient", element.getRecipient());
37767      }
37768      if (element.hasLinkId()) {
37769        openArray("linkId");
37770        for (StringType e : element.getLinkId()) 
37771          composeStringCore(null, e, true);
37772        closeArray();
37773        if (anyHasExtras(element.getLinkId())) {
37774          openArray("_linkId");
37775          for (StringType e : element.getLinkId()) 
37776            composeStringExtras(null, e, true);
37777          closeArray();
37778        }
37779      };
37780      if (element.hasSecurityLabelNumber()) {
37781        openArray("securityLabelNumber");
37782        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37783          composeUnsignedIntCore(null, e, true);
37784        closeArray();
37785        if (anyHasExtras(element.getSecurityLabelNumber())) {
37786          openArray("_securityLabelNumber");
37787          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37788            composeUnsignedIntExtras(null, e, true);
37789          closeArray();
37790        }
37791      };
37792  }
37793
37794  protected void composeContractActionComponent(String name, Contract.ActionComponent element) throws IOException {
37795    if (element != null) {
37796      open(name);
37797      composeContractActionComponentInner(element);
37798      close();
37799    }
37800  }
37801
37802  protected void composeContractActionComponentInner(Contract.ActionComponent element) throws IOException {
37803      composeBackbone(element);
37804      if (element.hasDoNotPerformElement()) {
37805        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
37806        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
37807      }
37808      if (element.hasType()) {
37809        composeCodeableConcept("type", element.getType());
37810      }
37811      if (element.hasSubject()) {
37812        openArray("subject");
37813        for (Contract.ActionSubjectComponent e : element.getSubject()) 
37814          composeContractActionSubjectComponent(null, e);
37815        closeArray();
37816      };
37817      if (element.hasIntent()) {
37818        composeCodeableConcept("intent", element.getIntent());
37819      }
37820      if (element.hasLinkId()) {
37821        openArray("linkId");
37822        for (StringType e : element.getLinkId()) 
37823          composeStringCore(null, e, true);
37824        closeArray();
37825        if (anyHasExtras(element.getLinkId())) {
37826          openArray("_linkId");
37827          for (StringType e : element.getLinkId()) 
37828            composeStringExtras(null, e, true);
37829          closeArray();
37830        }
37831      };
37832      if (element.hasStatus()) {
37833        composeCodeableConcept("status", element.getStatus());
37834      }
37835      if (element.hasContext()) {
37836        composeReference("context", element.getContext());
37837      }
37838      if (element.hasContextLinkId()) {
37839        openArray("contextLinkId");
37840        for (StringType e : element.getContextLinkId()) 
37841          composeStringCore(null, e, true);
37842        closeArray();
37843        if (anyHasExtras(element.getContextLinkId())) {
37844          openArray("_contextLinkId");
37845          for (StringType e : element.getContextLinkId()) 
37846            composeStringExtras(null, e, true);
37847          closeArray();
37848        }
37849      };
37850      if (element.hasOccurrence()) {
37851        composeType("occurrence", element.getOccurrence());
37852      }
37853      if (element.hasRequester()) {
37854        openArray("requester");
37855        for (Reference e : element.getRequester()) 
37856          composeReference(null, e);
37857        closeArray();
37858      };
37859      if (element.hasRequesterLinkId()) {
37860        openArray("requesterLinkId");
37861        for (StringType e : element.getRequesterLinkId()) 
37862          composeStringCore(null, e, true);
37863        closeArray();
37864        if (anyHasExtras(element.getRequesterLinkId())) {
37865          openArray("_requesterLinkId");
37866          for (StringType e : element.getRequesterLinkId()) 
37867            composeStringExtras(null, e, true);
37868          closeArray();
37869        }
37870      };
37871      if (element.hasPerformerType()) {
37872        openArray("performerType");
37873        for (CodeableConcept e : element.getPerformerType()) 
37874          composeCodeableConcept(null, e);
37875        closeArray();
37876      };
37877      if (element.hasPerformerRole()) {
37878        composeCodeableConcept("performerRole", element.getPerformerRole());
37879      }
37880      if (element.hasPerformer()) {
37881        composeReference("performer", element.getPerformer());
37882      }
37883      if (element.hasPerformerLinkId()) {
37884        openArray("performerLinkId");
37885        for (StringType e : element.getPerformerLinkId()) 
37886          composeStringCore(null, e, true);
37887        closeArray();
37888        if (anyHasExtras(element.getPerformerLinkId())) {
37889          openArray("_performerLinkId");
37890          for (StringType e : element.getPerformerLinkId()) 
37891            composeStringExtras(null, e, true);
37892          closeArray();
37893        }
37894      };
37895      if (element.hasReasonCode()) {
37896        openArray("reasonCode");
37897        for (CodeableConcept e : element.getReasonCode()) 
37898          composeCodeableConcept(null, e);
37899        closeArray();
37900      };
37901      if (element.hasReasonReference()) {
37902        openArray("reasonReference");
37903        for (Reference e : element.getReasonReference()) 
37904          composeReference(null, e);
37905        closeArray();
37906      };
37907      if (element.hasReason()) {
37908        openArray("reason");
37909        for (StringType e : element.getReason()) 
37910          composeStringCore(null, e, true);
37911        closeArray();
37912        if (anyHasExtras(element.getReason())) {
37913          openArray("_reason");
37914          for (StringType e : element.getReason()) 
37915            composeStringExtras(null, e, true);
37916          closeArray();
37917        }
37918      };
37919      if (element.hasReasonLinkId()) {
37920        openArray("reasonLinkId");
37921        for (StringType e : element.getReasonLinkId()) 
37922          composeStringCore(null, e, true);
37923        closeArray();
37924        if (anyHasExtras(element.getReasonLinkId())) {
37925          openArray("_reasonLinkId");
37926          for (StringType e : element.getReasonLinkId()) 
37927            composeStringExtras(null, e, true);
37928          closeArray();
37929        }
37930      };
37931      if (element.hasNote()) {
37932        openArray("note");
37933        for (Annotation e : element.getNote()) 
37934          composeAnnotation(null, e);
37935        closeArray();
37936      };
37937      if (element.hasSecurityLabelNumber()) {
37938        openArray("securityLabelNumber");
37939        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37940          composeUnsignedIntCore(null, e, true);
37941        closeArray();
37942        if (anyHasExtras(element.getSecurityLabelNumber())) {
37943          openArray("_securityLabelNumber");
37944          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37945            composeUnsignedIntExtras(null, e, true);
37946          closeArray();
37947        }
37948      };
37949  }
37950
37951  protected void composeContractActionSubjectComponent(String name, Contract.ActionSubjectComponent element) throws IOException {
37952    if (element != null) {
37953      open(name);
37954      composeContractActionSubjectComponentInner(element);
37955      close();
37956    }
37957  }
37958
37959  protected void composeContractActionSubjectComponentInner(Contract.ActionSubjectComponent element) throws IOException {
37960      composeBackbone(element);
37961      if (element.hasReference()) {
37962        openArray("reference");
37963        for (Reference e : element.getReference()) 
37964          composeReference(null, e);
37965        closeArray();
37966      };
37967      if (element.hasRole()) {
37968        composeCodeableConcept("role", element.getRole());
37969      }
37970  }
37971
37972  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
37973    if (element != null) {
37974      open(name);
37975      composeContractSignatoryComponentInner(element);
37976      close();
37977    }
37978  }
37979
37980  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
37981      composeBackbone(element);
37982      if (element.hasType()) {
37983        composeCoding("type", element.getType());
37984      }
37985      if (element.hasParty()) {
37986        composeReference("party", element.getParty());
37987      }
37988      if (element.hasSignature()) {
37989        openArray("signature");
37990        for (Signature e : element.getSignature()) 
37991          composeSignature(null, e);
37992        closeArray();
37993      };
37994  }
37995
37996  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
37997    if (element != null) {
37998      open(name);
37999      composeContractFriendlyLanguageComponentInner(element);
38000      close();
38001    }
38002  }
38003
38004  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
38005      composeBackbone(element);
38006      if (element.hasContent()) {
38007        composeType("content", element.getContent());
38008      }
38009  }
38010
38011  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
38012    if (element != null) {
38013      open(name);
38014      composeContractLegalLanguageComponentInner(element);
38015      close();
38016    }
38017  }
38018
38019  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
38020      composeBackbone(element);
38021      if (element.hasContent()) {
38022        composeType("content", element.getContent());
38023      }
38024  }
38025
38026  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
38027    if (element != null) {
38028      open(name);
38029      composeContractComputableLanguageComponentInner(element);
38030      close();
38031    }
38032  }
38033
38034  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
38035      composeBackbone(element);
38036      if (element.hasContent()) {
38037        composeType("content", element.getContent());
38038      }
38039  }
38040
38041  protected void composeCoverage(String name, Coverage element) throws IOException {
38042    if (element != null) {
38043      prop("resourceType", name);
38044      composeCoverageInner(element);
38045    }
38046  }
38047
38048  protected void composeCoverageInner(Coverage element) throws IOException {
38049      composeDomainResourceElements(element);
38050      if (element.hasIdentifier()) {
38051        openArray("identifier");
38052        for (Identifier e : element.getIdentifier()) 
38053          composeIdentifier(null, e);
38054        closeArray();
38055      };
38056      if (element.hasStatusElement()) {
38057        composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
38058        composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
38059      }
38060      if (element.hasType()) {
38061        composeCodeableConcept("type", element.getType());
38062      }
38063      if (element.hasPolicyHolder()) {
38064        composeReference("policyHolder", element.getPolicyHolder());
38065      }
38066      if (element.hasSubscriber()) {
38067        composeReference("subscriber", element.getSubscriber());
38068      }
38069      if (element.hasSubscriberIdElement()) {
38070        composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
38071        composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
38072      }
38073      if (element.hasBeneficiary()) {
38074        composeReference("beneficiary", element.getBeneficiary());
38075      }
38076      if (element.hasDependentElement()) {
38077        composeStringCore("dependent", element.getDependentElement(), false);
38078        composeStringExtras("dependent", element.getDependentElement(), false);
38079      }
38080      if (element.hasRelationship()) {
38081        composeCodeableConcept("relationship", element.getRelationship());
38082      }
38083      if (element.hasPeriod()) {
38084        composePeriod("period", element.getPeriod());
38085      }
38086      if (element.hasPayor()) {
38087        openArray("payor");
38088        for (Reference e : element.getPayor()) 
38089          composeReference(null, e);
38090        closeArray();
38091      };
38092      if (element.hasClass_()) {
38093        openArray("class");
38094        for (Coverage.ClassComponent e : element.getClass_()) 
38095          composeCoverageClassComponent(null, e);
38096        closeArray();
38097      };
38098      if (element.hasOrderElement()) {
38099        composePositiveIntCore("order", element.getOrderElement(), false);
38100        composePositiveIntExtras("order", element.getOrderElement(), false);
38101      }
38102      if (element.hasNetworkElement()) {
38103        composeStringCore("network", element.getNetworkElement(), false);
38104        composeStringExtras("network", element.getNetworkElement(), false);
38105      }
38106      if (element.hasCostToBeneficiary()) {
38107        openArray("costToBeneficiary");
38108        for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary()) 
38109          composeCoverageCostToBeneficiaryComponent(null, e);
38110        closeArray();
38111      };
38112      if (element.hasSubrogationElement()) {
38113        composeBooleanCore("subrogation", element.getSubrogationElement(), false);
38114        composeBooleanExtras("subrogation", element.getSubrogationElement(), false);
38115      }
38116      if (element.hasContract()) {
38117        openArray("contract");
38118        for (Reference e : element.getContract()) 
38119          composeReference(null, e);
38120        closeArray();
38121      };
38122  }
38123
38124  protected void composeCoverageClassComponent(String name, Coverage.ClassComponent element) throws IOException {
38125    if (element != null) {
38126      open(name);
38127      composeCoverageClassComponentInner(element);
38128      close();
38129    }
38130  }
38131
38132  protected void composeCoverageClassComponentInner(Coverage.ClassComponent element) throws IOException {
38133      composeBackbone(element);
38134      if (element.hasType()) {
38135        composeCodeableConcept("type", element.getType());
38136      }
38137      if (element.hasValueElement()) {
38138        composeStringCore("value", element.getValueElement(), false);
38139        composeStringExtras("value", element.getValueElement(), false);
38140      }
38141      if (element.hasNameElement()) {
38142        composeStringCore("name", element.getNameElement(), false);
38143        composeStringExtras("name", element.getNameElement(), false);
38144      }
38145  }
38146
38147  protected void composeCoverageCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element) throws IOException {
38148    if (element != null) {
38149      open(name);
38150      composeCoverageCostToBeneficiaryComponentInner(element);
38151      close();
38152    }
38153  }
38154
38155  protected void composeCoverageCostToBeneficiaryComponentInner(Coverage.CostToBeneficiaryComponent element) throws IOException {
38156      composeBackbone(element);
38157      if (element.hasType()) {
38158        composeCodeableConcept("type", element.getType());
38159      }
38160      if (element.hasValue()) {
38161        composeType("value", element.getValue());
38162      }
38163      if (element.hasException()) {
38164        openArray("exception");
38165        for (Coverage.ExemptionComponent e : element.getException()) 
38166          composeCoverageExemptionComponent(null, e);
38167        closeArray();
38168      };
38169  }
38170
38171  protected void composeCoverageExemptionComponent(String name, Coverage.ExemptionComponent element) throws IOException {
38172    if (element != null) {
38173      open(name);
38174      composeCoverageExemptionComponentInner(element);
38175      close();
38176    }
38177  }
38178
38179  protected void composeCoverageExemptionComponentInner(Coverage.ExemptionComponent element) throws IOException {
38180      composeBackbone(element);
38181      if (element.hasType()) {
38182        composeCodeableConcept("type", element.getType());
38183      }
38184      if (element.hasPeriod()) {
38185        composePeriod("period", element.getPeriod());
38186      }
38187  }
38188
38189  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
38190    if (element != null) {
38191      prop("resourceType", name);
38192      composeCoverageEligibilityRequestInner(element);
38193    }
38194  }
38195
38196  protected void composeCoverageEligibilityRequestInner(CoverageEligibilityRequest element) throws IOException {
38197      composeDomainResourceElements(element);
38198      if (element.hasIdentifier()) {
38199        openArray("identifier");
38200        for (Identifier e : element.getIdentifier()) 
38201          composeIdentifier(null, e);
38202        closeArray();
38203      };
38204      if (element.hasStatusElement()) {
38205        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
38206        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
38207      }
38208      if (element.hasPriority()) {
38209        composeCodeableConcept("priority", element.getPriority());
38210      }
38211      if (element.hasPurpose()) {
38212        openArray("purpose");
38213        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
38214          composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
38215        closeArray();
38216        if (anyHasExtras(element.getPurpose())) {
38217          openArray("_purpose");
38218          for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
38219            composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
38220          closeArray();
38221        }
38222      };
38223      if (element.hasPatient()) {
38224        composeReference("patient", element.getPatient());
38225      }
38226      if (element.hasServiced()) {
38227        composeType("serviced", element.getServiced());
38228      }
38229      if (element.hasCreatedElement()) {
38230        composeDateTimeCore("created", element.getCreatedElement(), false);
38231        composeDateTimeExtras("created", element.getCreatedElement(), false);
38232      }
38233      if (element.hasEnterer()) {
38234        composeReference("enterer", element.getEnterer());
38235      }
38236      if (element.hasProvider()) {
38237        composeReference("provider", element.getProvider());
38238      }
38239      if (element.hasInsurer()) {
38240        composeReference("insurer", element.getInsurer());
38241      }
38242      if (element.hasFacility()) {
38243        composeReference("facility", element.getFacility());
38244      }
38245      if (element.hasSupportingInfo()) {
38246        openArray("supportingInfo");
38247        for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo()) 
38248          composeCoverageEligibilityRequestSupportingInformationComponent(null, e);
38249        closeArray();
38250      };
38251      if (element.hasInsurance()) {
38252        openArray("insurance");
38253        for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance()) 
38254          composeCoverageEligibilityRequestInsuranceComponent(null, e);
38255        closeArray();
38256      };
38257      if (element.hasItem()) {
38258        openArray("item");
38259        for (CoverageEligibilityRequest.DetailsComponent e : element.getItem()) 
38260          composeCoverageEligibilityRequestDetailsComponent(null, e);
38261        closeArray();
38262      };
38263  }
38264
38265  protected void composeCoverageEligibilityRequestSupportingInformationComponent(String name, CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
38266    if (element != null) {
38267      open(name);
38268      composeCoverageEligibilityRequestSupportingInformationComponentInner(element);
38269      close();
38270    }
38271  }
38272
38273  protected void composeCoverageEligibilityRequestSupportingInformationComponentInner(CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
38274      composeBackbone(element);
38275      if (element.hasSequenceElement()) {
38276        composePositiveIntCore("sequence", element.getSequenceElement(), false);
38277        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
38278      }
38279      if (element.hasInformation()) {
38280        composeReference("information", element.getInformation());
38281      }
38282      if (element.hasAppliesToAllElement()) {
38283        composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
38284        composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
38285      }
38286  }
38287
38288  protected void composeCoverageEligibilityRequestInsuranceComponent(String name, CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
38289    if (element != null) {
38290      open(name);
38291      composeCoverageEligibilityRequestInsuranceComponentInner(element);
38292      close();
38293    }
38294  }
38295
38296  protected void composeCoverageEligibilityRequestInsuranceComponentInner(CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
38297      composeBackbone(element);
38298      if (element.hasFocalElement()) {
38299        composeBooleanCore("focal", element.getFocalElement(), false);
38300        composeBooleanExtras("focal", element.getFocalElement(), false);
38301      }
38302      if (element.hasCoverage()) {
38303        composeReference("coverage", element.getCoverage());
38304      }
38305      if (element.hasBusinessArrangementElement()) {
38306        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
38307        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
38308      }
38309  }
38310
38311  protected void composeCoverageEligibilityRequestDetailsComponent(String name, CoverageEligibilityRequest.DetailsComponent element) throws IOException {
38312    if (element != null) {
38313      open(name);
38314      composeCoverageEligibilityRequestDetailsComponentInner(element);
38315      close();
38316    }
38317  }
38318
38319  protected void composeCoverageEligibilityRequestDetailsComponentInner(CoverageEligibilityRequest.DetailsComponent element) throws IOException {
38320      composeBackbone(element);
38321      if (element.hasSupportingInfoSequence()) {
38322        openArray("supportingInfoSequence");
38323        for (PositiveIntType e : element.getSupportingInfoSequence()) 
38324          composePositiveIntCore(null, e, true);
38325        closeArray();
38326        if (anyHasExtras(element.getSupportingInfoSequence())) {
38327          openArray("_supportingInfoSequence");
38328          for (PositiveIntType e : element.getSupportingInfoSequence()) 
38329            composePositiveIntExtras(null, e, true);
38330          closeArray();
38331        }
38332      };
38333      if (element.hasCategory()) {
38334        composeCodeableConcept("category", element.getCategory());
38335      }
38336      if (element.hasProductOrService()) {
38337        composeCodeableConcept("productOrService", element.getProductOrService());
38338      }
38339      if (element.hasModifier()) {
38340        openArray("modifier");
38341        for (CodeableConcept e : element.getModifier()) 
38342          composeCodeableConcept(null, e);
38343        closeArray();
38344      };
38345      if (element.hasProvider()) {
38346        composeReference("provider", element.getProvider());
38347      }
38348      if (element.hasQuantity()) {
38349        composeQuantity("quantity", element.getQuantity());
38350      }
38351      if (element.hasUnitPrice()) {
38352        composeMoney("unitPrice", element.getUnitPrice());
38353      }
38354      if (element.hasFacility()) {
38355        composeReference("facility", element.getFacility());
38356      }
38357      if (element.hasDiagnosis()) {
38358        openArray("diagnosis");
38359        for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
38360          composeCoverageEligibilityRequestDiagnosisComponent(null, e);
38361        closeArray();
38362      };
38363      if (element.hasDetail()) {
38364        openArray("detail");
38365        for (Reference e : element.getDetail()) 
38366          composeReference(null, e);
38367        closeArray();
38368      };
38369  }
38370
38371  protected void composeCoverageEligibilityRequestDiagnosisComponent(String name, CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
38372    if (element != null) {
38373      open(name);
38374      composeCoverageEligibilityRequestDiagnosisComponentInner(element);
38375      close();
38376    }
38377  }
38378
38379  protected void composeCoverageEligibilityRequestDiagnosisComponentInner(CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
38380      composeBackbone(element);
38381      if (element.hasDiagnosis()) {
38382        composeType("diagnosis", element.getDiagnosis());
38383      }
38384  }
38385
38386  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element) throws IOException {
38387    if (element != null) {
38388      prop("resourceType", name);
38389      composeCoverageEligibilityResponseInner(element);
38390    }
38391  }
38392
38393  protected void composeCoverageEligibilityResponseInner(CoverageEligibilityResponse element) throws IOException {
38394      composeDomainResourceElements(element);
38395      if (element.hasIdentifier()) {
38396        openArray("identifier");
38397        for (Identifier e : element.getIdentifier()) 
38398          composeIdentifier(null, e);
38399        closeArray();
38400      };
38401      if (element.hasStatusElement()) {
38402        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
38403        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
38404      }
38405      if (element.hasPurpose()) {
38406        openArray("purpose");
38407        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
38408          composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
38409        closeArray();
38410        if (anyHasExtras(element.getPurpose())) {
38411          openArray("_purpose");
38412          for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
38413            composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
38414          closeArray();
38415        }
38416      };
38417      if (element.hasPatient()) {
38418        composeReference("patient", element.getPatient());
38419      }
38420      if (element.hasServiced()) {
38421        composeType("serviced", element.getServiced());
38422      }
38423      if (element.hasCreatedElement()) {
38424        composeDateTimeCore("created", element.getCreatedElement(), false);
38425        composeDateTimeExtras("created", element.getCreatedElement(), false);
38426      }
38427      if (element.hasRequestor()) {
38428        composeReference("requestor", element.getRequestor());
38429      }
38430      if (element.hasRequest()) {
38431        composeReference("request", element.getRequest());
38432      }
38433      if (element.hasOutcomeElement()) {
38434        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
38435        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
38436      }
38437      if (element.hasDispositionElement()) {
38438        composeStringCore("disposition", element.getDispositionElement(), false);
38439        composeStringExtras("disposition", element.getDispositionElement(), false);
38440      }
38441      if (element.hasInsurer()) {
38442        composeReference("insurer", element.getInsurer());
38443      }
38444      if (element.hasInsurance()) {
38445        openArray("insurance");
38446        for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance()) 
38447          composeCoverageEligibilityResponseInsuranceComponent(null, e);
38448        closeArray();
38449      };
38450      if (element.hasPreAuthRefElement()) {
38451        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
38452        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
38453      }
38454      if (element.hasForm()) {
38455        composeCodeableConcept("form", element.getForm());
38456      }
38457      if (element.hasError()) {
38458        openArray("error");
38459        for (CoverageEligibilityResponse.ErrorsComponent e : element.getError()) 
38460          composeCoverageEligibilityResponseErrorsComponent(null, e);
38461        closeArray();
38462      };
38463  }
38464
38465  protected void composeCoverageEligibilityResponseInsuranceComponent(String name, CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
38466    if (element != null) {
38467      open(name);
38468      composeCoverageEligibilityResponseInsuranceComponentInner(element);
38469      close();
38470    }
38471  }
38472
38473  protected void composeCoverageEligibilityResponseInsuranceComponentInner(CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
38474      composeBackbone(element);
38475      if (element.hasCoverage()) {
38476        composeReference("coverage", element.getCoverage());
38477      }
38478      if (element.hasInforceElement()) {
38479        composeBooleanCore("inforce", element.getInforceElement(), false);
38480        composeBooleanExtras("inforce", element.getInforceElement(), false);
38481      }
38482      if (element.hasBenefitPeriod()) {
38483        composePeriod("benefitPeriod", element.getBenefitPeriod());
38484      }
38485      if (element.hasItem()) {
38486        openArray("item");
38487        for (CoverageEligibilityResponse.ItemsComponent e : element.getItem()) 
38488          composeCoverageEligibilityResponseItemsComponent(null, e);
38489        closeArray();
38490      };
38491  }
38492
38493  protected void composeCoverageEligibilityResponseItemsComponent(String name, CoverageEligibilityResponse.ItemsComponent element) throws IOException {
38494    if (element != null) {
38495      open(name);
38496      composeCoverageEligibilityResponseItemsComponentInner(element);
38497      close();
38498    }
38499  }
38500
38501  protected void composeCoverageEligibilityResponseItemsComponentInner(CoverageEligibilityResponse.ItemsComponent element) throws IOException {
38502      composeBackbone(element);
38503      if (element.hasCategory()) {
38504        composeCodeableConcept("category", element.getCategory());
38505      }
38506      if (element.hasProductOrService()) {
38507        composeCodeableConcept("productOrService", element.getProductOrService());
38508      }
38509      if (element.hasModifier()) {
38510        openArray("modifier");
38511        for (CodeableConcept e : element.getModifier()) 
38512          composeCodeableConcept(null, e);
38513        closeArray();
38514      };
38515      if (element.hasProvider()) {
38516        composeReference("provider", element.getProvider());
38517      }
38518      if (element.hasExcludedElement()) {
38519        composeBooleanCore("excluded", element.getExcludedElement(), false);
38520        composeBooleanExtras("excluded", element.getExcludedElement(), false);
38521      }
38522      if (element.hasNameElement()) {
38523        composeStringCore("name", element.getNameElement(), false);
38524        composeStringExtras("name", element.getNameElement(), false);
38525      }
38526      if (element.hasDescriptionElement()) {
38527        composeStringCore("description", element.getDescriptionElement(), false);
38528        composeStringExtras("description", element.getDescriptionElement(), false);
38529      }
38530      if (element.hasNetwork()) {
38531        composeCodeableConcept("network", element.getNetwork());
38532      }
38533      if (element.hasUnit()) {
38534        composeCodeableConcept("unit", element.getUnit());
38535      }
38536      if (element.hasTerm()) {
38537        composeCodeableConcept("term", element.getTerm());
38538      }
38539      if (element.hasBenefit()) {
38540        openArray("benefit");
38541        for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit()) 
38542          composeCoverageEligibilityResponseBenefitComponent(null, e);
38543        closeArray();
38544      };
38545      if (element.hasAuthorizationRequiredElement()) {
38546        composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
38547        composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
38548      }
38549      if (element.hasAuthorizationSupporting()) {
38550        openArray("authorizationSupporting");
38551        for (CodeableConcept e : element.getAuthorizationSupporting()) 
38552          composeCodeableConcept(null, e);
38553        closeArray();
38554      };
38555      if (element.hasAuthorizationUrlElement()) {
38556        composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
38557        composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
38558      }
38559  }
38560
38561  protected void composeCoverageEligibilityResponseBenefitComponent(String name, CoverageEligibilityResponse.BenefitComponent element) throws IOException {
38562    if (element != null) {
38563      open(name);
38564      composeCoverageEligibilityResponseBenefitComponentInner(element);
38565      close();
38566    }
38567  }
38568
38569  protected void composeCoverageEligibilityResponseBenefitComponentInner(CoverageEligibilityResponse.BenefitComponent element) throws IOException {
38570      composeBackbone(element);
38571      if (element.hasType()) {
38572        composeCodeableConcept("type", element.getType());
38573      }
38574      if (element.hasAllowed()) {
38575        composeType("allowed", element.getAllowed());
38576      }
38577      if (element.hasUsed()) {
38578        composeType("used", element.getUsed());
38579      }
38580  }
38581
38582  protected void composeCoverageEligibilityResponseErrorsComponent(String name, CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
38583    if (element != null) {
38584      open(name);
38585      composeCoverageEligibilityResponseErrorsComponentInner(element);
38586      close();
38587    }
38588  }
38589
38590  protected void composeCoverageEligibilityResponseErrorsComponentInner(CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
38591      composeBackbone(element);
38592      if (element.hasCode()) {
38593        composeCodeableConcept("code", element.getCode());
38594      }
38595  }
38596
38597  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
38598    if (element != null) {
38599      prop("resourceType", name);
38600      composeDetectedIssueInner(element);
38601    }
38602  }
38603
38604  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
38605      composeDomainResourceElements(element);
38606      if (element.hasIdentifier()) {
38607        openArray("identifier");
38608        for (Identifier e : element.getIdentifier()) 
38609          composeIdentifier(null, e);
38610        closeArray();
38611      };
38612      if (element.hasStatusElement()) {
38613        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
38614        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
38615      }
38616      if (element.hasCode()) {
38617        composeCodeableConcept("code", element.getCode());
38618      }
38619      if (element.hasSeverityElement()) {
38620        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
38621        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
38622      }
38623      if (element.hasPatient()) {
38624        composeReference("patient", element.getPatient());
38625      }
38626      if (element.hasIdentified()) {
38627        composeType("identified", element.getIdentified());
38628      }
38629      if (element.hasAuthor()) {
38630        composeReference("author", element.getAuthor());
38631      }
38632      if (element.hasImplicated()) {
38633        openArray("implicated");
38634        for (Reference e : element.getImplicated()) 
38635          composeReference(null, e);
38636        closeArray();
38637      };
38638      if (element.hasEvidence()) {
38639        openArray("evidence");
38640        for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence()) 
38641          composeDetectedIssueDetectedIssueEvidenceComponent(null, e);
38642        closeArray();
38643      };
38644      if (element.hasDetailElement()) {
38645        composeStringCore("detail", element.getDetailElement(), false);
38646        composeStringExtras("detail", element.getDetailElement(), false);
38647      }
38648      if (element.hasReferenceElement()) {
38649        composeUriCore("reference", element.getReferenceElement(), false);
38650        composeUriExtras("reference", element.getReferenceElement(), false);
38651      }
38652      if (element.hasMitigation()) {
38653        openArray("mitigation");
38654        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
38655          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
38656        closeArray();
38657      };
38658  }
38659
38660  protected void composeDetectedIssueDetectedIssueEvidenceComponent(String name, DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
38661    if (element != null) {
38662      open(name);
38663      composeDetectedIssueDetectedIssueEvidenceComponentInner(element);
38664      close();
38665    }
38666  }
38667
38668  protected void composeDetectedIssueDetectedIssueEvidenceComponentInner(DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
38669      composeBackbone(element);
38670      if (element.hasCode()) {
38671        openArray("code");
38672        for (CodeableConcept e : element.getCode()) 
38673          composeCodeableConcept(null, e);
38674        closeArray();
38675      };
38676      if (element.hasDetail()) {
38677        openArray("detail");
38678        for (Reference e : element.getDetail()) 
38679          composeReference(null, e);
38680        closeArray();
38681      };
38682  }
38683
38684  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
38685    if (element != null) {
38686      open(name);
38687      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
38688      close();
38689    }
38690  }
38691
38692  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
38693      composeBackbone(element);
38694      if (element.hasAction()) {
38695        composeCodeableConcept("action", element.getAction());
38696      }
38697      if (element.hasDateElement()) {
38698        composeDateTimeCore("date", element.getDateElement(), false);
38699        composeDateTimeExtras("date", element.getDateElement(), false);
38700      }
38701      if (element.hasAuthor()) {
38702        composeReference("author", element.getAuthor());
38703      }
38704  }
38705
38706  protected void composeDevice(String name, Device element) throws IOException {
38707    if (element != null) {
38708      prop("resourceType", name);
38709      composeDeviceInner(element);
38710    }
38711  }
38712
38713  protected void composeDeviceInner(Device element) throws IOException {
38714      composeDomainResourceElements(element);
38715      if (element.hasIdentifier()) {
38716        openArray("identifier");
38717        for (Identifier e : element.getIdentifier()) 
38718          composeIdentifier(null, e);
38719        closeArray();
38720      };
38721      if (element.hasDefinition()) {
38722        composeReference("definition", element.getDefinition());
38723      }
38724      if (element.hasUdiCarrier()) {
38725        openArray("udiCarrier");
38726        for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
38727          composeDeviceDeviceUdiCarrierComponent(null, e);
38728        closeArray();
38729      };
38730      if (element.hasStatusElement()) {
38731        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
38732        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
38733      }
38734      if (element.hasStatusReason()) {
38735        openArray("statusReason");
38736        for (CodeableConcept e : element.getStatusReason()) 
38737          composeCodeableConcept(null, e);
38738        closeArray();
38739      };
38740      if (element.hasDistinctIdentifierElement()) {
38741        composeStringCore("distinctIdentifier", element.getDistinctIdentifierElement(), false);
38742        composeStringExtras("distinctIdentifier", element.getDistinctIdentifierElement(), false);
38743      }
38744      if (element.hasManufacturerElement()) {
38745        composeStringCore("manufacturer", element.getManufacturerElement(), false);
38746        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
38747      }
38748      if (element.hasManufactureDateElement()) {
38749        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
38750        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
38751      }
38752      if (element.hasExpirationDateElement()) {
38753        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
38754        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
38755      }
38756      if (element.hasLotNumberElement()) {
38757        composeStringCore("lotNumber", element.getLotNumberElement(), false);
38758        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
38759      }
38760      if (element.hasSerialNumberElement()) {
38761        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
38762        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
38763      }
38764      if (element.hasDeviceName()) {
38765        openArray("deviceName");
38766        for (Device.DeviceDeviceNameComponent e : element.getDeviceName()) 
38767          composeDeviceDeviceDeviceNameComponent(null, e);
38768        closeArray();
38769      };
38770      if (element.hasModelNumberElement()) {
38771        composeStringCore("modelNumber", element.getModelNumberElement(), false);
38772        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
38773      }
38774      if (element.hasPartNumberElement()) {
38775        composeStringCore("partNumber", element.getPartNumberElement(), false);
38776        composeStringExtras("partNumber", element.getPartNumberElement(), false);
38777      }
38778      if (element.hasType()) {
38779        composeCodeableConcept("type", element.getType());
38780      }
38781      if (element.hasSpecialization()) {
38782        openArray("specialization");
38783        for (Device.DeviceSpecializationComponent e : element.getSpecialization()) 
38784          composeDeviceDeviceSpecializationComponent(null, e);
38785        closeArray();
38786      };
38787      if (element.hasVersion()) {
38788        openArray("version");
38789        for (Device.DeviceVersionComponent e : element.getVersion()) 
38790          composeDeviceDeviceVersionComponent(null, e);
38791        closeArray();
38792      };
38793      if (element.hasProperty()) {
38794        openArray("property");
38795        for (Device.DevicePropertyComponent e : element.getProperty()) 
38796          composeDeviceDevicePropertyComponent(null, e);
38797        closeArray();
38798      };
38799      if (element.hasPatient()) {
38800        composeReference("patient", element.getPatient());
38801      }
38802      if (element.hasOwner()) {
38803        composeReference("owner", element.getOwner());
38804      }
38805      if (element.hasContact()) {
38806        openArray("contact");
38807        for (ContactPoint e : element.getContact()) 
38808          composeContactPoint(null, e);
38809        closeArray();
38810      };
38811      if (element.hasLocation()) {
38812        composeReference("location", element.getLocation());
38813      }
38814      if (element.hasUrlElement()) {
38815        composeUriCore("url", element.getUrlElement(), false);
38816        composeUriExtras("url", element.getUrlElement(), false);
38817      }
38818      if (element.hasNote()) {
38819        openArray("note");
38820        for (Annotation e : element.getNote()) 
38821          composeAnnotation(null, e);
38822        closeArray();
38823      };
38824      if (element.hasSafety()) {
38825        openArray("safety");
38826        for (CodeableConcept e : element.getSafety()) 
38827          composeCodeableConcept(null, e);
38828        closeArray();
38829      };
38830      if (element.hasParent()) {
38831        composeReference("parent", element.getParent());
38832      }
38833  }
38834
38835  protected void composeDeviceDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
38836    if (element != null) {
38837      open(name);
38838      composeDeviceDeviceUdiCarrierComponentInner(element);
38839      close();
38840    }
38841  }
38842
38843  protected void composeDeviceDeviceUdiCarrierComponentInner(Device.DeviceUdiCarrierComponent element) throws IOException {
38844      composeBackbone(element);
38845      if (element.hasDeviceIdentifierElement()) {
38846        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38847        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38848      }
38849      if (element.hasIssuerElement()) {
38850        composeUriCore("issuer", element.getIssuerElement(), false);
38851        composeUriExtras("issuer", element.getIssuerElement(), false);
38852      }
38853      if (element.hasJurisdictionElement()) {
38854        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
38855        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
38856      }
38857      if (element.hasCarrierAIDCElement()) {
38858        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
38859        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
38860      }
38861      if (element.hasCarrierHRFElement()) {
38862        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
38863        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
38864      }
38865      if (element.hasEntryTypeElement()) {
38866        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
38867        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
38868      }
38869  }
38870
38871  protected void composeDeviceDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element) throws IOException {
38872    if (element != null) {
38873      open(name);
38874      composeDeviceDeviceDeviceNameComponentInner(element);
38875      close();
38876    }
38877  }
38878
38879  protected void composeDeviceDeviceDeviceNameComponentInner(Device.DeviceDeviceNameComponent element) throws IOException {
38880      composeBackbone(element);
38881      if (element.hasNameElement()) {
38882        composeStringCore("name", element.getNameElement(), false);
38883        composeStringExtras("name", element.getNameElement(), false);
38884      }
38885      if (element.hasTypeElement()) {
38886        composeEnumerationCore("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
38887        composeEnumerationExtras("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
38888      }
38889  }
38890
38891  protected void composeDeviceDeviceSpecializationComponent(String name, Device.DeviceSpecializationComponent element) throws IOException {
38892    if (element != null) {
38893      open(name);
38894      composeDeviceDeviceSpecializationComponentInner(element);
38895      close();
38896    }
38897  }
38898
38899  protected void composeDeviceDeviceSpecializationComponentInner(Device.DeviceSpecializationComponent element) throws IOException {
38900      composeBackbone(element);
38901      if (element.hasSystemType()) {
38902        composeCodeableConcept("systemType", element.getSystemType());
38903      }
38904      if (element.hasVersionElement()) {
38905        composeStringCore("version", element.getVersionElement(), false);
38906        composeStringExtras("version", element.getVersionElement(), false);
38907      }
38908  }
38909
38910  protected void composeDeviceDeviceVersionComponent(String name, Device.DeviceVersionComponent element) throws IOException {
38911    if (element != null) {
38912      open(name);
38913      composeDeviceDeviceVersionComponentInner(element);
38914      close();
38915    }
38916  }
38917
38918  protected void composeDeviceDeviceVersionComponentInner(Device.DeviceVersionComponent element) throws IOException {
38919      composeBackbone(element);
38920      if (element.hasType()) {
38921        composeCodeableConcept("type", element.getType());
38922      }
38923      if (element.hasComponent()) {
38924        composeIdentifier("component", element.getComponent());
38925      }
38926      if (element.hasValueElement()) {
38927        composeStringCore("value", element.getValueElement(), false);
38928        composeStringExtras("value", element.getValueElement(), false);
38929      }
38930  }
38931
38932  protected void composeDeviceDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
38933    if (element != null) {
38934      open(name);
38935      composeDeviceDevicePropertyComponentInner(element);
38936      close();
38937    }
38938  }
38939
38940  protected void composeDeviceDevicePropertyComponentInner(Device.DevicePropertyComponent element) throws IOException {
38941      composeBackbone(element);
38942      if (element.hasType()) {
38943        composeCodeableConcept("type", element.getType());
38944      }
38945      if (element.hasValueQuantity()) {
38946        openArray("valueQuantity");
38947        for (Quantity e : element.getValueQuantity()) 
38948          composeQuantity(null, e);
38949        closeArray();
38950      };
38951      if (element.hasValueCode()) {
38952        openArray("valueCode");
38953        for (CodeableConcept e : element.getValueCode()) 
38954          composeCodeableConcept(null, e);
38955        closeArray();
38956      };
38957  }
38958
38959  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
38960    if (element != null) {
38961      prop("resourceType", name);
38962      composeDeviceDefinitionInner(element);
38963    }
38964  }
38965
38966  protected void composeDeviceDefinitionInner(DeviceDefinition 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.hasUdiDeviceIdentifier()) {
38975        openArray("udiDeviceIdentifier");
38976        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
38977          composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
38978        closeArray();
38979      };
38980      if (element.hasManufacturer()) {
38981        composeType("manufacturer", element.getManufacturer());
38982      }
38983      if (element.hasDeviceName()) {
38984        openArray("deviceName");
38985        for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
38986          composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(null, e);
38987        closeArray();
38988      };
38989      if (element.hasModelNumberElement()) {
38990        composeStringCore("modelNumber", element.getModelNumberElement(), false);
38991        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
38992      }
38993      if (element.hasType()) {
38994        composeCodeableConcept("type", element.getType());
38995      }
38996      if (element.hasSpecialization()) {
38997        openArray("specialization");
38998        for (DeviceDefinition.DeviceDefinitionSpecializationComponent e : element.getSpecialization()) 
38999          composeDeviceDefinitionDeviceDefinitionSpecializationComponent(null, e);
39000        closeArray();
39001      };
39002      if (element.hasVersion()) {
39003        openArray("version");
39004        for (StringType e : element.getVersion()) 
39005          composeStringCore(null, e, true);
39006        closeArray();
39007        if (anyHasExtras(element.getVersion())) {
39008          openArray("_version");
39009          for (StringType e : element.getVersion()) 
39010            composeStringExtras(null, e, true);
39011          closeArray();
39012        }
39013      };
39014      if (element.hasSafety()) {
39015        openArray("safety");
39016        for (CodeableConcept e : element.getSafety()) 
39017          composeCodeableConcept(null, e);
39018        closeArray();
39019      };
39020      if (element.hasShelfLifeStorage()) {
39021        openArray("shelfLifeStorage");
39022        for (ProductShelfLife e : element.getShelfLifeStorage()) 
39023          composeProductShelfLife(null, e);
39024        closeArray();
39025      };
39026      if (element.hasPhysicalCharacteristics()) {
39027        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
39028      }
39029      if (element.hasLanguageCode()) {
39030        openArray("languageCode");
39031        for (CodeableConcept e : element.getLanguageCode()) 
39032          composeCodeableConcept(null, e);
39033        closeArray();
39034      };
39035      if (element.hasCapability()) {
39036        openArray("capability");
39037        for (DeviceDefinition.DeviceDefinitionCapabilityComponent e : element.getCapability()) 
39038          composeDeviceDefinitionDeviceDefinitionCapabilityComponent(null, e);
39039        closeArray();
39040      };
39041      if (element.hasProperty()) {
39042        openArray("property");
39043        for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
39044          composeDeviceDefinitionDeviceDefinitionPropertyComponent(null, e);
39045        closeArray();
39046      };
39047      if (element.hasOwner()) {
39048        composeReference("owner", element.getOwner());
39049      }
39050      if (element.hasContact()) {
39051        openArray("contact");
39052        for (ContactPoint e : element.getContact()) 
39053          composeContactPoint(null, e);
39054        closeArray();
39055      };
39056      if (element.hasUrlElement()) {
39057        composeUriCore("url", element.getUrlElement(), false);
39058        composeUriExtras("url", element.getUrlElement(), false);
39059      }
39060      if (element.hasOnlineInformationElement()) {
39061        composeUriCore("onlineInformation", element.getOnlineInformationElement(), false);
39062        composeUriExtras("onlineInformation", element.getOnlineInformationElement(), false);
39063      }
39064      if (element.hasNote()) {
39065        openArray("note");
39066        for (Annotation e : element.getNote()) 
39067          composeAnnotation(null, e);
39068        closeArray();
39069      };
39070      if (element.hasQuantity()) {
39071        composeQuantity("quantity", element.getQuantity());
39072      }
39073      if (element.hasParentDevice()) {
39074        composeReference("parentDevice", element.getParentDevice());
39075      }
39076      if (element.hasMaterial()) {
39077        openArray("material");
39078        for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial()) 
39079          composeDeviceDefinitionDeviceDefinitionMaterialComponent(null, e);
39080        closeArray();
39081      };
39082  }
39083
39084  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
39085    if (element != null) {
39086      open(name);
39087      composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(element);
39088      close();
39089    }
39090  }
39091
39092  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
39093      composeBackbone(element);
39094      if (element.hasDeviceIdentifierElement()) {
39095        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
39096        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
39097      }
39098      if (element.hasIssuerElement()) {
39099        composeUriCore("issuer", element.getIssuerElement(), false);
39100        composeUriExtras("issuer", element.getIssuerElement(), false);
39101      }
39102      if (element.hasJurisdictionElement()) {
39103        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
39104        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
39105      }
39106  }
39107
39108  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
39109    if (element != null) {
39110      open(name);
39111      composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(element);
39112      close();
39113    }
39114  }
39115
39116  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
39117      composeBackbone(element);
39118      if (element.hasNameElement()) {
39119        composeStringCore("name", element.getNameElement(), false);
39120        composeStringExtras("name", element.getNameElement(), false);
39121      }
39122      if (element.hasTypeElement()) {
39123        composeEnumerationCore("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
39124        composeEnumerationExtras("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
39125      }
39126  }
39127
39128  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponent(String name, DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
39129    if (element != null) {
39130      open(name);
39131      composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(element);
39132      close();
39133    }
39134  }
39135
39136  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
39137      composeBackbone(element);
39138      if (element.hasSystemTypeElement()) {
39139        composeStringCore("systemType", element.getSystemTypeElement(), false);
39140        composeStringExtras("systemType", element.getSystemTypeElement(), false);
39141      }
39142      if (element.hasVersionElement()) {
39143        composeStringCore("version", element.getVersionElement(), false);
39144        composeStringExtras("version", element.getVersionElement(), false);
39145      }
39146  }
39147
39148  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponent(String name, DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
39149    if (element != null) {
39150      open(name);
39151      composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(element);
39152      close();
39153    }
39154  }
39155
39156  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
39157      composeBackbone(element);
39158      if (element.hasType()) {
39159        composeCodeableConcept("type", element.getType());
39160      }
39161      if (element.hasDescription()) {
39162        openArray("description");
39163        for (CodeableConcept e : element.getDescription()) 
39164          composeCodeableConcept(null, e);
39165        closeArray();
39166      };
39167  }
39168
39169  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
39170    if (element != null) {
39171      open(name);
39172      composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(element);
39173      close();
39174    }
39175  }
39176
39177  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
39178      composeBackbone(element);
39179      if (element.hasType()) {
39180        composeCodeableConcept("type", element.getType());
39181      }
39182      if (element.hasValueQuantity()) {
39183        openArray("valueQuantity");
39184        for (Quantity e : element.getValueQuantity()) 
39185          composeQuantity(null, e);
39186        closeArray();
39187      };
39188      if (element.hasValueCode()) {
39189        openArray("valueCode");
39190        for (CodeableConcept e : element.getValueCode()) 
39191          composeCodeableConcept(null, e);
39192        closeArray();
39193      };
39194  }
39195
39196  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
39197    if (element != null) {
39198      open(name);
39199      composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(element);
39200      close();
39201    }
39202  }
39203
39204  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
39205      composeBackbone(element);
39206      if (element.hasSubstance()) {
39207        composeCodeableConcept("substance", element.getSubstance());
39208      }
39209      if (element.hasAlternateElement()) {
39210        composeBooleanCore("alternate", element.getAlternateElement(), false);
39211        composeBooleanExtras("alternate", element.getAlternateElement(), false);
39212      }
39213      if (element.hasAllergenicIndicatorElement()) {
39214        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
39215        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
39216      }
39217  }
39218
39219  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
39220    if (element != null) {
39221      prop("resourceType", name);
39222      composeDeviceMetricInner(element);
39223    }
39224  }
39225
39226  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
39227      composeDomainResourceElements(element);
39228      if (element.hasIdentifier()) {
39229        openArray("identifier");
39230        for (Identifier e : element.getIdentifier()) 
39231          composeIdentifier(null, e);
39232        closeArray();
39233      };
39234      if (element.hasType()) {
39235        composeCodeableConcept("type", element.getType());
39236      }
39237      if (element.hasUnit()) {
39238        composeCodeableConcept("unit", element.getUnit());
39239      }
39240      if (element.hasSource()) {
39241        composeReference("source", element.getSource());
39242      }
39243      if (element.hasParent()) {
39244        composeReference("parent", element.getParent());
39245      }
39246      if (element.hasOperationalStatusElement()) {
39247        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
39248        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
39249      }
39250      if (element.hasColorElement()) {
39251        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
39252        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
39253      }
39254      if (element.hasCategoryElement()) {
39255        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
39256        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
39257      }
39258      if (element.hasMeasurementPeriod()) {
39259        composeTiming("measurementPeriod", element.getMeasurementPeriod());
39260      }
39261      if (element.hasCalibration()) {
39262        openArray("calibration");
39263        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
39264          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
39265        closeArray();
39266      };
39267  }
39268
39269  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
39270    if (element != null) {
39271      open(name);
39272      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
39273      close();
39274    }
39275  }
39276
39277  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
39278      composeBackbone(element);
39279      if (element.hasTypeElement()) {
39280        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
39281        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
39282      }
39283      if (element.hasStateElement()) {
39284        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
39285        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
39286      }
39287      if (element.hasTimeElement()) {
39288        composeInstantCore("time", element.getTimeElement(), false);
39289        composeInstantExtras("time", element.getTimeElement(), false);
39290      }
39291  }
39292
39293  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
39294    if (element != null) {
39295      prop("resourceType", name);
39296      composeDeviceRequestInner(element);
39297    }
39298  }
39299
39300  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
39301      composeDomainResourceElements(element);
39302      if (element.hasIdentifier()) {
39303        openArray("identifier");
39304        for (Identifier e : element.getIdentifier()) 
39305          composeIdentifier(null, e);
39306        closeArray();
39307      };
39308      if (element.hasInstantiatesCanonical()) {
39309        openArray("instantiatesCanonical");
39310        for (CanonicalType e : element.getInstantiatesCanonical()) 
39311          composeCanonicalCore(null, e, true);
39312        closeArray();
39313        if (anyHasExtras(element.getInstantiatesCanonical())) {
39314          openArray("_instantiatesCanonical");
39315          for (CanonicalType e : element.getInstantiatesCanonical()) 
39316            composeCanonicalExtras(null, e, true);
39317          closeArray();
39318        }
39319      };
39320      if (element.hasInstantiatesUri()) {
39321        openArray("instantiatesUri");
39322        for (UriType e : element.getInstantiatesUri()) 
39323          composeUriCore(null, e, true);
39324        closeArray();
39325        if (anyHasExtras(element.getInstantiatesUri())) {
39326          openArray("_instantiatesUri");
39327          for (UriType e : element.getInstantiatesUri()) 
39328            composeUriExtras(null, e, true);
39329          closeArray();
39330        }
39331      };
39332      if (element.hasBasedOn()) {
39333        openArray("basedOn");
39334        for (Reference e : element.getBasedOn()) 
39335          composeReference(null, e);
39336        closeArray();
39337      };
39338      if (element.hasPriorRequest()) {
39339        openArray("priorRequest");
39340        for (Reference e : element.getPriorRequest()) 
39341          composeReference(null, e);
39342        closeArray();
39343      };
39344      if (element.hasGroupIdentifier()) {
39345        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
39346      }
39347      if (element.hasStatusElement()) {
39348        composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
39349        composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
39350      }
39351      if (element.hasIntentElement()) {
39352        composeEnumerationCore("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
39353        composeEnumerationExtras("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
39354      }
39355      if (element.hasPriorityElement()) {
39356        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
39357        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
39358      }
39359      if (element.hasCode()) {
39360        composeType("code", element.getCode());
39361      }
39362      if (element.hasParameter()) {
39363        openArray("parameter");
39364        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
39365          composeDeviceRequestDeviceRequestParameterComponent(null, e);
39366        closeArray();
39367      };
39368      if (element.hasSubject()) {
39369        composeReference("subject", element.getSubject());
39370      }
39371      if (element.hasEncounter()) {
39372        composeReference("encounter", element.getEncounter());
39373      }
39374      if (element.hasOccurrence()) {
39375        composeType("occurrence", element.getOccurrence());
39376      }
39377      if (element.hasAuthoredOnElement()) {
39378        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
39379        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
39380      }
39381      if (element.hasRequester()) {
39382        composeReference("requester", element.getRequester());
39383      }
39384      if (element.hasPerformerType()) {
39385        composeCodeableConcept("performerType", element.getPerformerType());
39386      }
39387      if (element.hasPerformer()) {
39388        composeReference("performer", element.getPerformer());
39389      }
39390      if (element.hasReasonCode()) {
39391        openArray("reasonCode");
39392        for (CodeableConcept e : element.getReasonCode()) 
39393          composeCodeableConcept(null, e);
39394        closeArray();
39395      };
39396      if (element.hasReasonReference()) {
39397        openArray("reasonReference");
39398        for (Reference e : element.getReasonReference()) 
39399          composeReference(null, e);
39400        closeArray();
39401      };
39402      if (element.hasInsurance()) {
39403        openArray("insurance");
39404        for (Reference e : element.getInsurance()) 
39405          composeReference(null, e);
39406        closeArray();
39407      };
39408      if (element.hasSupportingInfo()) {
39409        openArray("supportingInfo");
39410        for (Reference e : element.getSupportingInfo()) 
39411          composeReference(null, e);
39412        closeArray();
39413      };
39414      if (element.hasNote()) {
39415        openArray("note");
39416        for (Annotation e : element.getNote()) 
39417          composeAnnotation(null, e);
39418        closeArray();
39419      };
39420      if (element.hasRelevantHistory()) {
39421        openArray("relevantHistory");
39422        for (Reference e : element.getRelevantHistory()) 
39423          composeReference(null, e);
39424        closeArray();
39425      };
39426  }
39427
39428  protected void composeDeviceRequestDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
39429    if (element != null) {
39430      open(name);
39431      composeDeviceRequestDeviceRequestParameterComponentInner(element);
39432      close();
39433    }
39434  }
39435
39436  protected void composeDeviceRequestDeviceRequestParameterComponentInner(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
39437      composeBackbone(element);
39438      if (element.hasCode()) {
39439        composeCodeableConcept("code", element.getCode());
39440      }
39441      if (element.hasValue()) {
39442        composeType("value", element.getValue());
39443      }
39444  }
39445
39446  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
39447    if (element != null) {
39448      prop("resourceType", name);
39449      composeDeviceUseStatementInner(element);
39450    }
39451  }
39452
39453  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
39454      composeDomainResourceElements(element);
39455      if (element.hasIdentifier()) {
39456        openArray("identifier");
39457        for (Identifier e : element.getIdentifier()) 
39458          composeIdentifier(null, e);
39459        closeArray();
39460      };
39461      if (element.hasBasedOn()) {
39462        openArray("basedOn");
39463        for (Reference e : element.getBasedOn()) 
39464          composeReference(null, e);
39465        closeArray();
39466      };
39467      if (element.hasStatusElement()) {
39468        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
39469        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
39470      }
39471      if (element.hasSubject()) {
39472        composeReference("subject", element.getSubject());
39473      }
39474      if (element.hasDerivedFrom()) {
39475        openArray("derivedFrom");
39476        for (Reference e : element.getDerivedFrom()) 
39477          composeReference(null, e);
39478        closeArray();
39479      };
39480      if (element.hasTiming()) {
39481        composeType("timing", element.getTiming());
39482      }
39483      if (element.hasRecordedOnElement()) {
39484        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
39485        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
39486      }
39487      if (element.hasSource()) {
39488        composeReference("source", element.getSource());
39489      }
39490      if (element.hasDevice()) {
39491        composeReference("device", element.getDevice());
39492      }
39493      if (element.hasReasonCode()) {
39494        openArray("reasonCode");
39495        for (CodeableConcept e : element.getReasonCode()) 
39496          composeCodeableConcept(null, e);
39497        closeArray();
39498      };
39499      if (element.hasReasonReference()) {
39500        openArray("reasonReference");
39501        for (Reference e : element.getReasonReference()) 
39502          composeReference(null, e);
39503        closeArray();
39504      };
39505      if (element.hasBodySite()) {
39506        composeCodeableConcept("bodySite", element.getBodySite());
39507      }
39508      if (element.hasNote()) {
39509        openArray("note");
39510        for (Annotation e : element.getNote()) 
39511          composeAnnotation(null, e);
39512        closeArray();
39513      };
39514  }
39515
39516  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
39517    if (element != null) {
39518      prop("resourceType", name);
39519      composeDiagnosticReportInner(element);
39520    }
39521  }
39522
39523  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
39524      composeDomainResourceElements(element);
39525      if (element.hasIdentifier()) {
39526        openArray("identifier");
39527        for (Identifier e : element.getIdentifier()) 
39528          composeIdentifier(null, e);
39529        closeArray();
39530      };
39531      if (element.hasBasedOn()) {
39532        openArray("basedOn");
39533        for (Reference e : element.getBasedOn()) 
39534          composeReference(null, e);
39535        closeArray();
39536      };
39537      if (element.hasStatusElement()) {
39538        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
39539        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
39540      }
39541      if (element.hasCategory()) {
39542        openArray("category");
39543        for (CodeableConcept e : element.getCategory()) 
39544          composeCodeableConcept(null, e);
39545        closeArray();
39546      };
39547      if (element.hasCode()) {
39548        composeCodeableConcept("code", element.getCode());
39549      }
39550      if (element.hasSubject()) {
39551        composeReference("subject", element.getSubject());
39552      }
39553      if (element.hasEncounter()) {
39554        composeReference("encounter", element.getEncounter());
39555      }
39556      if (element.hasEffective()) {
39557        composeType("effective", element.getEffective());
39558      }
39559      if (element.hasIssuedElement()) {
39560        composeInstantCore("issued", element.getIssuedElement(), false);
39561        composeInstantExtras("issued", element.getIssuedElement(), false);
39562      }
39563      if (element.hasPerformer()) {
39564        openArray("performer");
39565        for (Reference e : element.getPerformer()) 
39566          composeReference(null, e);
39567        closeArray();
39568      };
39569      if (element.hasResultsInterpreter()) {
39570        openArray("resultsInterpreter");
39571        for (Reference e : element.getResultsInterpreter()) 
39572          composeReference(null, e);
39573        closeArray();
39574      };
39575      if (element.hasSpecimen()) {
39576        openArray("specimen");
39577        for (Reference e : element.getSpecimen()) 
39578          composeReference(null, e);
39579        closeArray();
39580      };
39581      if (element.hasResult()) {
39582        openArray("result");
39583        for (Reference e : element.getResult()) 
39584          composeReference(null, e);
39585        closeArray();
39586      };
39587      if (element.hasImagingStudy()) {
39588        openArray("imagingStudy");
39589        for (Reference e : element.getImagingStudy()) 
39590          composeReference(null, e);
39591        closeArray();
39592      };
39593      if (element.hasMedia()) {
39594        openArray("media");
39595        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
39596          composeDiagnosticReportDiagnosticReportMediaComponent(null, e);
39597        closeArray();
39598      };
39599      if (element.hasConclusionElement()) {
39600        composeStringCore("conclusion", element.getConclusionElement(), false);
39601        composeStringExtras("conclusion", element.getConclusionElement(), false);
39602      }
39603      if (element.hasConclusionCode()) {
39604        openArray("conclusionCode");
39605        for (CodeableConcept e : element.getConclusionCode()) 
39606          composeCodeableConcept(null, e);
39607        closeArray();
39608      };
39609      if (element.hasPresentedForm()) {
39610        openArray("presentedForm");
39611        for (Attachment e : element.getPresentedForm()) 
39612          composeAttachment(null, e);
39613        closeArray();
39614      };
39615  }
39616
39617  protected void composeDiagnosticReportDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
39618    if (element != null) {
39619      open(name);
39620      composeDiagnosticReportDiagnosticReportMediaComponentInner(element);
39621      close();
39622    }
39623  }
39624
39625  protected void composeDiagnosticReportDiagnosticReportMediaComponentInner(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
39626      composeBackbone(element);
39627      if (element.hasCommentElement()) {
39628        composeStringCore("comment", element.getCommentElement(), false);
39629        composeStringExtras("comment", element.getCommentElement(), false);
39630      }
39631      if (element.hasLink()) {
39632        composeReference("link", element.getLink());
39633      }
39634  }
39635
39636  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
39637    if (element != null) {
39638      prop("resourceType", name);
39639      composeDocumentManifestInner(element);
39640    }
39641  }
39642
39643  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
39644      composeDomainResourceElements(element);
39645      if (element.hasMasterIdentifier()) {
39646        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
39647      }
39648      if (element.hasIdentifier()) {
39649        openArray("identifier");
39650        for (Identifier e : element.getIdentifier()) 
39651          composeIdentifier(null, e);
39652        closeArray();
39653      };
39654      if (element.hasStatusElement()) {
39655        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
39656        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
39657      }
39658      if (element.hasType()) {
39659        composeCodeableConcept("type", element.getType());
39660      }
39661      if (element.hasSubject()) {
39662        composeReference("subject", element.getSubject());
39663      }
39664      if (element.hasCreatedElement()) {
39665        composeDateTimeCore("created", element.getCreatedElement(), false);
39666        composeDateTimeExtras("created", element.getCreatedElement(), false);
39667      }
39668      if (element.hasAuthor()) {
39669        openArray("author");
39670        for (Reference e : element.getAuthor()) 
39671          composeReference(null, e);
39672        closeArray();
39673      };
39674      if (element.hasRecipient()) {
39675        openArray("recipient");
39676        for (Reference e : element.getRecipient()) 
39677          composeReference(null, e);
39678        closeArray();
39679      };
39680      if (element.hasSourceElement()) {
39681        composeUriCore("source", element.getSourceElement(), false);
39682        composeUriExtras("source", element.getSourceElement(), false);
39683      }
39684      if (element.hasDescriptionElement()) {
39685        composeStringCore("description", element.getDescriptionElement(), false);
39686        composeStringExtras("description", element.getDescriptionElement(), false);
39687      }
39688      if (element.hasContent()) {
39689        openArray("content");
39690        for (Reference e : element.getContent()) 
39691          composeReference(null, e);
39692        closeArray();
39693      };
39694      if (element.hasRelated()) {
39695        openArray("related");
39696        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
39697          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
39698        closeArray();
39699      };
39700  }
39701
39702  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
39703    if (element != null) {
39704      open(name);
39705      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
39706      close();
39707    }
39708  }
39709
39710  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
39711      composeBackbone(element);
39712      if (element.hasIdentifier()) {
39713        composeIdentifier("identifier", element.getIdentifier());
39714      }
39715      if (element.hasRef()) {
39716        composeReference("ref", element.getRef());
39717      }
39718  }
39719
39720  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
39721    if (element != null) {
39722      prop("resourceType", name);
39723      composeDocumentReferenceInner(element);
39724    }
39725  }
39726
39727  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
39728      composeDomainResourceElements(element);
39729      if (element.hasMasterIdentifier()) {
39730        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
39731      }
39732      if (element.hasIdentifier()) {
39733        openArray("identifier");
39734        for (Identifier e : element.getIdentifier()) 
39735          composeIdentifier(null, e);
39736        closeArray();
39737      };
39738      if (element.hasStatusElement()) {
39739        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
39740        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
39741      }
39742      if (element.hasDocStatusElement()) {
39743        composeEnumerationCore("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
39744        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
39745      }
39746      if (element.hasType()) {
39747        composeCodeableConcept("type", element.getType());
39748      }
39749      if (element.hasCategory()) {
39750        openArray("category");
39751        for (CodeableConcept e : element.getCategory()) 
39752          composeCodeableConcept(null, e);
39753        closeArray();
39754      };
39755      if (element.hasSubject()) {
39756        composeReference("subject", element.getSubject());
39757      }
39758      if (element.hasDateElement()) {
39759        composeInstantCore("date", element.getDateElement(), false);
39760        composeInstantExtras("date", element.getDateElement(), false);
39761      }
39762      if (element.hasAuthor()) {
39763        openArray("author");
39764        for (Reference e : element.getAuthor()) 
39765          composeReference(null, e);
39766        closeArray();
39767      };
39768      if (element.hasAuthenticator()) {
39769        composeReference("authenticator", element.getAuthenticator());
39770      }
39771      if (element.hasCustodian()) {
39772        composeReference("custodian", element.getCustodian());
39773      }
39774      if (element.hasRelatesTo()) {
39775        openArray("relatesTo");
39776        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
39777          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
39778        closeArray();
39779      };
39780      if (element.hasDescriptionElement()) {
39781        composeStringCore("description", element.getDescriptionElement(), false);
39782        composeStringExtras("description", element.getDescriptionElement(), false);
39783      }
39784      if (element.hasSecurityLabel()) {
39785        openArray("securityLabel");
39786        for (CodeableConcept e : element.getSecurityLabel()) 
39787          composeCodeableConcept(null, e);
39788        closeArray();
39789      };
39790      if (element.hasContent()) {
39791        openArray("content");
39792        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
39793          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
39794        closeArray();
39795      };
39796      if (element.hasContext()) {
39797        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
39798      }
39799  }
39800
39801  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
39802    if (element != null) {
39803      open(name);
39804      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
39805      close();
39806    }
39807  }
39808
39809  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
39810      composeBackbone(element);
39811      if (element.hasCodeElement()) {
39812        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
39813        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
39814      }
39815      if (element.hasTarget()) {
39816        composeReference("target", element.getTarget());
39817      }
39818  }
39819
39820  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
39821    if (element != null) {
39822      open(name);
39823      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
39824      close();
39825    }
39826  }
39827
39828  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
39829      composeBackbone(element);
39830      if (element.hasAttachment()) {
39831        composeAttachment("attachment", element.getAttachment());
39832      }
39833      if (element.hasFormat()) {
39834        composeCoding("format", element.getFormat());
39835      }
39836  }
39837
39838  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
39839    if (element != null) {
39840      open(name);
39841      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
39842      close();
39843    }
39844  }
39845
39846  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
39847      composeBackbone(element);
39848      if (element.hasEncounter()) {
39849        openArray("encounter");
39850        for (Reference e : element.getEncounter()) 
39851          composeReference(null, e);
39852        closeArray();
39853      };
39854      if (element.hasEvent()) {
39855        openArray("event");
39856        for (CodeableConcept e : element.getEvent()) 
39857          composeCodeableConcept(null, e);
39858        closeArray();
39859      };
39860      if (element.hasPeriod()) {
39861        composePeriod("period", element.getPeriod());
39862      }
39863      if (element.hasFacilityType()) {
39864        composeCodeableConcept("facilityType", element.getFacilityType());
39865      }
39866      if (element.hasPracticeSetting()) {
39867        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
39868      }
39869      if (element.hasSourcePatientInfo()) {
39870        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
39871      }
39872      if (element.hasRelated()) {
39873        openArray("related");
39874        for (Reference e : element.getRelated()) 
39875          composeReference(null, e);
39876        closeArray();
39877      };
39878  }
39879
39880  protected void composeEffectEvidenceSynthesis(String name, EffectEvidenceSynthesis element) throws IOException {
39881    if (element != null) {
39882      prop("resourceType", name);
39883      composeEffectEvidenceSynthesisInner(element);
39884    }
39885  }
39886
39887  protected void composeEffectEvidenceSynthesisInner(EffectEvidenceSynthesis element) throws IOException {
39888      composeDomainResourceElements(element);
39889      if (element.hasUrlElement()) {
39890        composeUriCore("url", element.getUrlElement(), false);
39891        composeUriExtras("url", element.getUrlElement(), false);
39892      }
39893      if (element.hasIdentifier()) {
39894        openArray("identifier");
39895        for (Identifier e : element.getIdentifier()) 
39896          composeIdentifier(null, e);
39897        closeArray();
39898      };
39899      if (element.hasVersionElement()) {
39900        composeStringCore("version", element.getVersionElement(), false);
39901        composeStringExtras("version", element.getVersionElement(), false);
39902      }
39903      if (element.hasNameElement()) {
39904        composeStringCore("name", element.getNameElement(), false);
39905        composeStringExtras("name", element.getNameElement(), false);
39906      }
39907      if (element.hasTitleElement()) {
39908        composeStringCore("title", element.getTitleElement(), false);
39909        composeStringExtras("title", element.getTitleElement(), false);
39910      }
39911      if (element.hasStatusElement()) {
39912        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39913        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39914      }
39915      if (element.hasDateElement()) {
39916        composeDateTimeCore("date", element.getDateElement(), false);
39917        composeDateTimeExtras("date", element.getDateElement(), false);
39918      }
39919      if (element.hasPublisherElement()) {
39920        composeStringCore("publisher", element.getPublisherElement(), false);
39921        composeStringExtras("publisher", element.getPublisherElement(), false);
39922      }
39923      if (element.hasContact()) {
39924        openArray("contact");
39925        for (ContactDetail e : element.getContact()) 
39926          composeContactDetail(null, e);
39927        closeArray();
39928      };
39929      if (element.hasDescriptionElement()) {
39930        composeMarkdownCore("description", element.getDescriptionElement(), false);
39931        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39932      }
39933      if (element.hasNote()) {
39934        openArray("note");
39935        for (Annotation e : element.getNote()) 
39936          composeAnnotation(null, e);
39937        closeArray();
39938      };
39939      if (element.hasUseContext()) {
39940        openArray("useContext");
39941        for (UsageContext e : element.getUseContext()) 
39942          composeUsageContext(null, e);
39943        closeArray();
39944      };
39945      if (element.hasJurisdiction()) {
39946        openArray("jurisdiction");
39947        for (CodeableConcept e : element.getJurisdiction()) 
39948          composeCodeableConcept(null, e);
39949        closeArray();
39950      };
39951      if (element.hasCopyrightElement()) {
39952        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39953        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39954      }
39955      if (element.hasApprovalDateElement()) {
39956        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
39957        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
39958      }
39959      if (element.hasLastReviewDateElement()) {
39960        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
39961        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
39962      }
39963      if (element.hasEffectivePeriod()) {
39964        composePeriod("effectivePeriod", element.getEffectivePeriod());
39965      }
39966      if (element.hasTopic()) {
39967        openArray("topic");
39968        for (CodeableConcept e : element.getTopic()) 
39969          composeCodeableConcept(null, e);
39970        closeArray();
39971      };
39972      if (element.hasAuthor()) {
39973        openArray("author");
39974        for (ContactDetail e : element.getAuthor()) 
39975          composeContactDetail(null, e);
39976        closeArray();
39977      };
39978      if (element.hasEditor()) {
39979        openArray("editor");
39980        for (ContactDetail e : element.getEditor()) 
39981          composeContactDetail(null, e);
39982        closeArray();
39983      };
39984      if (element.hasReviewer()) {
39985        openArray("reviewer");
39986        for (ContactDetail e : element.getReviewer()) 
39987          composeContactDetail(null, e);
39988        closeArray();
39989      };
39990      if (element.hasEndorser()) {
39991        openArray("endorser");
39992        for (ContactDetail e : element.getEndorser()) 
39993          composeContactDetail(null, e);
39994        closeArray();
39995      };
39996      if (element.hasRelatedArtifact()) {
39997        openArray("relatedArtifact");
39998        for (RelatedArtifact e : element.getRelatedArtifact()) 
39999          composeRelatedArtifact(null, e);
40000        closeArray();
40001      };
40002      if (element.hasSynthesisType()) {
40003        composeCodeableConcept("synthesisType", element.getSynthesisType());
40004      }
40005      if (element.hasStudyType()) {
40006        composeCodeableConcept("studyType", element.getStudyType());
40007      }
40008      if (element.hasPopulation()) {
40009        composeReference("population", element.getPopulation());
40010      }
40011      if (element.hasExposure()) {
40012        composeReference("exposure", element.getExposure());
40013      }
40014      if (element.hasExposureAlternative()) {
40015        composeReference("exposureAlternative", element.getExposureAlternative());
40016      }
40017      if (element.hasOutcome()) {
40018        composeReference("outcome", element.getOutcome());
40019      }
40020      if (element.hasSampleSize()) {
40021        composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
40022      }
40023      if (element.hasResultsByExposure()) {
40024        openArray("resultsByExposure");
40025        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent e : element.getResultsByExposure()) 
40026          composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(null, e);
40027        closeArray();
40028      };
40029      if (element.hasEffectEstimate()) {
40030        openArray("effectEstimate");
40031        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent e : element.getEffectEstimate()) 
40032          composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(null, e);
40033        closeArray();
40034      };
40035      if (element.hasCertainty()) {
40036        openArray("certainty");
40037        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent e : element.getCertainty()) 
40038          composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(null, e);
40039        closeArray();
40040      };
40041  }
40042
40043  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
40044    if (element != null) {
40045      open(name);
40046      composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentInner(element);
40047      close();
40048    }
40049  }
40050
40051  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
40052      composeBackbone(element);
40053      if (element.hasDescriptionElement()) {
40054        composeStringCore("description", element.getDescriptionElement(), false);
40055        composeStringExtras("description", element.getDescriptionElement(), false);
40056      }
40057      if (element.hasNumberOfStudiesElement()) {
40058        composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
40059        composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
40060      }
40061      if (element.hasNumberOfParticipantsElement()) {
40062        composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
40063        composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
40064      }
40065  }
40066
40067  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
40068    if (element != null) {
40069      open(name);
40070      composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentInner(element);
40071      close();
40072    }
40073  }
40074
40075  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
40076      composeBackbone(element);
40077      if (element.hasDescriptionElement()) {
40078        composeStringCore("description", element.getDescriptionElement(), false);
40079        composeStringExtras("description", element.getDescriptionElement(), false);
40080      }
40081      if (element.hasExposureStateElement()) {
40082        composeEnumerationCore("exposureState", element.getExposureStateElement(), new EffectEvidenceSynthesis.ExposureStateEnumFactory(), false);
40083        composeEnumerationExtras("exposureState", element.getExposureStateElement(), new EffectEvidenceSynthesis.ExposureStateEnumFactory(), false);
40084      }
40085      if (element.hasVariantState()) {
40086        composeCodeableConcept("variantState", element.getVariantState());
40087      }
40088      if (element.hasRiskEvidenceSynthesis()) {
40089        composeReference("riskEvidenceSynthesis", element.getRiskEvidenceSynthesis());
40090      }
40091  }
40092
40093  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
40094    if (element != null) {
40095      open(name);
40096      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentInner(element);
40097      close();
40098    }
40099  }
40100
40101  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
40102      composeBackbone(element);
40103      if (element.hasDescriptionElement()) {
40104        composeStringCore("description", element.getDescriptionElement(), false);
40105        composeStringExtras("description", element.getDescriptionElement(), false);
40106      }
40107      if (element.hasType()) {
40108        composeCodeableConcept("type", element.getType());
40109      }
40110      if (element.hasVariantState()) {
40111        composeCodeableConcept("variantState", element.getVariantState());
40112      }
40113      if (element.hasValueElement()) {
40114        composeDecimalCore("value", element.getValueElement(), false);
40115        composeDecimalExtras("value", element.getValueElement(), false);
40116      }
40117      if (element.hasUnitOfMeasure()) {
40118        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
40119      }
40120      if (element.hasPrecisionEstimate()) {
40121        openArray("precisionEstimate");
40122        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent e : element.getPrecisionEstimate()) 
40123          composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(null, e);
40124        closeArray();
40125      };
40126  }
40127
40128  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element) throws IOException {
40129    if (element != null) {
40130      open(name);
40131      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentInner(element);
40132      close();
40133    }
40134  }
40135
40136  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element) throws IOException {
40137      composeBackbone(element);
40138      if (element.hasType()) {
40139        composeCodeableConcept("type", element.getType());
40140      }
40141      if (element.hasLevelElement()) {
40142        composeDecimalCore("level", element.getLevelElement(), false);
40143        composeDecimalExtras("level", element.getLevelElement(), false);
40144      }
40145      if (element.hasFromElement()) {
40146        composeDecimalCore("from", element.getFromElement(), false);
40147        composeDecimalExtras("from", element.getFromElement(), false);
40148      }
40149      if (element.hasToElement()) {
40150        composeDecimalCore("to", element.getToElement(), false);
40151        composeDecimalExtras("to", element.getToElement(), false);
40152      }
40153  }
40154
40155  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
40156    if (element != null) {
40157      open(name);
40158      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentInner(element);
40159      close();
40160    }
40161  }
40162
40163  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
40164      composeBackbone(element);
40165      if (element.hasRating()) {
40166        openArray("rating");
40167        for (CodeableConcept e : element.getRating()) 
40168          composeCodeableConcept(null, e);
40169        closeArray();
40170      };
40171      if (element.hasNote()) {
40172        openArray("note");
40173        for (Annotation e : element.getNote()) 
40174          composeAnnotation(null, e);
40175        closeArray();
40176      };
40177      if (element.hasCertaintySubcomponent()) {
40178        openArray("certaintySubcomponent");
40179        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
40180          composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(null, e);
40181        closeArray();
40182      };
40183  }
40184
40185  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
40186    if (element != null) {
40187      open(name);
40188      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(element);
40189      close();
40190    }
40191  }
40192
40193  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
40194      composeBackbone(element);
40195      if (element.hasType()) {
40196        composeCodeableConcept("type", element.getType());
40197      }
40198      if (element.hasRating()) {
40199        openArray("rating");
40200        for (CodeableConcept e : element.getRating()) 
40201          composeCodeableConcept(null, e);
40202        closeArray();
40203      };
40204      if (element.hasNote()) {
40205        openArray("note");
40206        for (Annotation e : element.getNote()) 
40207          composeAnnotation(null, e);
40208        closeArray();
40209      };
40210  }
40211
40212  protected void composeEncounter(String name, Encounter element) throws IOException {
40213    if (element != null) {
40214      prop("resourceType", name);
40215      composeEncounterInner(element);
40216    }
40217  }
40218
40219  protected void composeEncounterInner(Encounter element) throws IOException {
40220      composeDomainResourceElements(element);
40221      if (element.hasIdentifier()) {
40222        openArray("identifier");
40223        for (Identifier e : element.getIdentifier()) 
40224          composeIdentifier(null, e);
40225        closeArray();
40226      };
40227      if (element.hasStatusElement()) {
40228        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
40229        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
40230      }
40231      if (element.hasStatusHistory()) {
40232        openArray("statusHistory");
40233        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
40234          composeEncounterStatusHistoryComponent(null, e);
40235        closeArray();
40236      };
40237      if (element.hasClass_()) {
40238        composeCoding("class", element.getClass_());
40239      }
40240      if (element.hasClassHistory()) {
40241        openArray("classHistory");
40242        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
40243          composeEncounterClassHistoryComponent(null, e);
40244        closeArray();
40245      };
40246      if (element.hasType()) {
40247        openArray("type");
40248        for (CodeableConcept e : element.getType()) 
40249          composeCodeableConcept(null, e);
40250        closeArray();
40251      };
40252      if (element.hasServiceType()) {
40253        composeCodeableConcept("serviceType", element.getServiceType());
40254      }
40255      if (element.hasPriority()) {
40256        composeCodeableConcept("priority", element.getPriority());
40257      }
40258      if (element.hasSubject()) {
40259        composeReference("subject", element.getSubject());
40260      }
40261      if (element.hasEpisodeOfCare()) {
40262        openArray("episodeOfCare");
40263        for (Reference e : element.getEpisodeOfCare()) 
40264          composeReference(null, e);
40265        closeArray();
40266      };
40267      if (element.hasBasedOn()) {
40268        openArray("basedOn");
40269        for (Reference e : element.getBasedOn()) 
40270          composeReference(null, e);
40271        closeArray();
40272      };
40273      if (element.hasParticipant()) {
40274        openArray("participant");
40275        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
40276          composeEncounterEncounterParticipantComponent(null, e);
40277        closeArray();
40278      };
40279      if (element.hasAppointment()) {
40280        openArray("appointment");
40281        for (Reference e : element.getAppointment()) 
40282          composeReference(null, e);
40283        closeArray();
40284      };
40285      if (element.hasPeriod()) {
40286        composePeriod("period", element.getPeriod());
40287      }
40288      if (element.hasLength()) {
40289        composeDuration("length", element.getLength());
40290      }
40291      if (element.hasReasonCode()) {
40292        openArray("reasonCode");
40293        for (CodeableConcept e : element.getReasonCode()) 
40294          composeCodeableConcept(null, e);
40295        closeArray();
40296      };
40297      if (element.hasReasonReference()) {
40298        openArray("reasonReference");
40299        for (Reference e : element.getReasonReference()) 
40300          composeReference(null, e);
40301        closeArray();
40302      };
40303      if (element.hasDiagnosis()) {
40304        openArray("diagnosis");
40305        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
40306          composeEncounterDiagnosisComponent(null, e);
40307        closeArray();
40308      };
40309      if (element.hasAccount()) {
40310        openArray("account");
40311        for (Reference e : element.getAccount()) 
40312          composeReference(null, e);
40313        closeArray();
40314      };
40315      if (element.hasHospitalization()) {
40316        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
40317      }
40318      if (element.hasLocation()) {
40319        openArray("location");
40320        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
40321          composeEncounterEncounterLocationComponent(null, e);
40322        closeArray();
40323      };
40324      if (element.hasServiceProvider()) {
40325        composeReference("serviceProvider", element.getServiceProvider());
40326      }
40327      if (element.hasPartOf()) {
40328        composeReference("partOf", element.getPartOf());
40329      }
40330  }
40331
40332  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
40333    if (element != null) {
40334      open(name);
40335      composeEncounterStatusHistoryComponentInner(element);
40336      close();
40337    }
40338  }
40339
40340  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element) throws IOException {
40341      composeBackbone(element);
40342      if (element.hasStatusElement()) {
40343        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
40344        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
40345      }
40346      if (element.hasPeriod()) {
40347        composePeriod("period", element.getPeriod());
40348      }
40349  }
40350
40351  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
40352    if (element != null) {
40353      open(name);
40354      composeEncounterClassHistoryComponentInner(element);
40355      close();
40356    }
40357  }
40358
40359  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element) throws IOException {
40360      composeBackbone(element);
40361      if (element.hasClass_()) {
40362        composeCoding("class", element.getClass_());
40363      }
40364      if (element.hasPeriod()) {
40365        composePeriod("period", element.getPeriod());
40366      }
40367  }
40368
40369  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
40370    if (element != null) {
40371      open(name);
40372      composeEncounterEncounterParticipantComponentInner(element);
40373      close();
40374    }
40375  }
40376
40377  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
40378      composeBackbone(element);
40379      if (element.hasType()) {
40380        openArray("type");
40381        for (CodeableConcept e : element.getType()) 
40382          composeCodeableConcept(null, e);
40383        closeArray();
40384      };
40385      if (element.hasPeriod()) {
40386        composePeriod("period", element.getPeriod());
40387      }
40388      if (element.hasIndividual()) {
40389        composeReference("individual", element.getIndividual());
40390      }
40391  }
40392
40393  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
40394    if (element != null) {
40395      open(name);
40396      composeEncounterDiagnosisComponentInner(element);
40397      close();
40398    }
40399  }
40400
40401  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
40402      composeBackbone(element);
40403      if (element.hasCondition()) {
40404        composeReference("condition", element.getCondition());
40405      }
40406      if (element.hasUse()) {
40407        composeCodeableConcept("use", element.getUse());
40408      }
40409      if (element.hasRankElement()) {
40410        composePositiveIntCore("rank", element.getRankElement(), false);
40411        composePositiveIntExtras("rank", element.getRankElement(), false);
40412      }
40413  }
40414
40415  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
40416    if (element != null) {
40417      open(name);
40418      composeEncounterEncounterHospitalizationComponentInner(element);
40419      close();
40420    }
40421  }
40422
40423  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
40424      composeBackbone(element);
40425      if (element.hasPreAdmissionIdentifier()) {
40426        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
40427      }
40428      if (element.hasOrigin()) {
40429        composeReference("origin", element.getOrigin());
40430      }
40431      if (element.hasAdmitSource()) {
40432        composeCodeableConcept("admitSource", element.getAdmitSource());
40433      }
40434      if (element.hasReAdmission()) {
40435        composeCodeableConcept("reAdmission", element.getReAdmission());
40436      }
40437      if (element.hasDietPreference()) {
40438        openArray("dietPreference");
40439        for (CodeableConcept e : element.getDietPreference()) 
40440          composeCodeableConcept(null, e);
40441        closeArray();
40442      };
40443      if (element.hasSpecialCourtesy()) {
40444        openArray("specialCourtesy");
40445        for (CodeableConcept e : element.getSpecialCourtesy()) 
40446          composeCodeableConcept(null, e);
40447        closeArray();
40448      };
40449      if (element.hasSpecialArrangement()) {
40450        openArray("specialArrangement");
40451        for (CodeableConcept e : element.getSpecialArrangement()) 
40452          composeCodeableConcept(null, e);
40453        closeArray();
40454      };
40455      if (element.hasDestination()) {
40456        composeReference("destination", element.getDestination());
40457      }
40458      if (element.hasDischargeDisposition()) {
40459        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
40460      }
40461  }
40462
40463  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
40464    if (element != null) {
40465      open(name);
40466      composeEncounterEncounterLocationComponentInner(element);
40467      close();
40468    }
40469  }
40470
40471  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
40472      composeBackbone(element);
40473      if (element.hasLocation()) {
40474        composeReference("location", element.getLocation());
40475      }
40476      if (element.hasStatusElement()) {
40477        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
40478        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
40479      }
40480      if (element.hasPhysicalType()) {
40481        composeCodeableConcept("physicalType", element.getPhysicalType());
40482      }
40483      if (element.hasPeriod()) {
40484        composePeriod("period", element.getPeriod());
40485      }
40486  }
40487
40488  protected void composeEndpoint(String name, Endpoint element) throws IOException {
40489    if (element != null) {
40490      prop("resourceType", name);
40491      composeEndpointInner(element);
40492    }
40493  }
40494
40495  protected void composeEndpointInner(Endpoint element) throws IOException {
40496      composeDomainResourceElements(element);
40497      if (element.hasIdentifier()) {
40498        openArray("identifier");
40499        for (Identifier e : element.getIdentifier()) 
40500          composeIdentifier(null, e);
40501        closeArray();
40502      };
40503      if (element.hasStatusElement()) {
40504        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
40505        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
40506      }
40507      if (element.hasConnectionType()) {
40508        composeCoding("connectionType", element.getConnectionType());
40509      }
40510      if (element.hasNameElement()) {
40511        composeStringCore("name", element.getNameElement(), false);
40512        composeStringExtras("name", element.getNameElement(), false);
40513      }
40514      if (element.hasManagingOrganization()) {
40515        composeReference("managingOrganization", element.getManagingOrganization());
40516      }
40517      if (element.hasContact()) {
40518        openArray("contact");
40519        for (ContactPoint e : element.getContact()) 
40520          composeContactPoint(null, e);
40521        closeArray();
40522      };
40523      if (element.hasPeriod()) {
40524        composePeriod("period", element.getPeriod());
40525      }
40526      if (element.hasPayloadType()) {
40527        openArray("payloadType");
40528        for (CodeableConcept e : element.getPayloadType()) 
40529          composeCodeableConcept(null, e);
40530        closeArray();
40531      };
40532      if (element.hasPayloadMimeType()) {
40533        openArray("payloadMimeType");
40534        for (CodeType e : element.getPayloadMimeType()) 
40535          composeCodeCore(null, e, true);
40536        closeArray();
40537        if (anyHasExtras(element.getPayloadMimeType())) {
40538          openArray("_payloadMimeType");
40539          for (CodeType e : element.getPayloadMimeType()) 
40540            composeCodeExtras(null, e, true);
40541          closeArray();
40542        }
40543      };
40544      if (element.hasAddressElement()) {
40545        composeUrlCore("address", element.getAddressElement(), false);
40546        composeUrlExtras("address", element.getAddressElement(), false);
40547      }
40548      if (element.hasHeader()) {
40549        openArray("header");
40550        for (StringType e : element.getHeader()) 
40551          composeStringCore(null, e, true);
40552        closeArray();
40553        if (anyHasExtras(element.getHeader())) {
40554          openArray("_header");
40555          for (StringType e : element.getHeader()) 
40556            composeStringExtras(null, e, true);
40557          closeArray();
40558        }
40559      };
40560  }
40561
40562  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
40563    if (element != null) {
40564      prop("resourceType", name);
40565      composeEnrollmentRequestInner(element);
40566    }
40567  }
40568
40569  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
40570      composeDomainResourceElements(element);
40571      if (element.hasIdentifier()) {
40572        openArray("identifier");
40573        for (Identifier e : element.getIdentifier()) 
40574          composeIdentifier(null, e);
40575        closeArray();
40576      };
40577      if (element.hasStatusElement()) {
40578        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
40579        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
40580      }
40581      if (element.hasCreatedElement()) {
40582        composeDateTimeCore("created", element.getCreatedElement(), false);
40583        composeDateTimeExtras("created", element.getCreatedElement(), false);
40584      }
40585      if (element.hasInsurer()) {
40586        composeReference("insurer", element.getInsurer());
40587      }
40588      if (element.hasProvider()) {
40589        composeReference("provider", element.getProvider());
40590      }
40591      if (element.hasCandidate()) {
40592        composeReference("candidate", element.getCandidate());
40593      }
40594      if (element.hasCoverage()) {
40595        composeReference("coverage", element.getCoverage());
40596      }
40597  }
40598
40599  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
40600    if (element != null) {
40601      prop("resourceType", name);
40602      composeEnrollmentResponseInner(element);
40603    }
40604  }
40605
40606  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
40607      composeDomainResourceElements(element);
40608      if (element.hasIdentifier()) {
40609        openArray("identifier");
40610        for (Identifier e : element.getIdentifier()) 
40611          composeIdentifier(null, e);
40612        closeArray();
40613      };
40614      if (element.hasStatusElement()) {
40615        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
40616        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
40617      }
40618      if (element.hasRequest()) {
40619        composeReference("request", element.getRequest());
40620      }
40621      if (element.hasOutcomeElement()) {
40622        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
40623        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
40624      }
40625      if (element.hasDispositionElement()) {
40626        composeStringCore("disposition", element.getDispositionElement(), false);
40627        composeStringExtras("disposition", element.getDispositionElement(), false);
40628      }
40629      if (element.hasCreatedElement()) {
40630        composeDateTimeCore("created", element.getCreatedElement(), false);
40631        composeDateTimeExtras("created", element.getCreatedElement(), false);
40632      }
40633      if (element.hasOrganization()) {
40634        composeReference("organization", element.getOrganization());
40635      }
40636      if (element.hasRequestProvider()) {
40637        composeReference("requestProvider", element.getRequestProvider());
40638      }
40639  }
40640
40641  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
40642    if (element != null) {
40643      prop("resourceType", name);
40644      composeEpisodeOfCareInner(element);
40645    }
40646  }
40647
40648  protected void composeEpisodeOfCareInner(EpisodeOfCare 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.hasStatusElement()) {
40657        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
40658        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
40659      }
40660      if (element.hasStatusHistory()) {
40661        openArray("statusHistory");
40662        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
40663          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
40664        closeArray();
40665      };
40666      if (element.hasType()) {
40667        openArray("type");
40668        for (CodeableConcept e : element.getType()) 
40669          composeCodeableConcept(null, e);
40670        closeArray();
40671      };
40672      if (element.hasDiagnosis()) {
40673        openArray("diagnosis");
40674        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
40675          composeEpisodeOfCareDiagnosisComponent(null, e);
40676        closeArray();
40677      };
40678      if (element.hasPatient()) {
40679        composeReference("patient", element.getPatient());
40680      }
40681      if (element.hasManagingOrganization()) {
40682        composeReference("managingOrganization", element.getManagingOrganization());
40683      }
40684      if (element.hasPeriod()) {
40685        composePeriod("period", element.getPeriod());
40686      }
40687      if (element.hasReferralRequest()) {
40688        openArray("referralRequest");
40689        for (Reference e : element.getReferralRequest()) 
40690          composeReference(null, e);
40691        closeArray();
40692      };
40693      if (element.hasCareManager()) {
40694        composeReference("careManager", element.getCareManager());
40695      }
40696      if (element.hasTeam()) {
40697        openArray("team");
40698        for (Reference e : element.getTeam()) 
40699          composeReference(null, e);
40700        closeArray();
40701      };
40702      if (element.hasAccount()) {
40703        openArray("account");
40704        for (Reference e : element.getAccount()) 
40705          composeReference(null, e);
40706        closeArray();
40707      };
40708  }
40709
40710  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
40711    if (element != null) {
40712      open(name);
40713      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
40714      close();
40715    }
40716  }
40717
40718  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
40719      composeBackbone(element);
40720      if (element.hasStatusElement()) {
40721        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
40722        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
40723      }
40724      if (element.hasPeriod()) {
40725        composePeriod("period", element.getPeriod());
40726      }
40727  }
40728
40729  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
40730    if (element != null) {
40731      open(name);
40732      composeEpisodeOfCareDiagnosisComponentInner(element);
40733      close();
40734    }
40735  }
40736
40737  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element) throws IOException {
40738      composeBackbone(element);
40739      if (element.hasCondition()) {
40740        composeReference("condition", element.getCondition());
40741      }
40742      if (element.hasRole()) {
40743        composeCodeableConcept("role", element.getRole());
40744      }
40745      if (element.hasRankElement()) {
40746        composePositiveIntCore("rank", element.getRankElement(), false);
40747        composePositiveIntExtras("rank", element.getRankElement(), false);
40748      }
40749  }
40750
40751  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
40752    if (element != null) {
40753      prop("resourceType", name);
40754      composeEventDefinitionInner(element);
40755    }
40756  }
40757
40758  protected void composeEventDefinitionInner(EventDefinition element) throws IOException {
40759      composeDomainResourceElements(element);
40760      if (element.hasUrlElement()) {
40761        composeUriCore("url", element.getUrlElement(), false);
40762        composeUriExtras("url", element.getUrlElement(), false);
40763      }
40764      if (element.hasIdentifier()) {
40765        openArray("identifier");
40766        for (Identifier e : element.getIdentifier()) 
40767          composeIdentifier(null, e);
40768        closeArray();
40769      };
40770      if (element.hasVersionElement()) {
40771        composeStringCore("version", element.getVersionElement(), false);
40772        composeStringExtras("version", element.getVersionElement(), false);
40773      }
40774      if (element.hasNameElement()) {
40775        composeStringCore("name", element.getNameElement(), false);
40776        composeStringExtras("name", element.getNameElement(), false);
40777      }
40778      if (element.hasTitleElement()) {
40779        composeStringCore("title", element.getTitleElement(), false);
40780        composeStringExtras("title", element.getTitleElement(), false);
40781      }
40782      if (element.hasSubtitleElement()) {
40783        composeStringCore("subtitle", element.getSubtitleElement(), false);
40784        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40785      }
40786      if (element.hasStatusElement()) {
40787        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40788        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40789      }
40790      if (element.hasExperimentalElement()) {
40791        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40792        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40793      }
40794      if (element.hasSubject()) {
40795        composeType("subject", element.getSubject());
40796      }
40797      if (element.hasDateElement()) {
40798        composeDateTimeCore("date", element.getDateElement(), false);
40799        composeDateTimeExtras("date", element.getDateElement(), false);
40800      }
40801      if (element.hasPublisherElement()) {
40802        composeStringCore("publisher", element.getPublisherElement(), false);
40803        composeStringExtras("publisher", element.getPublisherElement(), false);
40804      }
40805      if (element.hasContact()) {
40806        openArray("contact");
40807        for (ContactDetail e : element.getContact()) 
40808          composeContactDetail(null, e);
40809        closeArray();
40810      };
40811      if (element.hasDescriptionElement()) {
40812        composeMarkdownCore("description", element.getDescriptionElement(), false);
40813        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40814      }
40815      if (element.hasUseContext()) {
40816        openArray("useContext");
40817        for (UsageContext e : element.getUseContext()) 
40818          composeUsageContext(null, e);
40819        closeArray();
40820      };
40821      if (element.hasJurisdiction()) {
40822        openArray("jurisdiction");
40823        for (CodeableConcept e : element.getJurisdiction()) 
40824          composeCodeableConcept(null, e);
40825        closeArray();
40826      };
40827      if (element.hasPurposeElement()) {
40828        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40829        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40830      }
40831      if (element.hasUsageElement()) {
40832        composeStringCore("usage", element.getUsageElement(), false);
40833        composeStringExtras("usage", element.getUsageElement(), false);
40834      }
40835      if (element.hasCopyrightElement()) {
40836        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40837        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40838      }
40839      if (element.hasApprovalDateElement()) {
40840        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40841        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40842      }
40843      if (element.hasLastReviewDateElement()) {
40844        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40845        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40846      }
40847      if (element.hasEffectivePeriod()) {
40848        composePeriod("effectivePeriod", element.getEffectivePeriod());
40849      }
40850      if (element.hasTopic()) {
40851        openArray("topic");
40852        for (CodeableConcept e : element.getTopic()) 
40853          composeCodeableConcept(null, e);
40854        closeArray();
40855      };
40856      if (element.hasAuthor()) {
40857        openArray("author");
40858        for (ContactDetail e : element.getAuthor()) 
40859          composeContactDetail(null, e);
40860        closeArray();
40861      };
40862      if (element.hasEditor()) {
40863        openArray("editor");
40864        for (ContactDetail e : element.getEditor()) 
40865          composeContactDetail(null, e);
40866        closeArray();
40867      };
40868      if (element.hasReviewer()) {
40869        openArray("reviewer");
40870        for (ContactDetail e : element.getReviewer()) 
40871          composeContactDetail(null, e);
40872        closeArray();
40873      };
40874      if (element.hasEndorser()) {
40875        openArray("endorser");
40876        for (ContactDetail e : element.getEndorser()) 
40877          composeContactDetail(null, e);
40878        closeArray();
40879      };
40880      if (element.hasRelatedArtifact()) {
40881        openArray("relatedArtifact");
40882        for (RelatedArtifact e : element.getRelatedArtifact()) 
40883          composeRelatedArtifact(null, e);
40884        closeArray();
40885      };
40886      if (element.hasTrigger()) {
40887        openArray("trigger");
40888        for (TriggerDefinition e : element.getTrigger()) 
40889          composeTriggerDefinition(null, e);
40890        closeArray();
40891      };
40892  }
40893
40894  protected void composeEvidence(String name, Evidence element) throws IOException {
40895    if (element != null) {
40896      prop("resourceType", name);
40897      composeEvidenceInner(element);
40898    }
40899  }
40900
40901  protected void composeEvidenceInner(Evidence element) throws IOException {
40902      composeDomainResourceElements(element);
40903      if (element.hasUrlElement()) {
40904        composeUriCore("url", element.getUrlElement(), false);
40905        composeUriExtras("url", element.getUrlElement(), false);
40906      }
40907      if (element.hasIdentifier()) {
40908        openArray("identifier");
40909        for (Identifier e : element.getIdentifier()) 
40910          composeIdentifier(null, e);
40911        closeArray();
40912      };
40913      if (element.hasVersionElement()) {
40914        composeStringCore("version", element.getVersionElement(), false);
40915        composeStringExtras("version", element.getVersionElement(), false);
40916      }
40917      if (element.hasNameElement()) {
40918        composeStringCore("name", element.getNameElement(), false);
40919        composeStringExtras("name", element.getNameElement(), false);
40920      }
40921      if (element.hasTitleElement()) {
40922        composeStringCore("title", element.getTitleElement(), false);
40923        composeStringExtras("title", element.getTitleElement(), false);
40924      }
40925      if (element.hasShortTitleElement()) {
40926        composeStringCore("shortTitle", element.getShortTitleElement(), false);
40927        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
40928      }
40929      if (element.hasSubtitleElement()) {
40930        composeStringCore("subtitle", element.getSubtitleElement(), false);
40931        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40932      }
40933      if (element.hasStatusElement()) {
40934        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40935        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40936      }
40937      if (element.hasDateElement()) {
40938        composeDateTimeCore("date", element.getDateElement(), false);
40939        composeDateTimeExtras("date", element.getDateElement(), false);
40940      }
40941      if (element.hasPublisherElement()) {
40942        composeStringCore("publisher", element.getPublisherElement(), false);
40943        composeStringExtras("publisher", element.getPublisherElement(), false);
40944      }
40945      if (element.hasContact()) {
40946        openArray("contact");
40947        for (ContactDetail e : element.getContact()) 
40948          composeContactDetail(null, e);
40949        closeArray();
40950      };
40951      if (element.hasDescriptionElement()) {
40952        composeMarkdownCore("description", element.getDescriptionElement(), false);
40953        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40954      }
40955      if (element.hasNote()) {
40956        openArray("note");
40957        for (Annotation e : element.getNote()) 
40958          composeAnnotation(null, e);
40959        closeArray();
40960      };
40961      if (element.hasUseContext()) {
40962        openArray("useContext");
40963        for (UsageContext e : element.getUseContext()) 
40964          composeUsageContext(null, e);
40965        closeArray();
40966      };
40967      if (element.hasJurisdiction()) {
40968        openArray("jurisdiction");
40969        for (CodeableConcept e : element.getJurisdiction()) 
40970          composeCodeableConcept(null, e);
40971        closeArray();
40972      };
40973      if (element.hasCopyrightElement()) {
40974        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40975        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40976      }
40977      if (element.hasApprovalDateElement()) {
40978        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40979        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40980      }
40981      if (element.hasLastReviewDateElement()) {
40982        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40983        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40984      }
40985      if (element.hasEffectivePeriod()) {
40986        composePeriod("effectivePeriod", element.getEffectivePeriod());
40987      }
40988      if (element.hasTopic()) {
40989        openArray("topic");
40990        for (CodeableConcept e : element.getTopic()) 
40991          composeCodeableConcept(null, e);
40992        closeArray();
40993      };
40994      if (element.hasAuthor()) {
40995        openArray("author");
40996        for (ContactDetail e : element.getAuthor()) 
40997          composeContactDetail(null, e);
40998        closeArray();
40999      };
41000      if (element.hasEditor()) {
41001        openArray("editor");
41002        for (ContactDetail e : element.getEditor()) 
41003          composeContactDetail(null, e);
41004        closeArray();
41005      };
41006      if (element.hasReviewer()) {
41007        openArray("reviewer");
41008        for (ContactDetail e : element.getReviewer()) 
41009          composeContactDetail(null, e);
41010        closeArray();
41011      };
41012      if (element.hasEndorser()) {
41013        openArray("endorser");
41014        for (ContactDetail e : element.getEndorser()) 
41015          composeContactDetail(null, e);
41016        closeArray();
41017      };
41018      if (element.hasRelatedArtifact()) {
41019        openArray("relatedArtifact");
41020        for (RelatedArtifact e : element.getRelatedArtifact()) 
41021          composeRelatedArtifact(null, e);
41022        closeArray();
41023      };
41024      if (element.hasExposureBackground()) {
41025        composeReference("exposureBackground", element.getExposureBackground());
41026      }
41027      if (element.hasExposureVariant()) {
41028        openArray("exposureVariant");
41029        for (Reference e : element.getExposureVariant()) 
41030          composeReference(null, e);
41031        closeArray();
41032      };
41033      if (element.hasOutcome()) {
41034        openArray("outcome");
41035        for (Reference e : element.getOutcome()) 
41036          composeReference(null, e);
41037        closeArray();
41038      };
41039  }
41040
41041  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
41042    if (element != null) {
41043      prop("resourceType", name);
41044      composeEvidenceVariableInner(element);
41045    }
41046  }
41047
41048  protected void composeEvidenceVariableInner(EvidenceVariable element) throws IOException {
41049      composeDomainResourceElements(element);
41050      if (element.hasUrlElement()) {
41051        composeUriCore("url", element.getUrlElement(), false);
41052        composeUriExtras("url", element.getUrlElement(), false);
41053      }
41054      if (element.hasIdentifier()) {
41055        openArray("identifier");
41056        for (Identifier e : element.getIdentifier()) 
41057          composeIdentifier(null, e);
41058        closeArray();
41059      };
41060      if (element.hasVersionElement()) {
41061        composeStringCore("version", element.getVersionElement(), false);
41062        composeStringExtras("version", element.getVersionElement(), false);
41063      }
41064      if (element.hasNameElement()) {
41065        composeStringCore("name", element.getNameElement(), false);
41066        composeStringExtras("name", element.getNameElement(), false);
41067      }
41068      if (element.hasTitleElement()) {
41069        composeStringCore("title", element.getTitleElement(), false);
41070        composeStringExtras("title", element.getTitleElement(), false);
41071      }
41072      if (element.hasShortTitleElement()) {
41073        composeStringCore("shortTitle", element.getShortTitleElement(), false);
41074        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
41075      }
41076      if (element.hasSubtitleElement()) {
41077        composeStringCore("subtitle", element.getSubtitleElement(), false);
41078        composeStringExtras("subtitle", element.getSubtitleElement(), false);
41079      }
41080      if (element.hasStatusElement()) {
41081        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41082        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41083      }
41084      if (element.hasDateElement()) {
41085        composeDateTimeCore("date", element.getDateElement(), false);
41086        composeDateTimeExtras("date", element.getDateElement(), false);
41087      }
41088      if (element.hasPublisherElement()) {
41089        composeStringCore("publisher", element.getPublisherElement(), false);
41090        composeStringExtras("publisher", element.getPublisherElement(), false);
41091      }
41092      if (element.hasContact()) {
41093        openArray("contact");
41094        for (ContactDetail e : element.getContact()) 
41095          composeContactDetail(null, e);
41096        closeArray();
41097      };
41098      if (element.hasDescriptionElement()) {
41099        composeMarkdownCore("description", element.getDescriptionElement(), false);
41100        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41101      }
41102      if (element.hasNote()) {
41103        openArray("note");
41104        for (Annotation e : element.getNote()) 
41105          composeAnnotation(null, e);
41106        closeArray();
41107      };
41108      if (element.hasUseContext()) {
41109        openArray("useContext");
41110        for (UsageContext e : element.getUseContext()) 
41111          composeUsageContext(null, e);
41112        closeArray();
41113      };
41114      if (element.hasJurisdiction()) {
41115        openArray("jurisdiction");
41116        for (CodeableConcept e : element.getJurisdiction()) 
41117          composeCodeableConcept(null, e);
41118        closeArray();
41119      };
41120      if (element.hasCopyrightElement()) {
41121        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41122        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41123      }
41124      if (element.hasApprovalDateElement()) {
41125        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
41126        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
41127      }
41128      if (element.hasLastReviewDateElement()) {
41129        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
41130        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
41131      }
41132      if (element.hasEffectivePeriod()) {
41133        composePeriod("effectivePeriod", element.getEffectivePeriod());
41134      }
41135      if (element.hasTopic()) {
41136        openArray("topic");
41137        for (CodeableConcept e : element.getTopic()) 
41138          composeCodeableConcept(null, e);
41139        closeArray();
41140      };
41141      if (element.hasAuthor()) {
41142        openArray("author");
41143        for (ContactDetail e : element.getAuthor()) 
41144          composeContactDetail(null, e);
41145        closeArray();
41146      };
41147      if (element.hasEditor()) {
41148        openArray("editor");
41149        for (ContactDetail e : element.getEditor()) 
41150          composeContactDetail(null, e);
41151        closeArray();
41152      };
41153      if (element.hasReviewer()) {
41154        openArray("reviewer");
41155        for (ContactDetail e : element.getReviewer()) 
41156          composeContactDetail(null, e);
41157        closeArray();
41158      };
41159      if (element.hasEndorser()) {
41160        openArray("endorser");
41161        for (ContactDetail e : element.getEndorser()) 
41162          composeContactDetail(null, e);
41163        closeArray();
41164      };
41165      if (element.hasRelatedArtifact()) {
41166        openArray("relatedArtifact");
41167        for (RelatedArtifact e : element.getRelatedArtifact()) 
41168          composeRelatedArtifact(null, e);
41169        closeArray();
41170      };
41171      if (element.hasTypeElement()) {
41172        composeEnumerationCore("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
41173        composeEnumerationExtras("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
41174      }
41175      if (element.hasCharacteristic()) {
41176        openArray("characteristic");
41177        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
41178          composeEvidenceVariableEvidenceVariableCharacteristicComponent(null, e);
41179        closeArray();
41180      };
41181  }
41182
41183  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
41184    if (element != null) {
41185      open(name);
41186      composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(element);
41187      close();
41188    }
41189  }
41190
41191  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
41192      composeBackbone(element);
41193      if (element.hasDescriptionElement()) {
41194        composeStringCore("description", element.getDescriptionElement(), false);
41195        composeStringExtras("description", element.getDescriptionElement(), false);
41196      }
41197      if (element.hasDefinition()) {
41198        composeType("definition", element.getDefinition());
41199      }
41200      if (element.hasUsageContext()) {
41201        openArray("usageContext");
41202        for (UsageContext e : element.getUsageContext()) 
41203          composeUsageContext(null, e);
41204        closeArray();
41205      };
41206      if (element.hasExcludeElement()) {
41207        composeBooleanCore("exclude", element.getExcludeElement(), false);
41208        composeBooleanExtras("exclude", element.getExcludeElement(), false);
41209      }
41210      if (element.hasParticipantEffective()) {
41211        composeType("participantEffective", element.getParticipantEffective());
41212      }
41213      if (element.hasTimeFromStart()) {
41214        composeDuration("timeFromStart", element.getTimeFromStart());
41215      }
41216      if (element.hasGroupMeasureElement()) {
41217        composeEnumerationCore("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
41218        composeEnumerationExtras("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
41219      }
41220  }
41221
41222  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
41223    if (element != null) {
41224      prop("resourceType", name);
41225      composeExampleScenarioInner(element);
41226    }
41227  }
41228
41229  protected void composeExampleScenarioInner(ExampleScenario element) throws IOException {
41230      composeDomainResourceElements(element);
41231      if (element.hasUrlElement()) {
41232        composeUriCore("url", element.getUrlElement(), false);
41233        composeUriExtras("url", element.getUrlElement(), false);
41234      }
41235      if (element.hasIdentifier()) {
41236        openArray("identifier");
41237        for (Identifier e : element.getIdentifier()) 
41238          composeIdentifier(null, e);
41239        closeArray();
41240      };
41241      if (element.hasVersionElement()) {
41242        composeStringCore("version", element.getVersionElement(), false);
41243        composeStringExtras("version", element.getVersionElement(), false);
41244      }
41245      if (element.hasNameElement()) {
41246        composeStringCore("name", element.getNameElement(), false);
41247        composeStringExtras("name", element.getNameElement(), false);
41248      }
41249      if (element.hasStatusElement()) {
41250        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41251        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41252      }
41253      if (element.hasExperimentalElement()) {
41254        composeBooleanCore("experimental", element.getExperimentalElement(), false);
41255        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
41256      }
41257      if (element.hasDateElement()) {
41258        composeDateTimeCore("date", element.getDateElement(), false);
41259        composeDateTimeExtras("date", element.getDateElement(), false);
41260      }
41261      if (element.hasPublisherElement()) {
41262        composeStringCore("publisher", element.getPublisherElement(), false);
41263        composeStringExtras("publisher", element.getPublisherElement(), false);
41264      }
41265      if (element.hasContact()) {
41266        openArray("contact");
41267        for (ContactDetail e : element.getContact()) 
41268          composeContactDetail(null, e);
41269        closeArray();
41270      };
41271      if (element.hasUseContext()) {
41272        openArray("useContext");
41273        for (UsageContext e : element.getUseContext()) 
41274          composeUsageContext(null, e);
41275        closeArray();
41276      };
41277      if (element.hasJurisdiction()) {
41278        openArray("jurisdiction");
41279        for (CodeableConcept e : element.getJurisdiction()) 
41280          composeCodeableConcept(null, e);
41281        closeArray();
41282      };
41283      if (element.hasCopyrightElement()) {
41284        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41285        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41286      }
41287      if (element.hasPurposeElement()) {
41288        composeMarkdownCore("purpose", element.getPurposeElement(), false);
41289        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
41290      }
41291      if (element.hasActor()) {
41292        openArray("actor");
41293        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
41294          composeExampleScenarioExampleScenarioActorComponent(null, e);
41295        closeArray();
41296      };
41297      if (element.hasInstance()) {
41298        openArray("instance");
41299        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
41300          composeExampleScenarioExampleScenarioInstanceComponent(null, e);
41301        closeArray();
41302      };
41303      if (element.hasProcess()) {
41304        openArray("process");
41305        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
41306          composeExampleScenarioExampleScenarioProcessComponent(null, e);
41307        closeArray();
41308      };
41309      if (element.hasWorkflow()) {
41310        openArray("workflow");
41311        for (CanonicalType e : element.getWorkflow()) 
41312          composeCanonicalCore(null, e, true);
41313        closeArray();
41314        if (anyHasExtras(element.getWorkflow())) {
41315          openArray("_workflow");
41316          for (CanonicalType e : element.getWorkflow()) 
41317            composeCanonicalExtras(null, e, true);
41318          closeArray();
41319        }
41320      };
41321  }
41322
41323  protected void composeExampleScenarioExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
41324    if (element != null) {
41325      open(name);
41326      composeExampleScenarioExampleScenarioActorComponentInner(element);
41327      close();
41328    }
41329  }
41330
41331  protected void composeExampleScenarioExampleScenarioActorComponentInner(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
41332      composeBackbone(element);
41333      if (element.hasActorIdElement()) {
41334        composeStringCore("actorId", element.getActorIdElement(), false);
41335        composeStringExtras("actorId", element.getActorIdElement(), false);
41336      }
41337      if (element.hasTypeElement()) {
41338        composeEnumerationCore("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
41339        composeEnumerationExtras("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
41340      }
41341      if (element.hasNameElement()) {
41342        composeStringCore("name", element.getNameElement(), false);
41343        composeStringExtras("name", element.getNameElement(), false);
41344      }
41345      if (element.hasDescriptionElement()) {
41346        composeMarkdownCore("description", element.getDescriptionElement(), false);
41347        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41348      }
41349  }
41350
41351  protected void composeExampleScenarioExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
41352    if (element != null) {
41353      open(name);
41354      composeExampleScenarioExampleScenarioInstanceComponentInner(element);
41355      close();
41356    }
41357  }
41358
41359  protected void composeExampleScenarioExampleScenarioInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
41360      composeBackbone(element);
41361      if (element.hasResourceIdElement()) {
41362        composeStringCore("resourceId", element.getResourceIdElement(), false);
41363        composeStringExtras("resourceId", element.getResourceIdElement(), false);
41364      }
41365      if (element.hasResourceTypeElement()) {
41366        composeEnumerationCore("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
41367        composeEnumerationExtras("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
41368      }
41369      if (element.hasNameElement()) {
41370        composeStringCore("name", element.getNameElement(), false);
41371        composeStringExtras("name", element.getNameElement(), false);
41372      }
41373      if (element.hasDescriptionElement()) {
41374        composeMarkdownCore("description", element.getDescriptionElement(), false);
41375        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41376      }
41377      if (element.hasVersion()) {
41378        openArray("version");
41379        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
41380          composeExampleScenarioExampleScenarioInstanceVersionComponent(null, e);
41381        closeArray();
41382      };
41383      if (element.hasContainedInstance()) {
41384        openArray("containedInstance");
41385        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
41386          composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(null, e);
41387        closeArray();
41388      };
41389  }
41390
41391  protected void composeExampleScenarioExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
41392    if (element != null) {
41393      open(name);
41394      composeExampleScenarioExampleScenarioInstanceVersionComponentInner(element);
41395      close();
41396    }
41397  }
41398
41399  protected void composeExampleScenarioExampleScenarioInstanceVersionComponentInner(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
41400      composeBackbone(element);
41401      if (element.hasVersionIdElement()) {
41402        composeStringCore("versionId", element.getVersionIdElement(), false);
41403        composeStringExtras("versionId", element.getVersionIdElement(), false);
41404      }
41405      if (element.hasDescriptionElement()) {
41406        composeMarkdownCore("description", element.getDescriptionElement(), false);
41407        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41408      }
41409  }
41410
41411  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
41412    if (element != null) {
41413      open(name);
41414      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(element);
41415      close();
41416    }
41417  }
41418
41419  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
41420      composeBackbone(element);
41421      if (element.hasResourceIdElement()) {
41422        composeStringCore("resourceId", element.getResourceIdElement(), false);
41423        composeStringExtras("resourceId", element.getResourceIdElement(), false);
41424      }
41425      if (element.hasVersionIdElement()) {
41426        composeStringCore("versionId", element.getVersionIdElement(), false);
41427        composeStringExtras("versionId", element.getVersionIdElement(), false);
41428      }
41429  }
41430
41431  protected void composeExampleScenarioExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
41432    if (element != null) {
41433      open(name);
41434      composeExampleScenarioExampleScenarioProcessComponentInner(element);
41435      close();
41436    }
41437  }
41438
41439  protected void composeExampleScenarioExampleScenarioProcessComponentInner(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
41440      composeBackbone(element);
41441      if (element.hasTitleElement()) {
41442        composeStringCore("title", element.getTitleElement(), false);
41443        composeStringExtras("title", element.getTitleElement(), false);
41444      }
41445      if (element.hasDescriptionElement()) {
41446        composeMarkdownCore("description", element.getDescriptionElement(), false);
41447        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41448      }
41449      if (element.hasPreConditionsElement()) {
41450        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
41451        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
41452      }
41453      if (element.hasPostConditionsElement()) {
41454        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
41455        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
41456      }
41457      if (element.hasStep()) {
41458        openArray("step");
41459        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
41460          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
41461        closeArray();
41462      };
41463  }
41464
41465  protected void composeExampleScenarioExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
41466    if (element != null) {
41467      open(name);
41468      composeExampleScenarioExampleScenarioProcessStepComponentInner(element);
41469      close();
41470    }
41471  }
41472
41473  protected void composeExampleScenarioExampleScenarioProcessStepComponentInner(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
41474      composeBackbone(element);
41475      if (element.hasProcess()) {
41476        openArray("process");
41477        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
41478          composeExampleScenarioExampleScenarioProcessComponent(null, e);
41479        closeArray();
41480      };
41481      if (element.hasPauseElement()) {
41482        composeBooleanCore("pause", element.getPauseElement(), false);
41483        composeBooleanExtras("pause", element.getPauseElement(), false);
41484      }
41485      if (element.hasOperation()) {
41486        composeExampleScenarioExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
41487      }
41488      if (element.hasAlternative()) {
41489        openArray("alternative");
41490        for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative()) 
41491          composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(null, e);
41492        closeArray();
41493      };
41494  }
41495
41496  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
41497    if (element != null) {
41498      open(name);
41499      composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(element);
41500      close();
41501    }
41502  }
41503
41504  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
41505      composeBackbone(element);
41506      if (element.hasNumberElement()) {
41507        composeStringCore("number", element.getNumberElement(), false);
41508        composeStringExtras("number", element.getNumberElement(), false);
41509      }
41510      if (element.hasTypeElement()) {
41511        composeStringCore("type", element.getTypeElement(), false);
41512        composeStringExtras("type", element.getTypeElement(), false);
41513      }
41514      if (element.hasNameElement()) {
41515        composeStringCore("name", element.getNameElement(), false);
41516        composeStringExtras("name", element.getNameElement(), false);
41517      }
41518      if (element.hasInitiatorElement()) {
41519        composeStringCore("initiator", element.getInitiatorElement(), false);
41520        composeStringExtras("initiator", element.getInitiatorElement(), false);
41521      }
41522      if (element.hasReceiverElement()) {
41523        composeStringCore("receiver", element.getReceiverElement(), false);
41524        composeStringExtras("receiver", element.getReceiverElement(), false);
41525      }
41526      if (element.hasDescriptionElement()) {
41527        composeMarkdownCore("description", element.getDescriptionElement(), false);
41528        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41529      }
41530      if (element.hasInitiatorActiveElement()) {
41531        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
41532        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
41533      }
41534      if (element.hasReceiverActiveElement()) {
41535        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
41536        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
41537      }
41538      if (element.hasRequest()) {
41539        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
41540      }
41541      if (element.hasResponse()) {
41542        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
41543      }
41544  }
41545
41546  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
41547    if (element != null) {
41548      open(name);
41549      composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(element);
41550      close();
41551    }
41552  }
41553
41554  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
41555      composeBackbone(element);
41556      if (element.hasTitleElement()) {
41557        composeStringCore("title", element.getTitleElement(), false);
41558        composeStringExtras("title", element.getTitleElement(), false);
41559      }
41560      if (element.hasDescriptionElement()) {
41561        composeMarkdownCore("description", element.getDescriptionElement(), false);
41562        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41563      }
41564      if (element.hasStep()) {
41565        openArray("step");
41566        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
41567          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
41568        closeArray();
41569      };
41570  }
41571
41572  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
41573    if (element != null) {
41574      prop("resourceType", name);
41575      composeExplanationOfBenefitInner(element);
41576    }
41577  }
41578
41579  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
41580      composeDomainResourceElements(element);
41581      if (element.hasIdentifier()) {
41582        openArray("identifier");
41583        for (Identifier e : element.getIdentifier()) 
41584          composeIdentifier(null, e);
41585        closeArray();
41586      };
41587      if (element.hasStatusElement()) {
41588        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
41589        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
41590      }
41591      if (element.hasType()) {
41592        composeCodeableConcept("type", element.getType());
41593      }
41594      if (element.hasSubType()) {
41595        composeCodeableConcept("subType", element.getSubType());
41596      }
41597      if (element.hasUseElement()) {
41598        composeEnumerationCore("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
41599        composeEnumerationExtras("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
41600      }
41601      if (element.hasPatient()) {
41602        composeReference("patient", element.getPatient());
41603      }
41604      if (element.hasBillablePeriod()) {
41605        composePeriod("billablePeriod", element.getBillablePeriod());
41606      }
41607      if (element.hasCreatedElement()) {
41608        composeDateTimeCore("created", element.getCreatedElement(), false);
41609        composeDateTimeExtras("created", element.getCreatedElement(), false);
41610      }
41611      if (element.hasEnterer()) {
41612        composeReference("enterer", element.getEnterer());
41613      }
41614      if (element.hasInsurer()) {
41615        composeReference("insurer", element.getInsurer());
41616      }
41617      if (element.hasProvider()) {
41618        composeReference("provider", element.getProvider());
41619      }
41620      if (element.hasPriority()) {
41621        composeCodeableConcept("priority", element.getPriority());
41622      }
41623      if (element.hasFundsReserveRequested()) {
41624        composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
41625      }
41626      if (element.hasFundsReserve()) {
41627        composeCodeableConcept("fundsReserve", element.getFundsReserve());
41628      }
41629      if (element.hasRelated()) {
41630        openArray("related");
41631        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
41632          composeExplanationOfBenefitRelatedClaimComponent(null, e);
41633        closeArray();
41634      };
41635      if (element.hasPrescription()) {
41636        composeReference("prescription", element.getPrescription());
41637      }
41638      if (element.hasOriginalPrescription()) {
41639        composeReference("originalPrescription", element.getOriginalPrescription());
41640      }
41641      if (element.hasPayee()) {
41642        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
41643      }
41644      if (element.hasReferral()) {
41645        composeReference("referral", element.getReferral());
41646      }
41647      if (element.hasFacility()) {
41648        composeReference("facility", element.getFacility());
41649      }
41650      if (element.hasClaim()) {
41651        composeReference("claim", element.getClaim());
41652      }
41653      if (element.hasClaimResponse()) {
41654        composeReference("claimResponse", element.getClaimResponse());
41655      }
41656      if (element.hasOutcomeElement()) {
41657        composeEnumerationCore("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
41658        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
41659      }
41660      if (element.hasDispositionElement()) {
41661        composeStringCore("disposition", element.getDispositionElement(), false);
41662        composeStringExtras("disposition", element.getDispositionElement(), false);
41663      }
41664      if (element.hasPreAuthRef()) {
41665        openArray("preAuthRef");
41666        for (StringType e : element.getPreAuthRef()) 
41667          composeStringCore(null, e, true);
41668        closeArray();
41669        if (anyHasExtras(element.getPreAuthRef())) {
41670          openArray("_preAuthRef");
41671          for (StringType e : element.getPreAuthRef()) 
41672            composeStringExtras(null, e, true);
41673        closeArray();
41674        }
41675      };
41676      if (element.hasPreAuthRefPeriod()) {
41677        openArray("preAuthRefPeriod");
41678        for (Period e : element.getPreAuthRefPeriod()) 
41679          composePeriod(null, e);
41680        closeArray();
41681      };
41682      if (element.hasCareTeam()) {
41683        openArray("careTeam");
41684        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
41685          composeExplanationOfBenefitCareTeamComponent(null, e);
41686        closeArray();
41687      };
41688      if (element.hasSupportingInfo()) {
41689        openArray("supportingInfo");
41690        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo()) 
41691          composeExplanationOfBenefitSupportingInformationComponent(null, e);
41692        closeArray();
41693      };
41694      if (element.hasDiagnosis()) {
41695        openArray("diagnosis");
41696        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
41697          composeExplanationOfBenefitDiagnosisComponent(null, e);
41698        closeArray();
41699      };
41700      if (element.hasProcedure()) {
41701        openArray("procedure");
41702        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
41703          composeExplanationOfBenefitProcedureComponent(null, e);
41704        closeArray();
41705      };
41706      if (element.hasPrecedenceElement()) {
41707        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
41708        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
41709      }
41710      if (element.hasInsurance()) {
41711        openArray("insurance");
41712        for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance()) 
41713          composeExplanationOfBenefitInsuranceComponent(null, e);
41714        closeArray();
41715      };
41716      if (element.hasAccident()) {
41717        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
41718      }
41719      if (element.hasItem()) {
41720        openArray("item");
41721        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
41722          composeExplanationOfBenefitItemComponent(null, e);
41723        closeArray();
41724      };
41725      if (element.hasAddItem()) {
41726        openArray("addItem");
41727        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
41728          composeExplanationOfBenefitAddedItemComponent(null, e);
41729        closeArray();
41730      };
41731      if (element.hasAdjudication()) {
41732        openArray("adjudication");
41733        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41734          composeExplanationOfBenefitAdjudicationComponent(null, e);
41735        closeArray();
41736      };
41737      if (element.hasTotal()) {
41738        openArray("total");
41739        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
41740          composeExplanationOfBenefitTotalComponent(null, e);
41741        closeArray();
41742      };
41743      if (element.hasPayment()) {
41744        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
41745      }
41746      if (element.hasFormCode()) {
41747        composeCodeableConcept("formCode", element.getFormCode());
41748      }
41749      if (element.hasForm()) {
41750        composeAttachment("form", element.getForm());
41751      }
41752      if (element.hasProcessNote()) {
41753        openArray("processNote");
41754        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
41755          composeExplanationOfBenefitNoteComponent(null, e);
41756        closeArray();
41757      };
41758      if (element.hasBenefitPeriod()) {
41759        composePeriod("benefitPeriod", element.getBenefitPeriod());
41760      }
41761      if (element.hasBenefitBalance()) {
41762        openArray("benefitBalance");
41763        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
41764          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
41765        closeArray();
41766      };
41767  }
41768
41769  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
41770    if (element != null) {
41771      open(name);
41772      composeExplanationOfBenefitRelatedClaimComponentInner(element);
41773      close();
41774    }
41775  }
41776
41777  protected void composeExplanationOfBenefitRelatedClaimComponentInner(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
41778      composeBackbone(element);
41779      if (element.hasClaim()) {
41780        composeReference("claim", element.getClaim());
41781      }
41782      if (element.hasRelationship()) {
41783        composeCodeableConcept("relationship", element.getRelationship());
41784      }
41785      if (element.hasReference()) {
41786        composeIdentifier("reference", element.getReference());
41787      }
41788  }
41789
41790  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
41791    if (element != null) {
41792      open(name);
41793      composeExplanationOfBenefitPayeeComponentInner(element);
41794      close();
41795    }
41796  }
41797
41798  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
41799      composeBackbone(element);
41800      if (element.hasType()) {
41801        composeCodeableConcept("type", element.getType());
41802      }
41803      if (element.hasParty()) {
41804        composeReference("party", element.getParty());
41805      }
41806  }
41807
41808  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
41809    if (element != null) {
41810      open(name);
41811      composeExplanationOfBenefitCareTeamComponentInner(element);
41812      close();
41813    }
41814  }
41815
41816  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
41817      composeBackbone(element);
41818      if (element.hasSequenceElement()) {
41819        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41820        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41821      }
41822      if (element.hasProvider()) {
41823        composeReference("provider", element.getProvider());
41824      }
41825      if (element.hasResponsibleElement()) {
41826        composeBooleanCore("responsible", element.getResponsibleElement(), false);
41827        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
41828      }
41829      if (element.hasRole()) {
41830        composeCodeableConcept("role", element.getRole());
41831      }
41832      if (element.hasQualification()) {
41833        composeCodeableConcept("qualification", element.getQualification());
41834      }
41835  }
41836
41837  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
41838    if (element != null) {
41839      open(name);
41840      composeExplanationOfBenefitSupportingInformationComponentInner(element);
41841      close();
41842    }
41843  }
41844
41845  protected void composeExplanationOfBenefitSupportingInformationComponentInner(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
41846      composeBackbone(element);
41847      if (element.hasSequenceElement()) {
41848        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41849        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41850      }
41851      if (element.hasCategory()) {
41852        composeCodeableConcept("category", element.getCategory());
41853      }
41854      if (element.hasCode()) {
41855        composeCodeableConcept("code", element.getCode());
41856      }
41857      if (element.hasTiming()) {
41858        composeType("timing", element.getTiming());
41859      }
41860      if (element.hasValue()) {
41861        composeType("value", element.getValue());
41862      }
41863      if (element.hasReason()) {
41864        composeCoding("reason", element.getReason());
41865      }
41866  }
41867
41868  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
41869    if (element != null) {
41870      open(name);
41871      composeExplanationOfBenefitDiagnosisComponentInner(element);
41872      close();
41873    }
41874  }
41875
41876  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
41877      composeBackbone(element);
41878      if (element.hasSequenceElement()) {
41879        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41880        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41881      }
41882      if (element.hasDiagnosis()) {
41883        composeType("diagnosis", element.getDiagnosis());
41884      }
41885      if (element.hasType()) {
41886        openArray("type");
41887        for (CodeableConcept e : element.getType()) 
41888          composeCodeableConcept(null, e);
41889        closeArray();
41890      };
41891      if (element.hasOnAdmission()) {
41892        composeCodeableConcept("onAdmission", element.getOnAdmission());
41893      }
41894      if (element.hasPackageCode()) {
41895        composeCodeableConcept("packageCode", element.getPackageCode());
41896      }
41897  }
41898
41899  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
41900    if (element != null) {
41901      open(name);
41902      composeExplanationOfBenefitProcedureComponentInner(element);
41903      close();
41904    }
41905  }
41906
41907  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
41908      composeBackbone(element);
41909      if (element.hasSequenceElement()) {
41910        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41911        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41912      }
41913      if (element.hasType()) {
41914        openArray("type");
41915        for (CodeableConcept e : element.getType()) 
41916          composeCodeableConcept(null, e);
41917        closeArray();
41918      };
41919      if (element.hasDateElement()) {
41920        composeDateTimeCore("date", element.getDateElement(), false);
41921        composeDateTimeExtras("date", element.getDateElement(), false);
41922      }
41923      if (element.hasProcedure()) {
41924        composeType("procedure", element.getProcedure());
41925      }
41926      if (element.hasUdi()) {
41927        openArray("udi");
41928        for (Reference e : element.getUdi()) 
41929          composeReference(null, e);
41930        closeArray();
41931      };
41932  }
41933
41934  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
41935    if (element != null) {
41936      open(name);
41937      composeExplanationOfBenefitInsuranceComponentInner(element);
41938      close();
41939    }
41940  }
41941
41942  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
41943      composeBackbone(element);
41944      if (element.hasFocalElement()) {
41945        composeBooleanCore("focal", element.getFocalElement(), false);
41946        composeBooleanExtras("focal", element.getFocalElement(), false);
41947      }
41948      if (element.hasCoverage()) {
41949        composeReference("coverage", element.getCoverage());
41950      }
41951      if (element.hasPreAuthRef()) {
41952        openArray("preAuthRef");
41953        for (StringType e : element.getPreAuthRef()) 
41954          composeStringCore(null, e, true);
41955        closeArray();
41956        if (anyHasExtras(element.getPreAuthRef())) {
41957          openArray("_preAuthRef");
41958          for (StringType e : element.getPreAuthRef()) 
41959            composeStringExtras(null, e, true);
41960          closeArray();
41961        }
41962      };
41963  }
41964
41965  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
41966    if (element != null) {
41967      open(name);
41968      composeExplanationOfBenefitAccidentComponentInner(element);
41969      close();
41970    }
41971  }
41972
41973  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element) throws IOException {
41974      composeBackbone(element);
41975      if (element.hasDateElement()) {
41976        composeDateCore("date", element.getDateElement(), false);
41977        composeDateExtras("date", element.getDateElement(), false);
41978      }
41979      if (element.hasType()) {
41980        composeCodeableConcept("type", element.getType());
41981      }
41982      if (element.hasLocation()) {
41983        composeType("location", element.getLocation());
41984      }
41985  }
41986
41987  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
41988    if (element != null) {
41989      open(name);
41990      composeExplanationOfBenefitItemComponentInner(element);
41991      close();
41992    }
41993  }
41994
41995  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element) throws IOException {
41996      composeBackbone(element);
41997      if (element.hasSequenceElement()) {
41998        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41999        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
42000      }
42001      if (element.hasCareTeamSequence()) {
42002        openArray("careTeamSequence");
42003        for (PositiveIntType e : element.getCareTeamSequence()) 
42004          composePositiveIntCore(null, e, true);
42005        closeArray();
42006        if (anyHasExtras(element.getCareTeamSequence())) {
42007          openArray("_careTeamSequence");
42008          for (PositiveIntType e : element.getCareTeamSequence()) 
42009            composePositiveIntExtras(null, e, true);
42010          closeArray();
42011        }
42012      };
42013      if (element.hasDiagnosisSequence()) {
42014        openArray("diagnosisSequence");
42015        for (PositiveIntType e : element.getDiagnosisSequence()) 
42016          composePositiveIntCore(null, e, true);
42017        closeArray();
42018        if (anyHasExtras(element.getDiagnosisSequence())) {
42019          openArray("_diagnosisSequence");
42020          for (PositiveIntType e : element.getDiagnosisSequence()) 
42021            composePositiveIntExtras(null, e, true);
42022          closeArray();
42023        }
42024      };
42025      if (element.hasProcedureSequence()) {
42026        openArray("procedureSequence");
42027        for (PositiveIntType e : element.getProcedureSequence()) 
42028          composePositiveIntCore(null, e, true);
42029        closeArray();
42030        if (anyHasExtras(element.getProcedureSequence())) {
42031          openArray("_procedureSequence");
42032          for (PositiveIntType e : element.getProcedureSequence()) 
42033            composePositiveIntExtras(null, e, true);
42034          closeArray();
42035        }
42036      };
42037      if (element.hasInformationSequence()) {
42038        openArray("informationSequence");
42039        for (PositiveIntType e : element.getInformationSequence()) 
42040          composePositiveIntCore(null, e, true);
42041        closeArray();
42042        if (anyHasExtras(element.getInformationSequence())) {
42043          openArray("_informationSequence");
42044          for (PositiveIntType e : element.getInformationSequence()) 
42045            composePositiveIntExtras(null, e, true);
42046          closeArray();
42047        }
42048      };
42049      if (element.hasRevenue()) {
42050        composeCodeableConcept("revenue", element.getRevenue());
42051      }
42052      if (element.hasCategory()) {
42053        composeCodeableConcept("category", element.getCategory());
42054      }
42055      if (element.hasProductOrService()) {
42056        composeCodeableConcept("productOrService", element.getProductOrService());
42057      }
42058      if (element.hasModifier()) {
42059        openArray("modifier");
42060        for (CodeableConcept e : element.getModifier()) 
42061          composeCodeableConcept(null, e);
42062        closeArray();
42063      };
42064      if (element.hasProgramCode()) {
42065        openArray("programCode");
42066        for (CodeableConcept e : element.getProgramCode()) 
42067          composeCodeableConcept(null, e);
42068        closeArray();
42069      };
42070      if (element.hasServiced()) {
42071        composeType("serviced", element.getServiced());
42072      }
42073      if (element.hasLocation()) {
42074        composeType("location", element.getLocation());
42075      }
42076      if (element.hasQuantity()) {
42077        composeQuantity("quantity", element.getQuantity());
42078      }
42079      if (element.hasUnitPrice()) {
42080        composeMoney("unitPrice", element.getUnitPrice());
42081      }
42082      if (element.hasFactorElement()) {
42083        composeDecimalCore("factor", element.getFactorElement(), false);
42084        composeDecimalExtras("factor", element.getFactorElement(), false);
42085      }
42086      if (element.hasNet()) {
42087        composeMoney("net", element.getNet());
42088      }
42089      if (element.hasUdi()) {
42090        openArray("udi");
42091        for (Reference e : element.getUdi()) 
42092          composeReference(null, e);
42093        closeArray();
42094      };
42095      if (element.hasBodySite()) {
42096        composeCodeableConcept("bodySite", element.getBodySite());
42097      }
42098      if (element.hasSubSite()) {
42099        openArray("subSite");
42100        for (CodeableConcept e : element.getSubSite()) 
42101          composeCodeableConcept(null, e);
42102        closeArray();
42103      };
42104      if (element.hasEncounter()) {
42105        openArray("encounter");
42106        for (Reference e : element.getEncounter()) 
42107          composeReference(null, e);
42108        closeArray();
42109      };
42110      if (element.hasNoteNumber()) {
42111        openArray("noteNumber");
42112        for (PositiveIntType e : element.getNoteNumber()) 
42113          composePositiveIntCore(null, e, true);
42114        closeArray();
42115        if (anyHasExtras(element.getNoteNumber())) {
42116          openArray("_noteNumber");
42117          for (PositiveIntType e : element.getNoteNumber()) 
42118            composePositiveIntExtras(null, e, true);
42119          closeArray();
42120        }
42121      };
42122      if (element.hasAdjudication()) {
42123        openArray("adjudication");
42124        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
42125          composeExplanationOfBenefitAdjudicationComponent(null, e);
42126        closeArray();
42127      };
42128      if (element.hasDetail()) {
42129        openArray("detail");
42130        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
42131          composeExplanationOfBenefitDetailComponent(null, e);
42132        closeArray();
42133      };
42134  }
42135
42136  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
42137    if (element != null) {
42138      open(name);
42139      composeExplanationOfBenefitAdjudicationComponentInner(element);
42140      close();
42141    }
42142  }
42143
42144  protected void composeExplanationOfBenefitAdjudicationComponentInner(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
42145      composeBackbone(element);
42146      if (element.hasCategory()) {
42147        composeCodeableConcept("category", element.getCategory());
42148      }
42149      if (element.hasReason()) {
42150        composeCodeableConcept("reason", element.getReason());
42151      }
42152      if (element.hasAmount()) {
42153        composeMoney("amount", element.getAmount());
42154      }
42155      if (element.hasValueElement()) {
42156        composeDecimalCore("value", element.getValueElement(), false);
42157        composeDecimalExtras("value", element.getValueElement(), false);
42158      }
42159  }
42160
42161  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
42162    if (element != null) {
42163      open(name);
42164      composeExplanationOfBenefitDetailComponentInner(element);
42165      close();
42166    }
42167  }
42168
42169  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
42170      composeBackbone(element);
42171      if (element.hasSequenceElement()) {
42172        composePositiveIntCore("sequence", element.getSequenceElement(), false);
42173        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
42174      }
42175      if (element.hasRevenue()) {
42176        composeCodeableConcept("revenue", element.getRevenue());
42177      }
42178      if (element.hasCategory()) {
42179        composeCodeableConcept("category", element.getCategory());
42180      }
42181      if (element.hasProductOrService()) {
42182        composeCodeableConcept("productOrService", element.getProductOrService());
42183      }
42184      if (element.hasModifier()) {
42185        openArray("modifier");
42186        for (CodeableConcept e : element.getModifier()) 
42187          composeCodeableConcept(null, e);
42188        closeArray();
42189      };
42190      if (element.hasProgramCode()) {
42191        openArray("programCode");
42192        for (CodeableConcept e : element.getProgramCode()) 
42193          composeCodeableConcept(null, e);
42194        closeArray();
42195      };
42196      if (element.hasQuantity()) {
42197        composeQuantity("quantity", element.getQuantity());
42198      }
42199      if (element.hasUnitPrice()) {
42200        composeMoney("unitPrice", element.getUnitPrice());
42201      }
42202      if (element.hasFactorElement()) {
42203        composeDecimalCore("factor", element.getFactorElement(), false);
42204        composeDecimalExtras("factor", element.getFactorElement(), false);
42205      }
42206      if (element.hasNet()) {
42207        composeMoney("net", element.getNet());
42208      }
42209      if (element.hasUdi()) {
42210        openArray("udi");
42211        for (Reference e : element.getUdi()) 
42212          composeReference(null, e);
42213        closeArray();
42214      };
42215      if (element.hasNoteNumber()) {
42216        openArray("noteNumber");
42217        for (PositiveIntType e : element.getNoteNumber()) 
42218          composePositiveIntCore(null, e, true);
42219        closeArray();
42220        if (anyHasExtras(element.getNoteNumber())) {
42221          openArray("_noteNumber");
42222          for (PositiveIntType e : element.getNoteNumber()) 
42223            composePositiveIntExtras(null, e, true);
42224          closeArray();
42225        }
42226      };
42227      if (element.hasAdjudication()) {
42228        openArray("adjudication");
42229        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
42230          composeExplanationOfBenefitAdjudicationComponent(null, e);
42231        closeArray();
42232      };
42233      if (element.hasSubDetail()) {
42234        openArray("subDetail");
42235        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
42236          composeExplanationOfBenefitSubDetailComponent(null, e);
42237        closeArray();
42238      };
42239  }
42240
42241  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
42242    if (element != null) {
42243      open(name);
42244      composeExplanationOfBenefitSubDetailComponentInner(element);
42245      close();
42246    }
42247  }
42248
42249  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
42250      composeBackbone(element);
42251      if (element.hasSequenceElement()) {
42252        composePositiveIntCore("sequence", element.getSequenceElement(), false);
42253        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
42254      }
42255      if (element.hasRevenue()) {
42256        composeCodeableConcept("revenue", element.getRevenue());
42257      }
42258      if (element.hasCategory()) {
42259        composeCodeableConcept("category", element.getCategory());
42260      }
42261      if (element.hasProductOrService()) {
42262        composeCodeableConcept("productOrService", element.getProductOrService());
42263      }
42264      if (element.hasModifier()) {
42265        openArray("modifier");
42266        for (CodeableConcept e : element.getModifier()) 
42267          composeCodeableConcept(null, e);
42268        closeArray();
42269      };
42270      if (element.hasProgramCode()) {
42271        openArray("programCode");
42272        for (CodeableConcept e : element.getProgramCode()) 
42273          composeCodeableConcept(null, e);
42274        closeArray();
42275      };
42276      if (element.hasQuantity()) {
42277        composeQuantity("quantity", element.getQuantity());
42278      }
42279      if (element.hasUnitPrice()) {
42280        composeMoney("unitPrice", element.getUnitPrice());
42281      }
42282      if (element.hasFactorElement()) {
42283        composeDecimalCore("factor", element.getFactorElement(), false);
42284        composeDecimalExtras("factor", element.getFactorElement(), false);
42285      }
42286      if (element.hasNet()) {
42287        composeMoney("net", element.getNet());
42288      }
42289      if (element.hasUdi()) {
42290        openArray("udi");
42291        for (Reference e : element.getUdi()) 
42292          composeReference(null, e);
42293        closeArray();
42294      };
42295      if (element.hasNoteNumber()) {
42296        openArray("noteNumber");
42297        for (PositiveIntType e : element.getNoteNumber()) 
42298          composePositiveIntCore(null, e, true);
42299        closeArray();
42300        if (anyHasExtras(element.getNoteNumber())) {
42301          openArray("_noteNumber");
42302          for (PositiveIntType e : element.getNoteNumber()) 
42303            composePositiveIntExtras(null, e, true);
42304          closeArray();
42305        }
42306      };
42307      if (element.hasAdjudication()) {
42308        openArray("adjudication");
42309        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
42310          composeExplanationOfBenefitAdjudicationComponent(null, e);
42311        closeArray();
42312      };
42313  }
42314
42315  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
42316    if (element != null) {
42317      open(name);
42318      composeExplanationOfBenefitAddedItemComponentInner(element);
42319      close();
42320    }
42321  }
42322
42323  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
42324      composeBackbone(element);
42325      if (element.hasItemSequence()) {
42326        openArray("itemSequence");
42327        for (PositiveIntType e : element.getItemSequence()) 
42328          composePositiveIntCore(null, e, true);
42329        closeArray();
42330        if (anyHasExtras(element.getItemSequence())) {
42331          openArray("_itemSequence");
42332          for (PositiveIntType e : element.getItemSequence()) 
42333            composePositiveIntExtras(null, e, true);
42334          closeArray();
42335        }
42336      };
42337      if (element.hasDetailSequence()) {
42338        openArray("detailSequence");
42339        for (PositiveIntType e : element.getDetailSequence()) 
42340          composePositiveIntCore(null, e, true);
42341        closeArray();
42342        if (anyHasExtras(element.getDetailSequence())) {
42343          openArray("_detailSequence");
42344          for (PositiveIntType e : element.getDetailSequence()) 
42345            composePositiveIntExtras(null, e, true);
42346          closeArray();
42347        }
42348      };
42349      if (element.hasSubDetailSequence()) {
42350        openArray("subDetailSequence");
42351        for (PositiveIntType e : element.getSubDetailSequence()) 
42352          composePositiveIntCore(null, e, true);
42353        closeArray();
42354        if (anyHasExtras(element.getSubDetailSequence())) {
42355          openArray("_subDetailSequence");
42356          for (PositiveIntType e : element.getSubDetailSequence()) 
42357            composePositiveIntExtras(null, e, true);
42358          closeArray();
42359        }
42360      };
42361      if (element.hasProvider()) {
42362        openArray("provider");
42363        for (Reference e : element.getProvider()) 
42364          composeReference(null, e);
42365        closeArray();
42366      };
42367      if (element.hasProductOrService()) {
42368        composeCodeableConcept("productOrService", element.getProductOrService());
42369      }
42370      if (element.hasModifier()) {
42371        openArray("modifier");
42372        for (CodeableConcept e : element.getModifier()) 
42373          composeCodeableConcept(null, e);
42374        closeArray();
42375      };
42376      if (element.hasProgramCode()) {
42377        openArray("programCode");
42378        for (CodeableConcept e : element.getProgramCode()) 
42379          composeCodeableConcept(null, e);
42380        closeArray();
42381      };
42382      if (element.hasServiced()) {
42383        composeType("serviced", element.getServiced());
42384      }
42385      if (element.hasLocation()) {
42386        composeType("location", element.getLocation());
42387      }
42388      if (element.hasQuantity()) {
42389        composeQuantity("quantity", element.getQuantity());
42390      }
42391      if (element.hasUnitPrice()) {
42392        composeMoney("unitPrice", element.getUnitPrice());
42393      }
42394      if (element.hasFactorElement()) {
42395        composeDecimalCore("factor", element.getFactorElement(), false);
42396        composeDecimalExtras("factor", element.getFactorElement(), false);
42397      }
42398      if (element.hasNet()) {
42399        composeMoney("net", element.getNet());
42400      }
42401      if (element.hasBodySite()) {
42402        composeCodeableConcept("bodySite", element.getBodySite());
42403      }
42404      if (element.hasSubSite()) {
42405        openArray("subSite");
42406        for (CodeableConcept e : element.getSubSite()) 
42407          composeCodeableConcept(null, e);
42408        closeArray();
42409      };
42410      if (element.hasNoteNumber()) {
42411        openArray("noteNumber");
42412        for (PositiveIntType e : element.getNoteNumber()) 
42413          composePositiveIntCore(null, e, true);
42414        closeArray();
42415        if (anyHasExtras(element.getNoteNumber())) {
42416          openArray("_noteNumber");
42417          for (PositiveIntType e : element.getNoteNumber()) 
42418            composePositiveIntExtras(null, e, true);
42419          closeArray();
42420        }
42421      };
42422      if (element.hasAdjudication()) {
42423        openArray("adjudication");
42424        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
42425          composeExplanationOfBenefitAdjudicationComponent(null, e);
42426        closeArray();
42427      };
42428      if (element.hasDetail()) {
42429        openArray("detail");
42430        for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail()) 
42431          composeExplanationOfBenefitAddedItemDetailComponent(null, e);
42432        closeArray();
42433      };
42434  }
42435
42436  protected void composeExplanationOfBenefitAddedItemDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
42437    if (element != null) {
42438      open(name);
42439      composeExplanationOfBenefitAddedItemDetailComponentInner(element);
42440      close();
42441    }
42442  }
42443
42444  protected void composeExplanationOfBenefitAddedItemDetailComponentInner(ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
42445      composeBackbone(element);
42446      if (element.hasProductOrService()) {
42447        composeCodeableConcept("productOrService", element.getProductOrService());
42448      }
42449      if (element.hasModifier()) {
42450        openArray("modifier");
42451        for (CodeableConcept e : element.getModifier()) 
42452          composeCodeableConcept(null, e);
42453        closeArray();
42454      };
42455      if (element.hasQuantity()) {
42456        composeQuantity("quantity", element.getQuantity());
42457      }
42458      if (element.hasUnitPrice()) {
42459        composeMoney("unitPrice", element.getUnitPrice());
42460      }
42461      if (element.hasFactorElement()) {
42462        composeDecimalCore("factor", element.getFactorElement(), false);
42463        composeDecimalExtras("factor", element.getFactorElement(), false);
42464      }
42465      if (element.hasNet()) {
42466        composeMoney("net", element.getNet());
42467      }
42468      if (element.hasNoteNumber()) {
42469        openArray("noteNumber");
42470        for (PositiveIntType e : element.getNoteNumber()) 
42471          composePositiveIntCore(null, e, true);
42472        closeArray();
42473        if (anyHasExtras(element.getNoteNumber())) {
42474          openArray("_noteNumber");
42475          for (PositiveIntType e : element.getNoteNumber()) 
42476            composePositiveIntExtras(null, e, true);
42477          closeArray();
42478        }
42479      };
42480      if (element.hasAdjudication()) {
42481        openArray("adjudication");
42482        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
42483          composeExplanationOfBenefitAdjudicationComponent(null, e);
42484        closeArray();
42485      };
42486      if (element.hasSubDetail()) {
42487        openArray("subDetail");
42488        for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail()) 
42489          composeExplanationOfBenefitAddedItemDetailSubDetailComponent(null, e);
42490        closeArray();
42491      };
42492  }
42493
42494  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
42495    if (element != null) {
42496      open(name);
42497      composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(element);
42498      close();
42499    }
42500  }
42501
42502  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
42503      composeBackbone(element);
42504      if (element.hasProductOrService()) {
42505        composeCodeableConcept("productOrService", element.getProductOrService());
42506      }
42507      if (element.hasModifier()) {
42508        openArray("modifier");
42509        for (CodeableConcept e : element.getModifier()) 
42510          composeCodeableConcept(null, e);
42511        closeArray();
42512      };
42513      if (element.hasQuantity()) {
42514        composeQuantity("quantity", element.getQuantity());
42515      }
42516      if (element.hasUnitPrice()) {
42517        composeMoney("unitPrice", element.getUnitPrice());
42518      }
42519      if (element.hasFactorElement()) {
42520        composeDecimalCore("factor", element.getFactorElement(), false);
42521        composeDecimalExtras("factor", element.getFactorElement(), false);
42522      }
42523      if (element.hasNet()) {
42524        composeMoney("net", element.getNet());
42525      }
42526      if (element.hasNoteNumber()) {
42527        openArray("noteNumber");
42528        for (PositiveIntType e : element.getNoteNumber()) 
42529          composePositiveIntCore(null, e, true);
42530        closeArray();
42531        if (anyHasExtras(element.getNoteNumber())) {
42532          openArray("_noteNumber");
42533          for (PositiveIntType e : element.getNoteNumber()) 
42534            composePositiveIntExtras(null, e, true);
42535          closeArray();
42536        }
42537      };
42538      if (element.hasAdjudication()) {
42539        openArray("adjudication");
42540        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
42541          composeExplanationOfBenefitAdjudicationComponent(null, e);
42542        closeArray();
42543      };
42544  }
42545
42546  protected void composeExplanationOfBenefitTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
42547    if (element != null) {
42548      open(name);
42549      composeExplanationOfBenefitTotalComponentInner(element);
42550      close();
42551    }
42552  }
42553
42554  protected void composeExplanationOfBenefitTotalComponentInner(ExplanationOfBenefit.TotalComponent element) throws IOException {
42555      composeBackbone(element);
42556      if (element.hasCategory()) {
42557        composeCodeableConcept("category", element.getCategory());
42558      }
42559      if (element.hasAmount()) {
42560        composeMoney("amount", element.getAmount());
42561      }
42562  }
42563
42564  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
42565    if (element != null) {
42566      open(name);
42567      composeExplanationOfBenefitPaymentComponentInner(element);
42568      close();
42569    }
42570  }
42571
42572  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element) throws IOException {
42573      composeBackbone(element);
42574      if (element.hasType()) {
42575        composeCodeableConcept("type", element.getType());
42576      }
42577      if (element.hasAdjustment()) {
42578        composeMoney("adjustment", element.getAdjustment());
42579      }
42580      if (element.hasAdjustmentReason()) {
42581        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
42582      }
42583      if (element.hasDateElement()) {
42584        composeDateCore("date", element.getDateElement(), false);
42585        composeDateExtras("date", element.getDateElement(), false);
42586      }
42587      if (element.hasAmount()) {
42588        composeMoney("amount", element.getAmount());
42589      }
42590      if (element.hasIdentifier()) {
42591        composeIdentifier("identifier", element.getIdentifier());
42592      }
42593  }
42594
42595  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
42596    if (element != null) {
42597      open(name);
42598      composeExplanationOfBenefitNoteComponentInner(element);
42599      close();
42600    }
42601  }
42602
42603  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element) throws IOException {
42604      composeBackbone(element);
42605      if (element.hasNumberElement()) {
42606        composePositiveIntCore("number", element.getNumberElement(), false);
42607        composePositiveIntExtras("number", element.getNumberElement(), false);
42608      }
42609      if (element.hasTypeElement()) {
42610        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
42611        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
42612      }
42613      if (element.hasTextElement()) {
42614        composeStringCore("text", element.getTextElement(), false);
42615        composeStringExtras("text", element.getTextElement(), false);
42616      }
42617      if (element.hasLanguage()) {
42618        composeCodeableConcept("language", element.getLanguage());
42619      }
42620  }
42621
42622  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
42623    if (element != null) {
42624      open(name);
42625      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
42626      close();
42627    }
42628  }
42629
42630  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
42631      composeBackbone(element);
42632      if (element.hasCategory()) {
42633        composeCodeableConcept("category", element.getCategory());
42634      }
42635      if (element.hasExcludedElement()) {
42636        composeBooleanCore("excluded", element.getExcludedElement(), false);
42637        composeBooleanExtras("excluded", element.getExcludedElement(), false);
42638      }
42639      if (element.hasNameElement()) {
42640        composeStringCore("name", element.getNameElement(), false);
42641        composeStringExtras("name", element.getNameElement(), false);
42642      }
42643      if (element.hasDescriptionElement()) {
42644        composeStringCore("description", element.getDescriptionElement(), false);
42645        composeStringExtras("description", element.getDescriptionElement(), false);
42646      }
42647      if (element.hasNetwork()) {
42648        composeCodeableConcept("network", element.getNetwork());
42649      }
42650      if (element.hasUnit()) {
42651        composeCodeableConcept("unit", element.getUnit());
42652      }
42653      if (element.hasTerm()) {
42654        composeCodeableConcept("term", element.getTerm());
42655      }
42656      if (element.hasFinancial()) {
42657        openArray("financial");
42658        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
42659          composeExplanationOfBenefitBenefitComponent(null, e);
42660        closeArray();
42661      };
42662  }
42663
42664  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
42665    if (element != null) {
42666      open(name);
42667      composeExplanationOfBenefitBenefitComponentInner(element);
42668      close();
42669    }
42670  }
42671
42672  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
42673      composeBackbone(element);
42674      if (element.hasType()) {
42675        composeCodeableConcept("type", element.getType());
42676      }
42677      if (element.hasAllowed()) {
42678        composeType("allowed", element.getAllowed());
42679      }
42680      if (element.hasUsed()) {
42681        composeType("used", element.getUsed());
42682      }
42683  }
42684
42685  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
42686    if (element != null) {
42687      prop("resourceType", name);
42688      composeFamilyMemberHistoryInner(element);
42689    }
42690  }
42691
42692  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
42693      composeDomainResourceElements(element);
42694      if (element.hasIdentifier()) {
42695        openArray("identifier");
42696        for (Identifier e : element.getIdentifier()) 
42697          composeIdentifier(null, e);
42698        closeArray();
42699      };
42700      if (element.hasInstantiatesCanonical()) {
42701        openArray("instantiatesCanonical");
42702        for (CanonicalType e : element.getInstantiatesCanonical()) 
42703          composeCanonicalCore(null, e, true);
42704        closeArray();
42705        if (anyHasExtras(element.getInstantiatesCanonical())) {
42706          openArray("_instantiatesCanonical");
42707          for (CanonicalType e : element.getInstantiatesCanonical()) 
42708            composeCanonicalExtras(null, e, true);
42709          closeArray();
42710        }
42711      };
42712      if (element.hasInstantiatesUri()) {
42713        openArray("instantiatesUri");
42714        for (UriType e : element.getInstantiatesUri()) 
42715          composeUriCore(null, e, true);
42716        closeArray();
42717        if (anyHasExtras(element.getInstantiatesUri())) {
42718          openArray("_instantiatesUri");
42719          for (UriType e : element.getInstantiatesUri()) 
42720            composeUriExtras(null, e, true);
42721          closeArray();
42722        }
42723      };
42724      if (element.hasStatusElement()) {
42725        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
42726        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
42727      }
42728      if (element.hasDataAbsentReason()) {
42729        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
42730      }
42731      if (element.hasPatient()) {
42732        composeReference("patient", element.getPatient());
42733      }
42734      if (element.hasDateElement()) {
42735        composeDateTimeCore("date", element.getDateElement(), false);
42736        composeDateTimeExtras("date", element.getDateElement(), false);
42737      }
42738      if (element.hasNameElement()) {
42739        composeStringCore("name", element.getNameElement(), false);
42740        composeStringExtras("name", element.getNameElement(), false);
42741      }
42742      if (element.hasRelationship()) {
42743        composeCodeableConcept("relationship", element.getRelationship());
42744      }
42745      if (element.hasSex()) {
42746        composeCodeableConcept("sex", element.getSex());
42747      }
42748      if (element.hasBorn()) {
42749        composeType("born", element.getBorn());
42750      }
42751      if (element.hasAge()) {
42752        composeType("age", element.getAge());
42753      }
42754      if (element.hasEstimatedAgeElement()) {
42755        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
42756        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
42757      }
42758      if (element.hasDeceased()) {
42759        composeType("deceased", element.getDeceased());
42760      }
42761      if (element.hasReasonCode()) {
42762        openArray("reasonCode");
42763        for (CodeableConcept e : element.getReasonCode()) 
42764          composeCodeableConcept(null, e);
42765        closeArray();
42766      };
42767      if (element.hasReasonReference()) {
42768        openArray("reasonReference");
42769        for (Reference e : element.getReasonReference()) 
42770          composeReference(null, e);
42771        closeArray();
42772      };
42773      if (element.hasNote()) {
42774        openArray("note");
42775        for (Annotation e : element.getNote()) 
42776          composeAnnotation(null, e);
42777        closeArray();
42778      };
42779      if (element.hasCondition()) {
42780        openArray("condition");
42781        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
42782          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
42783        closeArray();
42784      };
42785  }
42786
42787  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
42788    if (element != null) {
42789      open(name);
42790      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
42791      close();
42792    }
42793  }
42794
42795  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
42796      composeBackbone(element);
42797      if (element.hasCode()) {
42798        composeCodeableConcept("code", element.getCode());
42799      }
42800      if (element.hasOutcome()) {
42801        composeCodeableConcept("outcome", element.getOutcome());
42802      }
42803      if (element.hasContributedToDeathElement()) {
42804        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
42805        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
42806      }
42807      if (element.hasOnset()) {
42808        composeType("onset", element.getOnset());
42809      }
42810      if (element.hasNote()) {
42811        openArray("note");
42812        for (Annotation e : element.getNote()) 
42813          composeAnnotation(null, e);
42814        closeArray();
42815      };
42816  }
42817
42818  protected void composeFlag(String name, Flag element) throws IOException {
42819    if (element != null) {
42820      prop("resourceType", name);
42821      composeFlagInner(element);
42822    }
42823  }
42824
42825  protected void composeFlagInner(Flag element) throws IOException {
42826      composeDomainResourceElements(element);
42827      if (element.hasIdentifier()) {
42828        openArray("identifier");
42829        for (Identifier e : element.getIdentifier()) 
42830          composeIdentifier(null, e);
42831        closeArray();
42832      };
42833      if (element.hasStatusElement()) {
42834        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
42835        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
42836      }
42837      if (element.hasCategory()) {
42838        openArray("category");
42839        for (CodeableConcept e : element.getCategory()) 
42840          composeCodeableConcept(null, e);
42841        closeArray();
42842      };
42843      if (element.hasCode()) {
42844        composeCodeableConcept("code", element.getCode());
42845      }
42846      if (element.hasSubject()) {
42847        composeReference("subject", element.getSubject());
42848      }
42849      if (element.hasPeriod()) {
42850        composePeriod("period", element.getPeriod());
42851      }
42852      if (element.hasEncounter()) {
42853        composeReference("encounter", element.getEncounter());
42854      }
42855      if (element.hasAuthor()) {
42856        composeReference("author", element.getAuthor());
42857      }
42858  }
42859
42860  protected void composeGoal(String name, Goal element) throws IOException {
42861    if (element != null) {
42862      prop("resourceType", name);
42863      composeGoalInner(element);
42864    }
42865  }
42866
42867  protected void composeGoalInner(Goal element) throws IOException {
42868      composeDomainResourceElements(element);
42869      if (element.hasIdentifier()) {
42870        openArray("identifier");
42871        for (Identifier e : element.getIdentifier()) 
42872          composeIdentifier(null, e);
42873        closeArray();
42874      };
42875      if (element.hasLifecycleStatusElement()) {
42876        composeEnumerationCore("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
42877        composeEnumerationExtras("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
42878      }
42879      if (element.hasAchievementStatus()) {
42880        composeCodeableConcept("achievementStatus", element.getAchievementStatus());
42881      }
42882      if (element.hasCategory()) {
42883        openArray("category");
42884        for (CodeableConcept e : element.getCategory()) 
42885          composeCodeableConcept(null, e);
42886        closeArray();
42887      };
42888      if (element.hasPriority()) {
42889        composeCodeableConcept("priority", element.getPriority());
42890      }
42891      if (element.hasDescription()) {
42892        composeCodeableConcept("description", element.getDescription());
42893      }
42894      if (element.hasSubject()) {
42895        composeReference("subject", element.getSubject());
42896      }
42897      if (element.hasStart()) {
42898        composeType("start", element.getStart());
42899      }
42900      if (element.hasTarget()) {
42901        openArray("target");
42902        for (Goal.GoalTargetComponent e : element.getTarget()) 
42903          composeGoalGoalTargetComponent(null, e);
42904        closeArray();
42905      };
42906      if (element.hasStatusDateElement()) {
42907        composeDateCore("statusDate", element.getStatusDateElement(), false);
42908        composeDateExtras("statusDate", element.getStatusDateElement(), false);
42909      }
42910      if (element.hasStatusReasonElement()) {
42911        composeStringCore("statusReason", element.getStatusReasonElement(), false);
42912        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
42913      }
42914      if (element.hasExpressedBy()) {
42915        composeReference("expressedBy", element.getExpressedBy());
42916      }
42917      if (element.hasAddresses()) {
42918        openArray("addresses");
42919        for (Reference e : element.getAddresses()) 
42920          composeReference(null, e);
42921        closeArray();
42922      };
42923      if (element.hasNote()) {
42924        openArray("note");
42925        for (Annotation e : element.getNote()) 
42926          composeAnnotation(null, e);
42927        closeArray();
42928      };
42929      if (element.hasOutcomeCode()) {
42930        openArray("outcomeCode");
42931        for (CodeableConcept e : element.getOutcomeCode()) 
42932          composeCodeableConcept(null, e);
42933        closeArray();
42934      };
42935      if (element.hasOutcomeReference()) {
42936        openArray("outcomeReference");
42937        for (Reference e : element.getOutcomeReference()) 
42938          composeReference(null, e);
42939        closeArray();
42940      };
42941  }
42942
42943  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
42944    if (element != null) {
42945      open(name);
42946      composeGoalGoalTargetComponentInner(element);
42947      close();
42948    }
42949  }
42950
42951  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
42952      composeBackbone(element);
42953      if (element.hasMeasure()) {
42954        composeCodeableConcept("measure", element.getMeasure());
42955      }
42956      if (element.hasDetail()) {
42957        composeType("detail", element.getDetail());
42958      }
42959      if (element.hasDue()) {
42960        composeType("due", element.getDue());
42961      }
42962  }
42963
42964  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
42965    if (element != null) {
42966      prop("resourceType", name);
42967      composeGraphDefinitionInner(element);
42968    }
42969  }
42970
42971  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
42972      composeDomainResourceElements(element);
42973      if (element.hasUrlElement()) {
42974        composeUriCore("url", element.getUrlElement(), false);
42975        composeUriExtras("url", element.getUrlElement(), false);
42976      }
42977      if (element.hasVersionElement()) {
42978        composeStringCore("version", element.getVersionElement(), false);
42979        composeStringExtras("version", element.getVersionElement(), false);
42980      }
42981      if (element.hasNameElement()) {
42982        composeStringCore("name", element.getNameElement(), false);
42983        composeStringExtras("name", element.getNameElement(), false);
42984      }
42985      if (element.hasStatusElement()) {
42986        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42987        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42988      }
42989      if (element.hasExperimentalElement()) {
42990        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42991        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42992      }
42993      if (element.hasDateElement()) {
42994        composeDateTimeCore("date", element.getDateElement(), false);
42995        composeDateTimeExtras("date", element.getDateElement(), false);
42996      }
42997      if (element.hasPublisherElement()) {
42998        composeStringCore("publisher", element.getPublisherElement(), false);
42999        composeStringExtras("publisher", element.getPublisherElement(), false);
43000      }
43001      if (element.hasContact()) {
43002        openArray("contact");
43003        for (ContactDetail e : element.getContact()) 
43004          composeContactDetail(null, e);
43005        closeArray();
43006      };
43007      if (element.hasDescriptionElement()) {
43008        composeMarkdownCore("description", element.getDescriptionElement(), false);
43009        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43010      }
43011      if (element.hasUseContext()) {
43012        openArray("useContext");
43013        for (UsageContext e : element.getUseContext()) 
43014          composeUsageContext(null, e);
43015        closeArray();
43016      };
43017      if (element.hasJurisdiction()) {
43018        openArray("jurisdiction");
43019        for (CodeableConcept e : element.getJurisdiction()) 
43020          composeCodeableConcept(null, e);
43021        closeArray();
43022      };
43023      if (element.hasPurposeElement()) {
43024        composeMarkdownCore("purpose", element.getPurposeElement(), false);
43025        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
43026      }
43027      if (element.hasStartElement()) {
43028        composeCodeCore("start", element.getStartElement(), false);
43029        composeCodeExtras("start", element.getStartElement(), false);
43030      }
43031      if (element.hasProfileElement()) {
43032        composeCanonicalCore("profile", element.getProfileElement(), false);
43033        composeCanonicalExtras("profile", element.getProfileElement(), false);
43034      }
43035      if (element.hasLink()) {
43036        openArray("link");
43037        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
43038          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
43039        closeArray();
43040      };
43041  }
43042
43043  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
43044    if (element != null) {
43045      open(name);
43046      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
43047      close();
43048    }
43049  }
43050
43051  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
43052      composeBackbone(element);
43053      if (element.hasPathElement()) {
43054        composeStringCore("path", element.getPathElement(), false);
43055        composeStringExtras("path", element.getPathElement(), false);
43056      }
43057      if (element.hasSliceNameElement()) {
43058        composeStringCore("sliceName", element.getSliceNameElement(), false);
43059        composeStringExtras("sliceName", element.getSliceNameElement(), false);
43060      }
43061      if (element.hasMinElement()) {
43062        composeIntegerCore("min", element.getMinElement(), false);
43063        composeIntegerExtras("min", element.getMinElement(), false);
43064      }
43065      if (element.hasMaxElement()) {
43066        composeStringCore("max", element.getMaxElement(), false);
43067        composeStringExtras("max", element.getMaxElement(), false);
43068      }
43069      if (element.hasDescriptionElement()) {
43070        composeStringCore("description", element.getDescriptionElement(), false);
43071        composeStringExtras("description", element.getDescriptionElement(), false);
43072      }
43073      if (element.hasTarget()) {
43074        openArray("target");
43075        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
43076          composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
43077        closeArray();
43078      };
43079  }
43080
43081  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
43082    if (element != null) {
43083      open(name);
43084      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
43085      close();
43086    }
43087  }
43088
43089  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
43090      composeBackbone(element);
43091      if (element.hasTypeElement()) {
43092        composeCodeCore("type", element.getTypeElement(), false);
43093        composeCodeExtras("type", element.getTypeElement(), false);
43094      }
43095      if (element.hasParamsElement()) {
43096        composeStringCore("params", element.getParamsElement(), false);
43097        composeStringExtras("params", element.getParamsElement(), false);
43098      }
43099      if (element.hasProfileElement()) {
43100        composeCanonicalCore("profile", element.getProfileElement(), false);
43101        composeCanonicalExtras("profile", element.getProfileElement(), false);
43102      }
43103      if (element.hasCompartment()) {
43104        openArray("compartment");
43105        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
43106          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
43107        closeArray();
43108      };
43109      if (element.hasLink()) {
43110        openArray("link");
43111        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
43112          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
43113        closeArray();
43114      };
43115  }
43116
43117  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
43118    if (element != null) {
43119      open(name);
43120      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
43121      close();
43122    }
43123  }
43124
43125  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
43126      composeBackbone(element);
43127      if (element.hasUseElement()) {
43128        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
43129        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
43130      }
43131      if (element.hasCodeElement()) {
43132        composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
43133        composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
43134      }
43135      if (element.hasRuleElement()) {
43136        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
43137        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
43138      }
43139      if (element.hasExpressionElement()) {
43140        composeStringCore("expression", element.getExpressionElement(), false);
43141        composeStringExtras("expression", element.getExpressionElement(), false);
43142      }
43143      if (element.hasDescriptionElement()) {
43144        composeStringCore("description", element.getDescriptionElement(), false);
43145        composeStringExtras("description", element.getDescriptionElement(), false);
43146      }
43147  }
43148
43149  protected void composeGroup(String name, Group element) throws IOException {
43150    if (element != null) {
43151      prop("resourceType", name);
43152      composeGroupInner(element);
43153    }
43154  }
43155
43156  protected void composeGroupInner(Group element) throws IOException {
43157      composeDomainResourceElements(element);
43158      if (element.hasIdentifier()) {
43159        openArray("identifier");
43160        for (Identifier e : element.getIdentifier()) 
43161          composeIdentifier(null, e);
43162        closeArray();
43163      };
43164      if (element.hasActiveElement()) {
43165        composeBooleanCore("active", element.getActiveElement(), false);
43166        composeBooleanExtras("active", element.getActiveElement(), false);
43167      }
43168      if (element.hasTypeElement()) {
43169        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
43170        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
43171      }
43172      if (element.hasActualElement()) {
43173        composeBooleanCore("actual", element.getActualElement(), false);
43174        composeBooleanExtras("actual", element.getActualElement(), false);
43175      }
43176      if (element.hasCode()) {
43177        composeCodeableConcept("code", element.getCode());
43178      }
43179      if (element.hasNameElement()) {
43180        composeStringCore("name", element.getNameElement(), false);
43181        composeStringExtras("name", element.getNameElement(), false);
43182      }
43183      if (element.hasQuantityElement()) {
43184        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
43185        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
43186      }
43187      if (element.hasManagingEntity()) {
43188        composeReference("managingEntity", element.getManagingEntity());
43189      }
43190      if (element.hasCharacteristic()) {
43191        openArray("characteristic");
43192        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
43193          composeGroupGroupCharacteristicComponent(null, e);
43194        closeArray();
43195      };
43196      if (element.hasMember()) {
43197        openArray("member");
43198        for (Group.GroupMemberComponent e : element.getMember()) 
43199          composeGroupGroupMemberComponent(null, e);
43200        closeArray();
43201      };
43202  }
43203
43204  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
43205    if (element != null) {
43206      open(name);
43207      composeGroupGroupCharacteristicComponentInner(element);
43208      close();
43209    }
43210  }
43211
43212  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
43213      composeBackbone(element);
43214      if (element.hasCode()) {
43215        composeCodeableConcept("code", element.getCode());
43216      }
43217      if (element.hasValue()) {
43218        composeType("value", element.getValue());
43219      }
43220      if (element.hasExcludeElement()) {
43221        composeBooleanCore("exclude", element.getExcludeElement(), false);
43222        composeBooleanExtras("exclude", element.getExcludeElement(), false);
43223      }
43224      if (element.hasPeriod()) {
43225        composePeriod("period", element.getPeriod());
43226      }
43227  }
43228
43229  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
43230    if (element != null) {
43231      open(name);
43232      composeGroupGroupMemberComponentInner(element);
43233      close();
43234    }
43235  }
43236
43237  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
43238      composeBackbone(element);
43239      if (element.hasEntity()) {
43240        composeReference("entity", element.getEntity());
43241      }
43242      if (element.hasPeriod()) {
43243        composePeriod("period", element.getPeriod());
43244      }
43245      if (element.hasInactiveElement()) {
43246        composeBooleanCore("inactive", element.getInactiveElement(), false);
43247        composeBooleanExtras("inactive", element.getInactiveElement(), false);
43248      }
43249  }
43250
43251  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
43252    if (element != null) {
43253      prop("resourceType", name);
43254      composeGuidanceResponseInner(element);
43255    }
43256  }
43257
43258  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
43259      composeDomainResourceElements(element);
43260      if (element.hasRequestIdentifier()) {
43261        composeIdentifier("requestIdentifier", element.getRequestIdentifier());
43262      }
43263      if (element.hasIdentifier()) {
43264        openArray("identifier");
43265        for (Identifier e : element.getIdentifier()) 
43266          composeIdentifier(null, e);
43267        closeArray();
43268      };
43269      if (element.hasModule()) {
43270        composeType("module", element.getModule());
43271      }
43272      if (element.hasStatusElement()) {
43273        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
43274        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
43275      }
43276      if (element.hasSubject()) {
43277        composeReference("subject", element.getSubject());
43278      }
43279      if (element.hasEncounter()) {
43280        composeReference("encounter", element.getEncounter());
43281      }
43282      if (element.hasOccurrenceDateTimeElement()) {
43283        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
43284        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
43285      }
43286      if (element.hasPerformer()) {
43287        composeReference("performer", element.getPerformer());
43288      }
43289      if (element.hasReasonCode()) {
43290        openArray("reasonCode");
43291        for (CodeableConcept e : element.getReasonCode()) 
43292          composeCodeableConcept(null, e);
43293        closeArray();
43294      };
43295      if (element.hasReasonReference()) {
43296        openArray("reasonReference");
43297        for (Reference e : element.getReasonReference()) 
43298          composeReference(null, e);
43299        closeArray();
43300      };
43301      if (element.hasNote()) {
43302        openArray("note");
43303        for (Annotation e : element.getNote()) 
43304          composeAnnotation(null, e);
43305        closeArray();
43306      };
43307      if (element.hasEvaluationMessage()) {
43308        openArray("evaluationMessage");
43309        for (Reference e : element.getEvaluationMessage()) 
43310          composeReference(null, e);
43311        closeArray();
43312      };
43313      if (element.hasOutputParameters()) {
43314        composeReference("outputParameters", element.getOutputParameters());
43315      }
43316      if (element.hasResult()) {
43317        composeReference("result", element.getResult());
43318      }
43319      if (element.hasDataRequirement()) {
43320        openArray("dataRequirement");
43321        for (DataRequirement e : element.getDataRequirement()) 
43322          composeDataRequirement(null, e);
43323        closeArray();
43324      };
43325  }
43326
43327  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
43328    if (element != null) {
43329      prop("resourceType", name);
43330      composeHealthcareServiceInner(element);
43331    }
43332  }
43333
43334  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
43335      composeDomainResourceElements(element);
43336      if (element.hasIdentifier()) {
43337        openArray("identifier");
43338        for (Identifier e : element.getIdentifier()) 
43339          composeIdentifier(null, e);
43340        closeArray();
43341      };
43342      if (element.hasActiveElement()) {
43343        composeBooleanCore("active", element.getActiveElement(), false);
43344        composeBooleanExtras("active", element.getActiveElement(), false);
43345      }
43346      if (element.hasProvidedBy()) {
43347        composeReference("providedBy", element.getProvidedBy());
43348      }
43349      if (element.hasCategory()) {
43350        openArray("category");
43351        for (CodeableConcept e : element.getCategory()) 
43352          composeCodeableConcept(null, e);
43353        closeArray();
43354      };
43355      if (element.hasType()) {
43356        openArray("type");
43357        for (CodeableConcept e : element.getType()) 
43358          composeCodeableConcept(null, e);
43359        closeArray();
43360      };
43361      if (element.hasSpecialty()) {
43362        openArray("specialty");
43363        for (CodeableConcept e : element.getSpecialty()) 
43364          composeCodeableConcept(null, e);
43365        closeArray();
43366      };
43367      if (element.hasLocation()) {
43368        openArray("location");
43369        for (Reference e : element.getLocation()) 
43370          composeReference(null, e);
43371        closeArray();
43372      };
43373      if (element.hasNameElement()) {
43374        composeStringCore("name", element.getNameElement(), false);
43375        composeStringExtras("name", element.getNameElement(), false);
43376      }
43377      if (element.hasCommentElement()) {
43378        composeStringCore("comment", element.getCommentElement(), false);
43379        composeStringExtras("comment", element.getCommentElement(), false);
43380      }
43381      if (element.hasExtraDetailsElement()) {
43382        composeMarkdownCore("extraDetails", element.getExtraDetailsElement(), false);
43383        composeMarkdownExtras("extraDetails", element.getExtraDetailsElement(), false);
43384      }
43385      if (element.hasPhoto()) {
43386        composeAttachment("photo", element.getPhoto());
43387      }
43388      if (element.hasTelecom()) {
43389        openArray("telecom");
43390        for (ContactPoint e : element.getTelecom()) 
43391          composeContactPoint(null, e);
43392        closeArray();
43393      };
43394      if (element.hasCoverageArea()) {
43395        openArray("coverageArea");
43396        for (Reference e : element.getCoverageArea()) 
43397          composeReference(null, e);
43398        closeArray();
43399      };
43400      if (element.hasServiceProvisionCode()) {
43401        openArray("serviceProvisionCode");
43402        for (CodeableConcept e : element.getServiceProvisionCode()) 
43403          composeCodeableConcept(null, e);
43404        closeArray();
43405      };
43406      if (element.hasEligibility()) {
43407        openArray("eligibility");
43408        for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility()) 
43409          composeHealthcareServiceHealthcareServiceEligibilityComponent(null, e);
43410        closeArray();
43411      };
43412      if (element.hasProgram()) {
43413        openArray("program");
43414        for (CodeableConcept e : element.getProgram()) 
43415          composeCodeableConcept(null, e);
43416        closeArray();
43417      };
43418      if (element.hasCharacteristic()) {
43419        openArray("characteristic");
43420        for (CodeableConcept e : element.getCharacteristic()) 
43421          composeCodeableConcept(null, e);
43422        closeArray();
43423      };
43424      if (element.hasCommunication()) {
43425        openArray("communication");
43426        for (CodeableConcept e : element.getCommunication()) 
43427          composeCodeableConcept(null, e);
43428        closeArray();
43429      };
43430      if (element.hasReferralMethod()) {
43431        openArray("referralMethod");
43432        for (CodeableConcept e : element.getReferralMethod()) 
43433          composeCodeableConcept(null, e);
43434        closeArray();
43435      };
43436      if (element.hasAppointmentRequiredElement()) {
43437        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
43438        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
43439      }
43440      if (element.hasAvailableTime()) {
43441        openArray("availableTime");
43442        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
43443          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
43444        closeArray();
43445      };
43446      if (element.hasNotAvailable()) {
43447        openArray("notAvailable");
43448        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
43449          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
43450        closeArray();
43451      };
43452      if (element.hasAvailabilityExceptionsElement()) {
43453        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
43454        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
43455      }
43456      if (element.hasEndpoint()) {
43457        openArray("endpoint");
43458        for (Reference e : element.getEndpoint()) 
43459          composeReference(null, e);
43460        closeArray();
43461      };
43462  }
43463
43464  protected void composeHealthcareServiceHealthcareServiceEligibilityComponent(String name, HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
43465    if (element != null) {
43466      open(name);
43467      composeHealthcareServiceHealthcareServiceEligibilityComponentInner(element);
43468      close();
43469    }
43470  }
43471
43472  protected void composeHealthcareServiceHealthcareServiceEligibilityComponentInner(HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
43473      composeBackbone(element);
43474      if (element.hasCode()) {
43475        composeCodeableConcept("code", element.getCode());
43476      }
43477      if (element.hasCommentElement()) {
43478        composeMarkdownCore("comment", element.getCommentElement(), false);
43479        composeMarkdownExtras("comment", element.getCommentElement(), false);
43480      }
43481  }
43482
43483  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
43484    if (element != null) {
43485      open(name);
43486      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
43487      close();
43488    }
43489  }
43490
43491  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
43492      composeBackbone(element);
43493      if (element.hasDaysOfWeek()) {
43494        openArray("daysOfWeek");
43495        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
43496          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
43497        closeArray();
43498        if (anyHasExtras(element.getDaysOfWeek())) {
43499          openArray("_daysOfWeek");
43500          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
43501            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
43502          closeArray();
43503        }
43504      };
43505      if (element.hasAllDayElement()) {
43506        composeBooleanCore("allDay", element.getAllDayElement(), false);
43507        composeBooleanExtras("allDay", element.getAllDayElement(), false);
43508      }
43509      if (element.hasAvailableStartTimeElement()) {
43510        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
43511        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
43512      }
43513      if (element.hasAvailableEndTimeElement()) {
43514        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
43515        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
43516      }
43517  }
43518
43519  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
43520    if (element != null) {
43521      open(name);
43522      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
43523      close();
43524    }
43525  }
43526
43527  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
43528      composeBackbone(element);
43529      if (element.hasDescriptionElement()) {
43530        composeStringCore("description", element.getDescriptionElement(), false);
43531        composeStringExtras("description", element.getDescriptionElement(), false);
43532      }
43533      if (element.hasDuring()) {
43534        composePeriod("during", element.getDuring());
43535      }
43536  }
43537
43538  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
43539    if (element != null) {
43540      prop("resourceType", name);
43541      composeImagingStudyInner(element);
43542    }
43543  }
43544
43545  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
43546      composeDomainResourceElements(element);
43547      if (element.hasIdentifier()) {
43548        openArray("identifier");
43549        for (Identifier e : element.getIdentifier()) 
43550          composeIdentifier(null, e);
43551        closeArray();
43552      };
43553      if (element.hasStatusElement()) {
43554        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
43555        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
43556      }
43557      if (element.hasModality()) {
43558        openArray("modality");
43559        for (Coding e : element.getModality()) 
43560          composeCoding(null, e);
43561        closeArray();
43562      };
43563      if (element.hasSubject()) {
43564        composeReference("subject", element.getSubject());
43565      }
43566      if (element.hasEncounter()) {
43567        composeReference("encounter", element.getEncounter());
43568      }
43569      if (element.hasStartedElement()) {
43570        composeDateTimeCore("started", element.getStartedElement(), false);
43571        composeDateTimeExtras("started", element.getStartedElement(), false);
43572      }
43573      if (element.hasBasedOn()) {
43574        openArray("basedOn");
43575        for (Reference e : element.getBasedOn()) 
43576          composeReference(null, e);
43577        closeArray();
43578      };
43579      if (element.hasReferrer()) {
43580        composeReference("referrer", element.getReferrer());
43581      }
43582      if (element.hasInterpreter()) {
43583        openArray("interpreter");
43584        for (Reference e : element.getInterpreter()) 
43585          composeReference(null, e);
43586        closeArray();
43587      };
43588      if (element.hasEndpoint()) {
43589        openArray("endpoint");
43590        for (Reference e : element.getEndpoint()) 
43591          composeReference(null, e);
43592        closeArray();
43593      };
43594      if (element.hasNumberOfSeriesElement()) {
43595        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
43596        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
43597      }
43598      if (element.hasNumberOfInstancesElement()) {
43599        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
43600        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
43601      }
43602      if (element.hasProcedureReference()) {
43603        composeReference("procedureReference", element.getProcedureReference());
43604      }
43605      if (element.hasProcedureCode()) {
43606        openArray("procedureCode");
43607        for (CodeableConcept e : element.getProcedureCode()) 
43608          composeCodeableConcept(null, e);
43609        closeArray();
43610      };
43611      if (element.hasLocation()) {
43612        composeReference("location", element.getLocation());
43613      }
43614      if (element.hasReasonCode()) {
43615        openArray("reasonCode");
43616        for (CodeableConcept e : element.getReasonCode()) 
43617          composeCodeableConcept(null, e);
43618        closeArray();
43619      };
43620      if (element.hasReasonReference()) {
43621        openArray("reasonReference");
43622        for (Reference e : element.getReasonReference()) 
43623          composeReference(null, e);
43624        closeArray();
43625      };
43626      if (element.hasNote()) {
43627        openArray("note");
43628        for (Annotation e : element.getNote()) 
43629          composeAnnotation(null, e);
43630        closeArray();
43631      };
43632      if (element.hasDescriptionElement()) {
43633        composeStringCore("description", element.getDescriptionElement(), false);
43634        composeStringExtras("description", element.getDescriptionElement(), false);
43635      }
43636      if (element.hasSeries()) {
43637        openArray("series");
43638        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
43639          composeImagingStudyImagingStudySeriesComponent(null, e);
43640        closeArray();
43641      };
43642  }
43643
43644  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
43645    if (element != null) {
43646      open(name);
43647      composeImagingStudyImagingStudySeriesComponentInner(element);
43648      close();
43649    }
43650  }
43651
43652  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
43653      composeBackbone(element);
43654      if (element.hasUidElement()) {
43655        composeIdCore("uid", element.getUidElement(), false);
43656        composeIdExtras("uid", element.getUidElement(), false);
43657      }
43658      if (element.hasNumberElement()) {
43659        composeUnsignedIntCore("number", element.getNumberElement(), false);
43660        composeUnsignedIntExtras("number", element.getNumberElement(), false);
43661      }
43662      if (element.hasModality()) {
43663        composeCoding("modality", element.getModality());
43664      }
43665      if (element.hasDescriptionElement()) {
43666        composeStringCore("description", element.getDescriptionElement(), false);
43667        composeStringExtras("description", element.getDescriptionElement(), false);
43668      }
43669      if (element.hasNumberOfInstancesElement()) {
43670        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
43671        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
43672      }
43673      if (element.hasEndpoint()) {
43674        openArray("endpoint");
43675        for (Reference e : element.getEndpoint()) 
43676          composeReference(null, e);
43677        closeArray();
43678      };
43679      if (element.hasBodySite()) {
43680        composeCoding("bodySite", element.getBodySite());
43681      }
43682      if (element.hasLaterality()) {
43683        composeCoding("laterality", element.getLaterality());
43684      }
43685      if (element.hasSpecimen()) {
43686        openArray("specimen");
43687        for (Reference e : element.getSpecimen()) 
43688          composeReference(null, e);
43689        closeArray();
43690      };
43691      if (element.hasStartedElement()) {
43692        composeDateTimeCore("started", element.getStartedElement(), false);
43693        composeDateTimeExtras("started", element.getStartedElement(), false);
43694      }
43695      if (element.hasPerformer()) {
43696        openArray("performer");
43697        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
43698          composeImagingStudyImagingStudySeriesPerformerComponent(null, e);
43699        closeArray();
43700      };
43701      if (element.hasInstance()) {
43702        openArray("instance");
43703        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
43704          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
43705        closeArray();
43706      };
43707  }
43708
43709  protected void composeImagingStudyImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
43710    if (element != null) {
43711      open(name);
43712      composeImagingStudyImagingStudySeriesPerformerComponentInner(element);
43713      close();
43714    }
43715  }
43716
43717  protected void composeImagingStudyImagingStudySeriesPerformerComponentInner(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
43718      composeBackbone(element);
43719      if (element.hasFunction()) {
43720        composeCodeableConcept("function", element.getFunction());
43721      }
43722      if (element.hasActor()) {
43723        composeReference("actor", element.getActor());
43724      }
43725  }
43726
43727  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
43728    if (element != null) {
43729      open(name);
43730      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
43731      close();
43732    }
43733  }
43734
43735  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
43736      composeBackbone(element);
43737      if (element.hasUidElement()) {
43738        composeIdCore("uid", element.getUidElement(), false);
43739        composeIdExtras("uid", element.getUidElement(), false);
43740      }
43741      if (element.hasSopClass()) {
43742        composeCoding("sopClass", element.getSopClass());
43743      }
43744      if (element.hasNumberElement()) {
43745        composeUnsignedIntCore("number", element.getNumberElement(), false);
43746        composeUnsignedIntExtras("number", element.getNumberElement(), false);
43747      }
43748      if (element.hasTitleElement()) {
43749        composeStringCore("title", element.getTitleElement(), false);
43750        composeStringExtras("title", element.getTitleElement(), false);
43751      }
43752  }
43753
43754  protected void composeImmunization(String name, Immunization element) throws IOException {
43755    if (element != null) {
43756      prop("resourceType", name);
43757      composeImmunizationInner(element);
43758    }
43759  }
43760
43761  protected void composeImmunizationInner(Immunization element) throws IOException {
43762      composeDomainResourceElements(element);
43763      if (element.hasIdentifier()) {
43764        openArray("identifier");
43765        for (Identifier e : element.getIdentifier()) 
43766          composeIdentifier(null, e);
43767        closeArray();
43768      };
43769      if (element.hasStatusElement()) {
43770        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
43771        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
43772      }
43773      if (element.hasStatusReason()) {
43774        composeCodeableConcept("statusReason", element.getStatusReason());
43775      }
43776      if (element.hasVaccineCode()) {
43777        composeCodeableConcept("vaccineCode", element.getVaccineCode());
43778      }
43779      if (element.hasPatient()) {
43780        composeReference("patient", element.getPatient());
43781      }
43782      if (element.hasEncounter()) {
43783        composeReference("encounter", element.getEncounter());
43784      }
43785      if (element.hasOccurrence()) {
43786        composeType("occurrence", element.getOccurrence());
43787      }
43788      if (element.hasRecordedElement()) {
43789        composeDateTimeCore("recorded", element.getRecordedElement(), false);
43790        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
43791      }
43792      if (element.hasPrimarySourceElement()) {
43793        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
43794        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
43795      }
43796      if (element.hasReportOrigin()) {
43797        composeCodeableConcept("reportOrigin", element.getReportOrigin());
43798      }
43799      if (element.hasLocation()) {
43800        composeReference("location", element.getLocation());
43801      }
43802      if (element.hasManufacturer()) {
43803        composeReference("manufacturer", element.getManufacturer());
43804      }
43805      if (element.hasLotNumberElement()) {
43806        composeStringCore("lotNumber", element.getLotNumberElement(), false);
43807        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
43808      }
43809      if (element.hasExpirationDateElement()) {
43810        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
43811        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
43812      }
43813      if (element.hasSite()) {
43814        composeCodeableConcept("site", element.getSite());
43815      }
43816      if (element.hasRoute()) {
43817        composeCodeableConcept("route", element.getRoute());
43818      }
43819      if (element.hasDoseQuantity()) {
43820        composeQuantity("doseQuantity", element.getDoseQuantity());
43821      }
43822      if (element.hasPerformer()) {
43823        openArray("performer");
43824        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
43825          composeImmunizationImmunizationPerformerComponent(null, e);
43826        closeArray();
43827      };
43828      if (element.hasNote()) {
43829        openArray("note");
43830        for (Annotation e : element.getNote()) 
43831          composeAnnotation(null, e);
43832        closeArray();
43833      };
43834      if (element.hasReasonCode()) {
43835        openArray("reasonCode");
43836        for (CodeableConcept e : element.getReasonCode()) 
43837          composeCodeableConcept(null, e);
43838        closeArray();
43839      };
43840      if (element.hasReasonReference()) {
43841        openArray("reasonReference");
43842        for (Reference e : element.getReasonReference()) 
43843          composeReference(null, e);
43844        closeArray();
43845      };
43846      if (element.hasIsSubpotentElement()) {
43847        composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
43848        composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
43849      }
43850      if (element.hasSubpotentReason()) {
43851        openArray("subpotentReason");
43852        for (CodeableConcept e : element.getSubpotentReason()) 
43853          composeCodeableConcept(null, e);
43854        closeArray();
43855      };
43856      if (element.hasEducation()) {
43857        openArray("education");
43858        for (Immunization.ImmunizationEducationComponent e : element.getEducation()) 
43859          composeImmunizationImmunizationEducationComponent(null, e);
43860        closeArray();
43861      };
43862      if (element.hasProgramEligibility()) {
43863        openArray("programEligibility");
43864        for (CodeableConcept e : element.getProgramEligibility()) 
43865          composeCodeableConcept(null, e);
43866        closeArray();
43867      };
43868      if (element.hasFundingSource()) {
43869        composeCodeableConcept("fundingSource", element.getFundingSource());
43870      }
43871      if (element.hasReaction()) {
43872        openArray("reaction");
43873        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
43874          composeImmunizationImmunizationReactionComponent(null, e);
43875        closeArray();
43876      };
43877      if (element.hasProtocolApplied()) {
43878        openArray("protocolApplied");
43879        for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
43880          composeImmunizationImmunizationProtocolAppliedComponent(null, e);
43881        closeArray();
43882      };
43883  }
43884
43885  protected void composeImmunizationImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
43886    if (element != null) {
43887      open(name);
43888      composeImmunizationImmunizationPerformerComponentInner(element);
43889      close();
43890    }
43891  }
43892
43893  protected void composeImmunizationImmunizationPerformerComponentInner(Immunization.ImmunizationPerformerComponent element) throws IOException {
43894      composeBackbone(element);
43895      if (element.hasFunction()) {
43896        composeCodeableConcept("function", element.getFunction());
43897      }
43898      if (element.hasActor()) {
43899        composeReference("actor", element.getActor());
43900      }
43901  }
43902
43903  protected void composeImmunizationImmunizationEducationComponent(String name, Immunization.ImmunizationEducationComponent element) throws IOException {
43904    if (element != null) {
43905      open(name);
43906      composeImmunizationImmunizationEducationComponentInner(element);
43907      close();
43908    }
43909  }
43910
43911  protected void composeImmunizationImmunizationEducationComponentInner(Immunization.ImmunizationEducationComponent element) throws IOException {
43912      composeBackbone(element);
43913      if (element.hasDocumentTypeElement()) {
43914        composeStringCore("documentType", element.getDocumentTypeElement(), false);
43915        composeStringExtras("documentType", element.getDocumentTypeElement(), false);
43916      }
43917      if (element.hasReferenceElement()) {
43918        composeUriCore("reference", element.getReferenceElement(), false);
43919        composeUriExtras("reference", element.getReferenceElement(), false);
43920      }
43921      if (element.hasPublicationDateElement()) {
43922        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
43923        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
43924      }
43925      if (element.hasPresentationDateElement()) {
43926        composeDateTimeCore("presentationDate", element.getPresentationDateElement(), false);
43927        composeDateTimeExtras("presentationDate", element.getPresentationDateElement(), false);
43928      }
43929  }
43930
43931  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
43932    if (element != null) {
43933      open(name);
43934      composeImmunizationImmunizationReactionComponentInner(element);
43935      close();
43936    }
43937  }
43938
43939  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
43940      composeBackbone(element);
43941      if (element.hasDateElement()) {
43942        composeDateTimeCore("date", element.getDateElement(), false);
43943        composeDateTimeExtras("date", element.getDateElement(), false);
43944      }
43945      if (element.hasDetail()) {
43946        composeReference("detail", element.getDetail());
43947      }
43948      if (element.hasReportedElement()) {
43949        composeBooleanCore("reported", element.getReportedElement(), false);
43950        composeBooleanExtras("reported", element.getReportedElement(), false);
43951      }
43952  }
43953
43954  protected void composeImmunizationImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
43955    if (element != null) {
43956      open(name);
43957      composeImmunizationImmunizationProtocolAppliedComponentInner(element);
43958      close();
43959    }
43960  }
43961
43962  protected void composeImmunizationImmunizationProtocolAppliedComponentInner(Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
43963      composeBackbone(element);
43964      if (element.hasSeriesElement()) {
43965        composeStringCore("series", element.getSeriesElement(), false);
43966        composeStringExtras("series", element.getSeriesElement(), false);
43967      }
43968      if (element.hasAuthority()) {
43969        composeReference("authority", element.getAuthority());
43970      }
43971      if (element.hasTargetDisease()) {
43972        openArray("targetDisease");
43973        for (CodeableConcept e : element.getTargetDisease()) 
43974          composeCodeableConcept(null, e);
43975        closeArray();
43976      };
43977      if (element.hasDoseNumber()) {
43978        composeType("doseNumber", element.getDoseNumber());
43979      }
43980      if (element.hasSeriesDoses()) {
43981        composeType("seriesDoses", element.getSeriesDoses());
43982      }
43983  }
43984
43985  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
43986    if (element != null) {
43987      prop("resourceType", name);
43988      composeImmunizationEvaluationInner(element);
43989    }
43990  }
43991
43992  protected void composeImmunizationEvaluationInner(ImmunizationEvaluation element) throws IOException {
43993      composeDomainResourceElements(element);
43994      if (element.hasIdentifier()) {
43995        openArray("identifier");
43996        for (Identifier e : element.getIdentifier()) 
43997          composeIdentifier(null, e);
43998        closeArray();
43999      };
44000      if (element.hasStatusElement()) {
44001        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
44002        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
44003      }
44004      if (element.hasPatient()) {
44005        composeReference("patient", element.getPatient());
44006      }
44007      if (element.hasDateElement()) {
44008        composeDateTimeCore("date", element.getDateElement(), false);
44009        composeDateTimeExtras("date", element.getDateElement(), false);
44010      }
44011      if (element.hasAuthority()) {
44012        composeReference("authority", element.getAuthority());
44013      }
44014      if (element.hasTargetDisease()) {
44015        composeCodeableConcept("targetDisease", element.getTargetDisease());
44016      }
44017      if (element.hasImmunizationEvent()) {
44018        composeReference("immunizationEvent", element.getImmunizationEvent());
44019      }
44020      if (element.hasDoseStatus()) {
44021        composeCodeableConcept("doseStatus", element.getDoseStatus());
44022      }
44023      if (element.hasDoseStatusReason()) {
44024        openArray("doseStatusReason");
44025        for (CodeableConcept e : element.getDoseStatusReason()) 
44026          composeCodeableConcept(null, e);
44027        closeArray();
44028      };
44029      if (element.hasDescriptionElement()) {
44030        composeStringCore("description", element.getDescriptionElement(), false);
44031        composeStringExtras("description", element.getDescriptionElement(), false);
44032      }
44033      if (element.hasSeriesElement()) {
44034        composeStringCore("series", element.getSeriesElement(), false);
44035        composeStringExtras("series", element.getSeriesElement(), false);
44036      }
44037      if (element.hasDoseNumber()) {
44038        composeType("doseNumber", element.getDoseNumber());
44039      }
44040      if (element.hasSeriesDoses()) {
44041        composeType("seriesDoses", element.getSeriesDoses());
44042      }
44043  }
44044
44045  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
44046    if (element != null) {
44047      prop("resourceType", name);
44048      composeImmunizationRecommendationInner(element);
44049    }
44050  }
44051
44052  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
44053      composeDomainResourceElements(element);
44054      if (element.hasIdentifier()) {
44055        openArray("identifier");
44056        for (Identifier e : element.getIdentifier()) 
44057          composeIdentifier(null, e);
44058        closeArray();
44059      };
44060      if (element.hasPatient()) {
44061        composeReference("patient", element.getPatient());
44062      }
44063      if (element.hasDateElement()) {
44064        composeDateTimeCore("date", element.getDateElement(), false);
44065        composeDateTimeExtras("date", element.getDateElement(), false);
44066      }
44067      if (element.hasAuthority()) {
44068        composeReference("authority", element.getAuthority());
44069      }
44070      if (element.hasRecommendation()) {
44071        openArray("recommendation");
44072        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
44073          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
44074        closeArray();
44075      };
44076  }
44077
44078  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
44079    if (element != null) {
44080      open(name);
44081      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
44082      close();
44083    }
44084  }
44085
44086  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
44087      composeBackbone(element);
44088      if (element.hasVaccineCode()) {
44089        openArray("vaccineCode");
44090        for (CodeableConcept e : element.getVaccineCode()) 
44091          composeCodeableConcept(null, e);
44092        closeArray();
44093      };
44094      if (element.hasTargetDisease()) {
44095        composeCodeableConcept("targetDisease", element.getTargetDisease());
44096      }
44097      if (element.hasContraindicatedVaccineCode()) {
44098        openArray("contraindicatedVaccineCode");
44099        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
44100          composeCodeableConcept(null, e);
44101        closeArray();
44102      };
44103      if (element.hasForecastStatus()) {
44104        composeCodeableConcept("forecastStatus", element.getForecastStatus());
44105      }
44106      if (element.hasForecastReason()) {
44107        openArray("forecastReason");
44108        for (CodeableConcept e : element.getForecastReason()) 
44109          composeCodeableConcept(null, e);
44110        closeArray();
44111      };
44112      if (element.hasDateCriterion()) {
44113        openArray("dateCriterion");
44114        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
44115          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
44116        closeArray();
44117      };
44118      if (element.hasDescriptionElement()) {
44119        composeStringCore("description", element.getDescriptionElement(), false);
44120        composeStringExtras("description", element.getDescriptionElement(), false);
44121      }
44122      if (element.hasSeriesElement()) {
44123        composeStringCore("series", element.getSeriesElement(), false);
44124        composeStringExtras("series", element.getSeriesElement(), false);
44125      }
44126      if (element.hasDoseNumber()) {
44127        composeType("doseNumber", element.getDoseNumber());
44128      }
44129      if (element.hasSeriesDoses()) {
44130        composeType("seriesDoses", element.getSeriesDoses());
44131      }
44132      if (element.hasSupportingImmunization()) {
44133        openArray("supportingImmunization");
44134        for (Reference e : element.getSupportingImmunization()) 
44135          composeReference(null, e);
44136        closeArray();
44137      };
44138      if (element.hasSupportingPatientInformation()) {
44139        openArray("supportingPatientInformation");
44140        for (Reference e : element.getSupportingPatientInformation()) 
44141          composeReference(null, e);
44142        closeArray();
44143      };
44144  }
44145
44146  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
44147    if (element != null) {
44148      open(name);
44149      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
44150      close();
44151    }
44152  }
44153
44154  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
44155      composeBackbone(element);
44156      if (element.hasCode()) {
44157        composeCodeableConcept("code", element.getCode());
44158      }
44159      if (element.hasValueElement()) {
44160        composeDateTimeCore("value", element.getValueElement(), false);
44161        composeDateTimeExtras("value", element.getValueElement(), false);
44162      }
44163  }
44164
44165  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
44166    if (element != null) {
44167      prop("resourceType", name);
44168      composeImplementationGuideInner(element);
44169    }
44170  }
44171
44172  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
44173      composeDomainResourceElements(element);
44174      if (element.hasUrlElement()) {
44175        composeUriCore("url", element.getUrlElement(), false);
44176        composeUriExtras("url", element.getUrlElement(), false);
44177      }
44178      if (element.hasVersionElement()) {
44179        composeStringCore("version", element.getVersionElement(), false);
44180        composeStringExtras("version", element.getVersionElement(), false);
44181      }
44182      if (element.hasNameElement()) {
44183        composeStringCore("name", element.getNameElement(), false);
44184        composeStringExtras("name", element.getNameElement(), false);
44185      }
44186      if (element.hasTitleElement()) {
44187        composeStringCore("title", element.getTitleElement(), false);
44188        composeStringExtras("title", element.getTitleElement(), false);
44189      }
44190      if (element.hasStatusElement()) {
44191        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44192        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44193      }
44194      if (element.hasExperimentalElement()) {
44195        composeBooleanCore("experimental", element.getExperimentalElement(), false);
44196        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
44197      }
44198      if (element.hasDateElement()) {
44199        composeDateTimeCore("date", element.getDateElement(), false);
44200        composeDateTimeExtras("date", element.getDateElement(), false);
44201      }
44202      if (element.hasPublisherElement()) {
44203        composeStringCore("publisher", element.getPublisherElement(), false);
44204        composeStringExtras("publisher", element.getPublisherElement(), false);
44205      }
44206      if (element.hasContact()) {
44207        openArray("contact");
44208        for (ContactDetail e : element.getContact()) 
44209          composeContactDetail(null, e);
44210        closeArray();
44211      };
44212      if (element.hasDescriptionElement()) {
44213        composeMarkdownCore("description", element.getDescriptionElement(), false);
44214        composeMarkdownExtras("description", element.getDescriptionElement(), false);
44215      }
44216      if (element.hasUseContext()) {
44217        openArray("useContext");
44218        for (UsageContext e : element.getUseContext()) 
44219          composeUsageContext(null, e);
44220        closeArray();
44221      };
44222      if (element.hasJurisdiction()) {
44223        openArray("jurisdiction");
44224        for (CodeableConcept e : element.getJurisdiction()) 
44225          composeCodeableConcept(null, e);
44226        closeArray();
44227      };
44228      if (element.hasCopyrightElement()) {
44229        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
44230        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
44231      }
44232      if (element.hasPackageIdElement()) {
44233        composeIdCore("packageId", element.getPackageIdElement(), false);
44234        composeIdExtras("packageId", element.getPackageIdElement(), false);
44235      }
44236      if (element.hasLicenseElement()) {
44237        composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
44238        composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
44239      }
44240      if (element.hasFhirVersion()) {
44241        openArray("fhirVersion");
44242        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
44243          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
44244        closeArray();
44245        if (anyHasExtras(element.getFhirVersion())) {
44246          openArray("_fhirVersion");
44247          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
44248            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
44249          closeArray();
44250        }
44251      };
44252      if (element.hasDependsOn()) {
44253        openArray("dependsOn");
44254        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
44255          composeImplementationGuideImplementationGuideDependsOnComponent(null, e);
44256        closeArray();
44257      };
44258      if (element.hasGlobal()) {
44259        openArray("global");
44260        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
44261          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
44262        closeArray();
44263      };
44264      if (element.hasDefinition()) {
44265        composeImplementationGuideImplementationGuideDefinitionComponent("definition", element.getDefinition());
44266      }
44267      if (element.hasManifest()) {
44268        composeImplementationGuideImplementationGuideManifestComponent("manifest", element.getManifest());
44269      }
44270  }
44271
44272  protected void composeImplementationGuideImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
44273    if (element != null) {
44274      open(name);
44275      composeImplementationGuideImplementationGuideDependsOnComponentInner(element);
44276      close();
44277    }
44278  }
44279
44280  protected void composeImplementationGuideImplementationGuideDependsOnComponentInner(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
44281      composeBackbone(element);
44282      if (element.hasUriElement()) {
44283        composeCanonicalCore("uri", element.getUriElement(), false);
44284        composeCanonicalExtras("uri", element.getUriElement(), false);
44285      }
44286      if (element.hasPackageIdElement()) {
44287        composeIdCore("packageId", element.getPackageIdElement(), false);
44288        composeIdExtras("packageId", element.getPackageIdElement(), false);
44289      }
44290      if (element.hasVersionElement()) {
44291        composeStringCore("version", element.getVersionElement(), false);
44292        composeStringExtras("version", element.getVersionElement(), false);
44293      }
44294  }
44295
44296  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
44297    if (element != null) {
44298      open(name);
44299      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
44300      close();
44301    }
44302  }
44303
44304  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
44305      composeBackbone(element);
44306      if (element.hasTypeElement()) {
44307        composeCodeCore("type", element.getTypeElement(), false);
44308        composeCodeExtras("type", element.getTypeElement(), false);
44309      }
44310      if (element.hasProfileElement()) {
44311        composeCanonicalCore("profile", element.getProfileElement(), false);
44312        composeCanonicalExtras("profile", element.getProfileElement(), false);
44313      }
44314  }
44315
44316  protected void composeImplementationGuideImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
44317    if (element != null) {
44318      open(name);
44319      composeImplementationGuideImplementationGuideDefinitionComponentInner(element);
44320      close();
44321    }
44322  }
44323
44324  protected void composeImplementationGuideImplementationGuideDefinitionComponentInner(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
44325      composeBackbone(element);
44326      if (element.hasGrouping()) {
44327        openArray("grouping");
44328        for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping()) 
44329          composeImplementationGuideImplementationGuideDefinitionGroupingComponent(null, e);
44330        closeArray();
44331      };
44332      if (element.hasResource()) {
44333        openArray("resource");
44334        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
44335          composeImplementationGuideImplementationGuideDefinitionResourceComponent(null, e);
44336        closeArray();
44337      };
44338      if (element.hasPage()) {
44339        composeImplementationGuideImplementationGuideDefinitionPageComponent("page", element.getPage());
44340      }
44341      if (element.hasParameter()) {
44342        openArray("parameter");
44343        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
44344          composeImplementationGuideImplementationGuideDefinitionParameterComponent(null, e);
44345        closeArray();
44346      };
44347      if (element.hasTemplate()) {
44348        openArray("template");
44349        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
44350          composeImplementationGuideImplementationGuideDefinitionTemplateComponent(null, e);
44351        closeArray();
44352      };
44353  }
44354
44355  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponent(String name, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
44356    if (element != null) {
44357      open(name);
44358      composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(element);
44359      close();
44360    }
44361  }
44362
44363  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
44364      composeBackbone(element);
44365      if (element.hasNameElement()) {
44366        composeStringCore("name", element.getNameElement(), false);
44367        composeStringExtras("name", element.getNameElement(), false);
44368      }
44369      if (element.hasDescriptionElement()) {
44370        composeStringCore("description", element.getDescriptionElement(), false);
44371        composeStringExtras("description", element.getDescriptionElement(), false);
44372      }
44373  }
44374
44375  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
44376    if (element != null) {
44377      open(name);
44378      composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(element);
44379      close();
44380    }
44381  }
44382
44383  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
44384      composeBackbone(element);
44385      if (element.hasReference()) {
44386        composeReference("reference", element.getReference());
44387      }
44388      if (element.hasFhirVersion()) {
44389        openArray("fhirVersion");
44390        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
44391          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
44392        closeArray();
44393        if (anyHasExtras(element.getFhirVersion())) {
44394          openArray("_fhirVersion");
44395          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
44396            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
44397          closeArray();
44398        }
44399      };
44400      if (element.hasNameElement()) {
44401        composeStringCore("name", element.getNameElement(), false);
44402        composeStringExtras("name", element.getNameElement(), false);
44403      }
44404      if (element.hasDescriptionElement()) {
44405        composeStringCore("description", element.getDescriptionElement(), false);
44406        composeStringExtras("description", element.getDescriptionElement(), false);
44407      }
44408      if (element.hasExample()) {
44409        composeType("example", element.getExample());
44410      }
44411      if (element.hasGroupingIdElement()) {
44412        composeIdCore("groupingId", element.getGroupingIdElement(), false);
44413        composeIdExtras("groupingId", element.getGroupingIdElement(), false);
44414      }
44415  }
44416
44417  protected void composeImplementationGuideImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
44418    if (element != null) {
44419      open(name);
44420      composeImplementationGuideImplementationGuideDefinitionPageComponentInner(element);
44421      close();
44422    }
44423  }
44424
44425  protected void composeImplementationGuideImplementationGuideDefinitionPageComponentInner(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
44426      composeBackbone(element);
44427      if (element.hasName()) {
44428        composeType("name", element.getName());
44429      }
44430      if (element.hasTitleElement()) {
44431        composeStringCore("title", element.getTitleElement(), false);
44432        composeStringExtras("title", element.getTitleElement(), false);
44433      }
44434      if (element.hasGenerationElement()) {
44435        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
44436        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
44437      }
44438      if (element.hasPage()) {
44439        openArray("page");
44440        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
44441          composeImplementationGuideImplementationGuideDefinitionPageComponent(null, e);
44442        closeArray();
44443      };
44444  }
44445
44446  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
44447    if (element != null) {
44448      open(name);
44449      composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(element);
44450      close();
44451    }
44452  }
44453
44454  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
44455      composeBackbone(element);
44456      if (element.hasCodeElement()) {
44457        composeStringCore("code", element.getCodeElement(), false);
44458        composeStringExtras("code", element.getCodeElement(), false);
44459      }
44460      if (element.hasValueElement()) {
44461        composeStringCore("value", element.getValueElement(), false);
44462        composeStringExtras("value", element.getValueElement(), false);
44463      }
44464  }
44465
44466  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
44467    if (element != null) {
44468      open(name);
44469      composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(element);
44470      close();
44471    }
44472  }
44473
44474  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
44475      composeBackbone(element);
44476      if (element.hasCodeElement()) {
44477        composeCodeCore("code", element.getCodeElement(), false);
44478        composeCodeExtras("code", element.getCodeElement(), false);
44479      }
44480      if (element.hasSourceElement()) {
44481        composeStringCore("source", element.getSourceElement(), false);
44482        composeStringExtras("source", element.getSourceElement(), false);
44483      }
44484      if (element.hasScopeElement()) {
44485        composeStringCore("scope", element.getScopeElement(), false);
44486        composeStringExtras("scope", element.getScopeElement(), false);
44487      }
44488  }
44489
44490  protected void composeImplementationGuideImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
44491    if (element != null) {
44492      open(name);
44493      composeImplementationGuideImplementationGuideManifestComponentInner(element);
44494      close();
44495    }
44496  }
44497
44498  protected void composeImplementationGuideImplementationGuideManifestComponentInner(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
44499      composeBackbone(element);
44500      if (element.hasRenderingElement()) {
44501        composeUrlCore("rendering", element.getRenderingElement(), false);
44502        composeUrlExtras("rendering", element.getRenderingElement(), false);
44503      }
44504      if (element.hasResource()) {
44505        openArray("resource");
44506        for (ImplementationGuide.ManifestResourceComponent e : element.getResource()) 
44507          composeImplementationGuideManifestResourceComponent(null, e);
44508        closeArray();
44509      };
44510      if (element.hasPage()) {
44511        openArray("page");
44512        for (ImplementationGuide.ManifestPageComponent e : element.getPage()) 
44513          composeImplementationGuideManifestPageComponent(null, e);
44514        closeArray();
44515      };
44516      if (element.hasImage()) {
44517        openArray("image");
44518        for (StringType e : element.getImage()) 
44519          composeStringCore(null, e, true);
44520        closeArray();
44521        if (anyHasExtras(element.getImage())) {
44522          openArray("_image");
44523          for (StringType e : element.getImage()) 
44524            composeStringExtras(null, e, true);
44525          closeArray();
44526        }
44527      };
44528      if (element.hasOther()) {
44529        openArray("other");
44530        for (StringType e : element.getOther()) 
44531          composeStringCore(null, e, true);
44532        closeArray();
44533        if (anyHasExtras(element.getOther())) {
44534          openArray("_other");
44535          for (StringType e : element.getOther()) 
44536            composeStringExtras(null, e, true);
44537          closeArray();
44538        }
44539      };
44540  }
44541
44542  protected void composeImplementationGuideManifestResourceComponent(String name, ImplementationGuide.ManifestResourceComponent element) throws IOException {
44543    if (element != null) {
44544      open(name);
44545      composeImplementationGuideManifestResourceComponentInner(element);
44546      close();
44547    }
44548  }
44549
44550  protected void composeImplementationGuideManifestResourceComponentInner(ImplementationGuide.ManifestResourceComponent element) throws IOException {
44551      composeBackbone(element);
44552      if (element.hasReference()) {
44553        composeReference("reference", element.getReference());
44554      }
44555      if (element.hasExample()) {
44556        composeType("example", element.getExample());
44557      }
44558      if (element.hasRelativePathElement()) {
44559        composeUrlCore("relativePath", element.getRelativePathElement(), false);
44560        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
44561      }
44562  }
44563
44564  protected void composeImplementationGuideManifestPageComponent(String name, ImplementationGuide.ManifestPageComponent element) throws IOException {
44565    if (element != null) {
44566      open(name);
44567      composeImplementationGuideManifestPageComponentInner(element);
44568      close();
44569    }
44570  }
44571
44572  protected void composeImplementationGuideManifestPageComponentInner(ImplementationGuide.ManifestPageComponent element) throws IOException {
44573      composeBackbone(element);
44574      if (element.hasNameElement()) {
44575        composeStringCore("name", element.getNameElement(), false);
44576        composeStringExtras("name", element.getNameElement(), false);
44577      }
44578      if (element.hasTitleElement()) {
44579        composeStringCore("title", element.getTitleElement(), false);
44580        composeStringExtras("title", element.getTitleElement(), false);
44581      }
44582      if (element.hasAnchor()) {
44583        openArray("anchor");
44584        for (StringType e : element.getAnchor()) 
44585          composeStringCore(null, e, true);
44586        closeArray();
44587        if (anyHasExtras(element.getAnchor())) {
44588          openArray("_anchor");
44589          for (StringType e : element.getAnchor()) 
44590            composeStringExtras(null, e, true);
44591          closeArray();
44592        }
44593      };
44594  }
44595
44596  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
44597    if (element != null) {
44598      prop("resourceType", name);
44599      composeInsurancePlanInner(element);
44600    }
44601  }
44602
44603  protected void composeInsurancePlanInner(InsurancePlan element) throws IOException {
44604      composeDomainResourceElements(element);
44605      if (element.hasIdentifier()) {
44606        openArray("identifier");
44607        for (Identifier e : element.getIdentifier()) 
44608          composeIdentifier(null, e);
44609        closeArray();
44610      };
44611      if (element.hasStatusElement()) {
44612        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44613        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44614      }
44615      if (element.hasType()) {
44616        openArray("type");
44617        for (CodeableConcept e : element.getType()) 
44618          composeCodeableConcept(null, e);
44619        closeArray();
44620      };
44621      if (element.hasNameElement()) {
44622        composeStringCore("name", element.getNameElement(), false);
44623        composeStringExtras("name", element.getNameElement(), false);
44624      }
44625      if (element.hasAlias()) {
44626        openArray("alias");
44627        for (StringType e : element.getAlias()) 
44628          composeStringCore(null, e, true);
44629        closeArray();
44630        if (anyHasExtras(element.getAlias())) {
44631          openArray("_alias");
44632          for (StringType e : element.getAlias()) 
44633            composeStringExtras(null, e, true);
44634          closeArray();
44635        }
44636      };
44637      if (element.hasPeriod()) {
44638        composePeriod("period", element.getPeriod());
44639      }
44640      if (element.hasOwnedBy()) {
44641        composeReference("ownedBy", element.getOwnedBy());
44642      }
44643      if (element.hasAdministeredBy()) {
44644        composeReference("administeredBy", element.getAdministeredBy());
44645      }
44646      if (element.hasCoverageArea()) {
44647        openArray("coverageArea");
44648        for (Reference e : element.getCoverageArea()) 
44649          composeReference(null, e);
44650        closeArray();
44651      };
44652      if (element.hasContact()) {
44653        openArray("contact");
44654        for (InsurancePlan.InsurancePlanContactComponent e : element.getContact()) 
44655          composeInsurancePlanInsurancePlanContactComponent(null, e);
44656        closeArray();
44657      };
44658      if (element.hasEndpoint()) {
44659        openArray("endpoint");
44660        for (Reference e : element.getEndpoint()) 
44661          composeReference(null, e);
44662        closeArray();
44663      };
44664      if (element.hasNetwork()) {
44665        openArray("network");
44666        for (Reference e : element.getNetwork()) 
44667          composeReference(null, e);
44668        closeArray();
44669      };
44670      if (element.hasCoverage()) {
44671        openArray("coverage");
44672        for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage()) 
44673          composeInsurancePlanInsurancePlanCoverageComponent(null, e);
44674        closeArray();
44675      };
44676      if (element.hasPlan()) {
44677        openArray("plan");
44678        for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
44679          composeInsurancePlanInsurancePlanPlanComponent(null, e);
44680        closeArray();
44681      };
44682  }
44683
44684  protected void composeInsurancePlanInsurancePlanContactComponent(String name, InsurancePlan.InsurancePlanContactComponent element) throws IOException {
44685    if (element != null) {
44686      open(name);
44687      composeInsurancePlanInsurancePlanContactComponentInner(element);
44688      close();
44689    }
44690  }
44691
44692  protected void composeInsurancePlanInsurancePlanContactComponentInner(InsurancePlan.InsurancePlanContactComponent element) throws IOException {
44693      composeBackbone(element);
44694      if (element.hasPurpose()) {
44695        composeCodeableConcept("purpose", element.getPurpose());
44696      }
44697      if (element.hasName()) {
44698        composeHumanName("name", element.getName());
44699      }
44700      if (element.hasTelecom()) {
44701        openArray("telecom");
44702        for (ContactPoint e : element.getTelecom()) 
44703          composeContactPoint(null, e);
44704        closeArray();
44705      };
44706      if (element.hasAddress()) {
44707        composeAddress("address", element.getAddress());
44708      }
44709  }
44710
44711  protected void composeInsurancePlanInsurancePlanCoverageComponent(String name, InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
44712    if (element != null) {
44713      open(name);
44714      composeInsurancePlanInsurancePlanCoverageComponentInner(element);
44715      close();
44716    }
44717  }
44718
44719  protected void composeInsurancePlanInsurancePlanCoverageComponentInner(InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
44720      composeBackbone(element);
44721      if (element.hasType()) {
44722        composeCodeableConcept("type", element.getType());
44723      }
44724      if (element.hasNetwork()) {
44725        openArray("network");
44726        for (Reference e : element.getNetwork()) 
44727          composeReference(null, e);
44728        closeArray();
44729      };
44730      if (element.hasBenefit()) {
44731        openArray("benefit");
44732        for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit()) 
44733          composeInsurancePlanCoverageBenefitComponent(null, e);
44734        closeArray();
44735      };
44736  }
44737
44738  protected void composeInsurancePlanCoverageBenefitComponent(String name, InsurancePlan.CoverageBenefitComponent element) throws IOException {
44739    if (element != null) {
44740      open(name);
44741      composeInsurancePlanCoverageBenefitComponentInner(element);
44742      close();
44743    }
44744  }
44745
44746  protected void composeInsurancePlanCoverageBenefitComponentInner(InsurancePlan.CoverageBenefitComponent element) throws IOException {
44747      composeBackbone(element);
44748      if (element.hasType()) {
44749        composeCodeableConcept("type", element.getType());
44750      }
44751      if (element.hasRequirementElement()) {
44752        composeStringCore("requirement", element.getRequirementElement(), false);
44753        composeStringExtras("requirement", element.getRequirementElement(), false);
44754      }
44755      if (element.hasLimit()) {
44756        openArray("limit");
44757        for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit()) 
44758          composeInsurancePlanCoverageBenefitLimitComponent(null, e);
44759        closeArray();
44760      };
44761  }
44762
44763  protected void composeInsurancePlanCoverageBenefitLimitComponent(String name, InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
44764    if (element != null) {
44765      open(name);
44766      composeInsurancePlanCoverageBenefitLimitComponentInner(element);
44767      close();
44768    }
44769  }
44770
44771  protected void composeInsurancePlanCoverageBenefitLimitComponentInner(InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
44772      composeBackbone(element);
44773      if (element.hasValue()) {
44774        composeQuantity("value", element.getValue());
44775      }
44776      if (element.hasCode()) {
44777        composeCodeableConcept("code", element.getCode());
44778      }
44779  }
44780
44781  protected void composeInsurancePlanInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
44782    if (element != null) {
44783      open(name);
44784      composeInsurancePlanInsurancePlanPlanComponentInner(element);
44785      close();
44786    }
44787  }
44788
44789  protected void composeInsurancePlanInsurancePlanPlanComponentInner(InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
44790      composeBackbone(element);
44791      if (element.hasIdentifier()) {
44792        openArray("identifier");
44793        for (Identifier e : element.getIdentifier()) 
44794          composeIdentifier(null, e);
44795        closeArray();
44796      };
44797      if (element.hasType()) {
44798        composeCodeableConcept("type", element.getType());
44799      }
44800      if (element.hasCoverageArea()) {
44801        openArray("coverageArea");
44802        for (Reference e : element.getCoverageArea()) 
44803          composeReference(null, e);
44804        closeArray();
44805      };
44806      if (element.hasNetwork()) {
44807        openArray("network");
44808        for (Reference e : element.getNetwork()) 
44809          composeReference(null, e);
44810        closeArray();
44811      };
44812      if (element.hasGeneralCost()) {
44813        openArray("generalCost");
44814        for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost()) 
44815          composeInsurancePlanInsurancePlanPlanGeneralCostComponent(null, e);
44816        closeArray();
44817      };
44818      if (element.hasSpecificCost()) {
44819        openArray("specificCost");
44820        for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
44821          composeInsurancePlanInsurancePlanPlanSpecificCostComponent(null, e);
44822        closeArray();
44823      };
44824  }
44825
44826  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponent(String name, InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
44827    if (element != null) {
44828      open(name);
44829      composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(element);
44830      close();
44831    }
44832  }
44833
44834  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
44835      composeBackbone(element);
44836      if (element.hasType()) {
44837        composeCodeableConcept("type", element.getType());
44838      }
44839      if (element.hasGroupSizeElement()) {
44840        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
44841        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
44842      }
44843      if (element.hasCost()) {
44844        composeMoney("cost", element.getCost());
44845      }
44846      if (element.hasCommentElement()) {
44847        composeStringCore("comment", element.getCommentElement(), false);
44848        composeStringExtras("comment", element.getCommentElement(), false);
44849      }
44850  }
44851
44852  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
44853    if (element != null) {
44854      open(name);
44855      composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(element);
44856      close();
44857    }
44858  }
44859
44860  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
44861      composeBackbone(element);
44862      if (element.hasCategory()) {
44863        composeCodeableConcept("category", element.getCategory());
44864      }
44865      if (element.hasBenefit()) {
44866        openArray("benefit");
44867        for (InsurancePlan.PlanBenefitComponent e : element.getBenefit()) 
44868          composeInsurancePlanPlanBenefitComponent(null, e);
44869        closeArray();
44870      };
44871  }
44872
44873  protected void composeInsurancePlanPlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element) throws IOException {
44874    if (element != null) {
44875      open(name);
44876      composeInsurancePlanPlanBenefitComponentInner(element);
44877      close();
44878    }
44879  }
44880
44881  protected void composeInsurancePlanPlanBenefitComponentInner(InsurancePlan.PlanBenefitComponent element) throws IOException {
44882      composeBackbone(element);
44883      if (element.hasType()) {
44884        composeCodeableConcept("type", element.getType());
44885      }
44886      if (element.hasCost()) {
44887        openArray("cost");
44888        for (InsurancePlan.PlanBenefitCostComponent e : element.getCost()) 
44889          composeInsurancePlanPlanBenefitCostComponent(null, e);
44890        closeArray();
44891      };
44892  }
44893
44894  protected void composeInsurancePlanPlanBenefitCostComponent(String name, InsurancePlan.PlanBenefitCostComponent element) throws IOException {
44895    if (element != null) {
44896      open(name);
44897      composeInsurancePlanPlanBenefitCostComponentInner(element);
44898      close();
44899    }
44900  }
44901
44902  protected void composeInsurancePlanPlanBenefitCostComponentInner(InsurancePlan.PlanBenefitCostComponent element) throws IOException {
44903      composeBackbone(element);
44904      if (element.hasType()) {
44905        composeCodeableConcept("type", element.getType());
44906      }
44907      if (element.hasApplicability()) {
44908        composeCodeableConcept("applicability", element.getApplicability());
44909      }
44910      if (element.hasQualifiers()) {
44911        openArray("qualifiers");
44912        for (CodeableConcept e : element.getQualifiers()) 
44913          composeCodeableConcept(null, e);
44914        closeArray();
44915      };
44916      if (element.hasValue()) {
44917        composeQuantity("value", element.getValue());
44918      }
44919  }
44920
44921  protected void composeInvoice(String name, Invoice element) throws IOException {
44922    if (element != null) {
44923      prop("resourceType", name);
44924      composeInvoiceInner(element);
44925    }
44926  }
44927
44928  protected void composeInvoiceInner(Invoice element) throws IOException {
44929      composeDomainResourceElements(element);
44930      if (element.hasIdentifier()) {
44931        openArray("identifier");
44932        for (Identifier e : element.getIdentifier()) 
44933          composeIdentifier(null, e);
44934        closeArray();
44935      };
44936      if (element.hasStatusElement()) {
44937        composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
44938        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
44939      }
44940      if (element.hasCancelledReasonElement()) {
44941        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
44942        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
44943      }
44944      if (element.hasType()) {
44945        composeCodeableConcept("type", element.getType());
44946      }
44947      if (element.hasSubject()) {
44948        composeReference("subject", element.getSubject());
44949      }
44950      if (element.hasRecipient()) {
44951        composeReference("recipient", element.getRecipient());
44952      }
44953      if (element.hasDateElement()) {
44954        composeDateTimeCore("date", element.getDateElement(), false);
44955        composeDateTimeExtras("date", element.getDateElement(), false);
44956      }
44957      if (element.hasParticipant()) {
44958        openArray("participant");
44959        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
44960          composeInvoiceInvoiceParticipantComponent(null, e);
44961        closeArray();
44962      };
44963      if (element.hasIssuer()) {
44964        composeReference("issuer", element.getIssuer());
44965      }
44966      if (element.hasAccount()) {
44967        composeReference("account", element.getAccount());
44968      }
44969      if (element.hasLineItem()) {
44970        openArray("lineItem");
44971        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
44972          composeInvoiceInvoiceLineItemComponent(null, e);
44973        closeArray();
44974      };
44975      if (element.hasTotalPriceComponent()) {
44976        openArray("totalPriceComponent");
44977        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent()) 
44978          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
44979        closeArray();
44980      };
44981      if (element.hasTotalNet()) {
44982        composeMoney("totalNet", element.getTotalNet());
44983      }
44984      if (element.hasTotalGross()) {
44985        composeMoney("totalGross", element.getTotalGross());
44986      }
44987      if (element.hasPaymentTermsElement()) {
44988        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
44989        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
44990      }
44991      if (element.hasNote()) {
44992        openArray("note");
44993        for (Annotation e : element.getNote()) 
44994          composeAnnotation(null, e);
44995        closeArray();
44996      };
44997  }
44998
44999  protected void composeInvoiceInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
45000    if (element != null) {
45001      open(name);
45002      composeInvoiceInvoiceParticipantComponentInner(element);
45003      close();
45004    }
45005  }
45006
45007  protected void composeInvoiceInvoiceParticipantComponentInner(Invoice.InvoiceParticipantComponent element) throws IOException {
45008      composeBackbone(element);
45009      if (element.hasRole()) {
45010        composeCodeableConcept("role", element.getRole());
45011      }
45012      if (element.hasActor()) {
45013        composeReference("actor", element.getActor());
45014      }
45015  }
45016
45017  protected void composeInvoiceInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
45018    if (element != null) {
45019      open(name);
45020      composeInvoiceInvoiceLineItemComponentInner(element);
45021      close();
45022    }
45023  }
45024
45025  protected void composeInvoiceInvoiceLineItemComponentInner(Invoice.InvoiceLineItemComponent element) throws IOException {
45026      composeBackbone(element);
45027      if (element.hasSequenceElement()) {
45028        composePositiveIntCore("sequence", element.getSequenceElement(), false);
45029        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
45030      }
45031      if (element.hasChargeItem()) {
45032        composeType("chargeItem", element.getChargeItem());
45033      }
45034      if (element.hasPriceComponent()) {
45035        openArray("priceComponent");
45036        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent()) 
45037          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
45038        closeArray();
45039      };
45040  }
45041
45042  protected void composeInvoiceInvoiceLineItemPriceComponentComponent(String name, Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
45043    if (element != null) {
45044      open(name);
45045      composeInvoiceInvoiceLineItemPriceComponentComponentInner(element);
45046      close();
45047    }
45048  }
45049
45050  protected void composeInvoiceInvoiceLineItemPriceComponentComponentInner(Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
45051      composeBackbone(element);
45052      if (element.hasTypeElement()) {
45053        composeEnumerationCore("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
45054        composeEnumerationExtras("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
45055      }
45056      if (element.hasCode()) {
45057        composeCodeableConcept("code", element.getCode());
45058      }
45059      if (element.hasFactorElement()) {
45060        composeDecimalCore("factor", element.getFactorElement(), false);
45061        composeDecimalExtras("factor", element.getFactorElement(), false);
45062      }
45063      if (element.hasAmount()) {
45064        composeMoney("amount", element.getAmount());
45065      }
45066  }
45067
45068  protected void composeLibrary(String name, Library element) throws IOException {
45069    if (element != null) {
45070      prop("resourceType", name);
45071      composeLibraryInner(element);
45072    }
45073  }
45074
45075  protected void composeLibraryInner(Library element) throws IOException {
45076      composeDomainResourceElements(element);
45077      if (element.hasUrlElement()) {
45078        composeUriCore("url", element.getUrlElement(), false);
45079        composeUriExtras("url", element.getUrlElement(), false);
45080      }
45081      if (element.hasIdentifier()) {
45082        openArray("identifier");
45083        for (Identifier e : element.getIdentifier()) 
45084          composeIdentifier(null, e);
45085        closeArray();
45086      };
45087      if (element.hasVersionElement()) {
45088        composeStringCore("version", element.getVersionElement(), false);
45089        composeStringExtras("version", element.getVersionElement(), false);
45090      }
45091      if (element.hasNameElement()) {
45092        composeStringCore("name", element.getNameElement(), false);
45093        composeStringExtras("name", element.getNameElement(), false);
45094      }
45095      if (element.hasTitleElement()) {
45096        composeStringCore("title", element.getTitleElement(), false);
45097        composeStringExtras("title", element.getTitleElement(), false);
45098      }
45099      if (element.hasSubtitleElement()) {
45100        composeStringCore("subtitle", element.getSubtitleElement(), false);
45101        composeStringExtras("subtitle", element.getSubtitleElement(), false);
45102      }
45103      if (element.hasStatusElement()) {
45104        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45105        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45106      }
45107      if (element.hasExperimentalElement()) {
45108        composeBooleanCore("experimental", element.getExperimentalElement(), false);
45109        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
45110      }
45111      if (element.hasType()) {
45112        composeCodeableConcept("type", element.getType());
45113      }
45114      if (element.hasSubject()) {
45115        composeType("subject", element.getSubject());
45116      }
45117      if (element.hasDateElement()) {
45118        composeDateTimeCore("date", element.getDateElement(), false);
45119        composeDateTimeExtras("date", element.getDateElement(), false);
45120      }
45121      if (element.hasPublisherElement()) {
45122        composeStringCore("publisher", element.getPublisherElement(), false);
45123        composeStringExtras("publisher", element.getPublisherElement(), false);
45124      }
45125      if (element.hasContact()) {
45126        openArray("contact");
45127        for (ContactDetail e : element.getContact()) 
45128          composeContactDetail(null, e);
45129        closeArray();
45130      };
45131      if (element.hasDescriptionElement()) {
45132        composeMarkdownCore("description", element.getDescriptionElement(), false);
45133        composeMarkdownExtras("description", element.getDescriptionElement(), false);
45134      }
45135      if (element.hasUseContext()) {
45136        openArray("useContext");
45137        for (UsageContext e : element.getUseContext()) 
45138          composeUsageContext(null, e);
45139        closeArray();
45140      };
45141      if (element.hasJurisdiction()) {
45142        openArray("jurisdiction");
45143        for (CodeableConcept e : element.getJurisdiction()) 
45144          composeCodeableConcept(null, e);
45145        closeArray();
45146      };
45147      if (element.hasPurposeElement()) {
45148        composeMarkdownCore("purpose", element.getPurposeElement(), false);
45149        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
45150      }
45151      if (element.hasUsageElement()) {
45152        composeStringCore("usage", element.getUsageElement(), false);
45153        composeStringExtras("usage", element.getUsageElement(), false);
45154      }
45155      if (element.hasCopyrightElement()) {
45156        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
45157        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
45158      }
45159      if (element.hasApprovalDateElement()) {
45160        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
45161        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
45162      }
45163      if (element.hasLastReviewDateElement()) {
45164        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
45165        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
45166      }
45167      if (element.hasEffectivePeriod()) {
45168        composePeriod("effectivePeriod", element.getEffectivePeriod());
45169      }
45170      if (element.hasTopic()) {
45171        openArray("topic");
45172        for (CodeableConcept e : element.getTopic()) 
45173          composeCodeableConcept(null, e);
45174        closeArray();
45175      };
45176      if (element.hasAuthor()) {
45177        openArray("author");
45178        for (ContactDetail e : element.getAuthor()) 
45179          composeContactDetail(null, e);
45180        closeArray();
45181      };
45182      if (element.hasEditor()) {
45183        openArray("editor");
45184        for (ContactDetail e : element.getEditor()) 
45185          composeContactDetail(null, e);
45186        closeArray();
45187      };
45188      if (element.hasReviewer()) {
45189        openArray("reviewer");
45190        for (ContactDetail e : element.getReviewer()) 
45191          composeContactDetail(null, e);
45192        closeArray();
45193      };
45194      if (element.hasEndorser()) {
45195        openArray("endorser");
45196        for (ContactDetail e : element.getEndorser()) 
45197          composeContactDetail(null, e);
45198        closeArray();
45199      };
45200      if (element.hasRelatedArtifact()) {
45201        openArray("relatedArtifact");
45202        for (RelatedArtifact e : element.getRelatedArtifact()) 
45203          composeRelatedArtifact(null, e);
45204        closeArray();
45205      };
45206      if (element.hasParameter()) {
45207        openArray("parameter");
45208        for (ParameterDefinition e : element.getParameter()) 
45209          composeParameterDefinition(null, e);
45210        closeArray();
45211      };
45212      if (element.hasDataRequirement()) {
45213        openArray("dataRequirement");
45214        for (DataRequirement e : element.getDataRequirement()) 
45215          composeDataRequirement(null, e);
45216        closeArray();
45217      };
45218      if (element.hasContent()) {
45219        openArray("content");
45220        for (Attachment e : element.getContent()) 
45221          composeAttachment(null, e);
45222        closeArray();
45223      };
45224  }
45225
45226  protected void composeLinkage(String name, Linkage element) throws IOException {
45227    if (element != null) {
45228      prop("resourceType", name);
45229      composeLinkageInner(element);
45230    }
45231  }
45232
45233  protected void composeLinkageInner(Linkage element) throws IOException {
45234      composeDomainResourceElements(element);
45235      if (element.hasActiveElement()) {
45236        composeBooleanCore("active", element.getActiveElement(), false);
45237        composeBooleanExtras("active", element.getActiveElement(), false);
45238      }
45239      if (element.hasAuthor()) {
45240        composeReference("author", element.getAuthor());
45241      }
45242      if (element.hasItem()) {
45243        openArray("item");
45244        for (Linkage.LinkageItemComponent e : element.getItem()) 
45245          composeLinkageLinkageItemComponent(null, e);
45246        closeArray();
45247      };
45248  }
45249
45250  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
45251    if (element != null) {
45252      open(name);
45253      composeLinkageLinkageItemComponentInner(element);
45254      close();
45255    }
45256  }
45257
45258  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
45259      composeBackbone(element);
45260      if (element.hasTypeElement()) {
45261        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
45262        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
45263      }
45264      if (element.hasResource()) {
45265        composeReference("resource", element.getResource());
45266      }
45267  }
45268
45269  protected void composeListResource(String name, ListResource element) throws IOException {
45270    if (element != null) {
45271      prop("resourceType", name);
45272      composeListResourceInner(element);
45273    }
45274  }
45275
45276  protected void composeListResourceInner(ListResource element) throws IOException {
45277      composeDomainResourceElements(element);
45278      if (element.hasIdentifier()) {
45279        openArray("identifier");
45280        for (Identifier e : element.getIdentifier()) 
45281          composeIdentifier(null, e);
45282        closeArray();
45283      };
45284      if (element.hasStatusElement()) {
45285        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
45286        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
45287      }
45288      if (element.hasModeElement()) {
45289        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
45290        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
45291      }
45292      if (element.hasTitleElement()) {
45293        composeStringCore("title", element.getTitleElement(), false);
45294        composeStringExtras("title", element.getTitleElement(), false);
45295      }
45296      if (element.hasCode()) {
45297        composeCodeableConcept("code", element.getCode());
45298      }
45299      if (element.hasSubject()) {
45300        composeReference("subject", element.getSubject());
45301      }
45302      if (element.hasEncounter()) {
45303        composeReference("encounter", element.getEncounter());
45304      }
45305      if (element.hasDateElement()) {
45306        composeDateTimeCore("date", element.getDateElement(), false);
45307        composeDateTimeExtras("date", element.getDateElement(), false);
45308      }
45309      if (element.hasSource()) {
45310        composeReference("source", element.getSource());
45311      }
45312      if (element.hasOrderedBy()) {
45313        composeCodeableConcept("orderedBy", element.getOrderedBy());
45314      }
45315      if (element.hasNote()) {
45316        openArray("note");
45317        for (Annotation e : element.getNote()) 
45318          composeAnnotation(null, e);
45319        closeArray();
45320      };
45321      if (element.hasEntry()) {
45322        openArray("entry");
45323        for (ListResource.ListEntryComponent e : element.getEntry()) 
45324          composeListResourceListEntryComponent(null, e);
45325        closeArray();
45326      };
45327      if (element.hasEmptyReason()) {
45328        composeCodeableConcept("emptyReason", element.getEmptyReason());
45329      }
45330  }
45331
45332  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
45333    if (element != null) {
45334      open(name);
45335      composeListResourceListEntryComponentInner(element);
45336      close();
45337    }
45338  }
45339
45340  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
45341      composeBackbone(element);
45342      if (element.hasFlag()) {
45343        composeCodeableConcept("flag", element.getFlag());
45344      }
45345      if (element.hasDeletedElement()) {
45346        composeBooleanCore("deleted", element.getDeletedElement(), false);
45347        composeBooleanExtras("deleted", element.getDeletedElement(), false);
45348      }
45349      if (element.hasDateElement()) {
45350        composeDateTimeCore("date", element.getDateElement(), false);
45351        composeDateTimeExtras("date", element.getDateElement(), false);
45352      }
45353      if (element.hasItem()) {
45354        composeReference("item", element.getItem());
45355      }
45356  }
45357
45358  protected void composeLocation(String name, Location element) throws IOException {
45359    if (element != null) {
45360      prop("resourceType", name);
45361      composeLocationInner(element);
45362    }
45363  }
45364
45365  protected void composeLocationInner(Location element) throws IOException {
45366      composeDomainResourceElements(element);
45367      if (element.hasIdentifier()) {
45368        openArray("identifier");
45369        for (Identifier e : element.getIdentifier()) 
45370          composeIdentifier(null, e);
45371        closeArray();
45372      };
45373      if (element.hasStatusElement()) {
45374        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
45375        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
45376      }
45377      if (element.hasOperationalStatus()) {
45378        composeCoding("operationalStatus", element.getOperationalStatus());
45379      }
45380      if (element.hasNameElement()) {
45381        composeStringCore("name", element.getNameElement(), false);
45382        composeStringExtras("name", element.getNameElement(), false);
45383      }
45384      if (element.hasAlias()) {
45385        openArray("alias");
45386        for (StringType e : element.getAlias()) 
45387          composeStringCore(null, e, true);
45388        closeArray();
45389        if (anyHasExtras(element.getAlias())) {
45390          openArray("_alias");
45391          for (StringType e : element.getAlias()) 
45392            composeStringExtras(null, e, true);
45393          closeArray();
45394        }
45395      };
45396      if (element.hasDescriptionElement()) {
45397        composeStringCore("description", element.getDescriptionElement(), false);
45398        composeStringExtras("description", element.getDescriptionElement(), false);
45399      }
45400      if (element.hasModeElement()) {
45401        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
45402        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
45403      }
45404      if (element.hasType()) {
45405        openArray("type");
45406        for (CodeableConcept e : element.getType()) 
45407          composeCodeableConcept(null, e);
45408        closeArray();
45409      };
45410      if (element.hasTelecom()) {
45411        openArray("telecom");
45412        for (ContactPoint e : element.getTelecom()) 
45413          composeContactPoint(null, e);
45414        closeArray();
45415      };
45416      if (element.hasAddress()) {
45417        composeAddress("address", element.getAddress());
45418      }
45419      if (element.hasPhysicalType()) {
45420        composeCodeableConcept("physicalType", element.getPhysicalType());
45421      }
45422      if (element.hasPosition()) {
45423        composeLocationLocationPositionComponent("position", element.getPosition());
45424      }
45425      if (element.hasManagingOrganization()) {
45426        composeReference("managingOrganization", element.getManagingOrganization());
45427      }
45428      if (element.hasPartOf()) {
45429        composeReference("partOf", element.getPartOf());
45430      }
45431      if (element.hasHoursOfOperation()) {
45432        openArray("hoursOfOperation");
45433        for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation()) 
45434          composeLocationLocationHoursOfOperationComponent(null, e);
45435        closeArray();
45436      };
45437      if (element.hasAvailabilityExceptionsElement()) {
45438        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
45439        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
45440      }
45441      if (element.hasEndpoint()) {
45442        openArray("endpoint");
45443        for (Reference e : element.getEndpoint()) 
45444          composeReference(null, e);
45445        closeArray();
45446      };
45447  }
45448
45449  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
45450    if (element != null) {
45451      open(name);
45452      composeLocationLocationPositionComponentInner(element);
45453      close();
45454    }
45455  }
45456
45457  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
45458      composeBackbone(element);
45459      if (element.hasLongitudeElement()) {
45460        composeDecimalCore("longitude", element.getLongitudeElement(), false);
45461        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
45462      }
45463      if (element.hasLatitudeElement()) {
45464        composeDecimalCore("latitude", element.getLatitudeElement(), false);
45465        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
45466      }
45467      if (element.hasAltitudeElement()) {
45468        composeDecimalCore("altitude", element.getAltitudeElement(), false);
45469        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
45470      }
45471  }
45472
45473  protected void composeLocationLocationHoursOfOperationComponent(String name, Location.LocationHoursOfOperationComponent element) throws IOException {
45474    if (element != null) {
45475      open(name);
45476      composeLocationLocationHoursOfOperationComponentInner(element);
45477      close();
45478    }
45479  }
45480
45481  protected void composeLocationLocationHoursOfOperationComponentInner(Location.LocationHoursOfOperationComponent element) throws IOException {
45482      composeBackbone(element);
45483      if (element.hasDaysOfWeek()) {
45484        openArray("daysOfWeek");
45485        for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
45486          composeEnumerationCore(null, e, new Location.DaysOfWeekEnumFactory(), true);
45487        closeArray();
45488        if (anyHasExtras(element.getDaysOfWeek())) {
45489          openArray("_daysOfWeek");
45490          for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
45491            composeEnumerationExtras(null, e, new Location.DaysOfWeekEnumFactory(), true);
45492          closeArray();
45493        }
45494      };
45495      if (element.hasAllDayElement()) {
45496        composeBooleanCore("allDay", element.getAllDayElement(), false);
45497        composeBooleanExtras("allDay", element.getAllDayElement(), false);
45498      }
45499      if (element.hasOpeningTimeElement()) {
45500        composeTimeCore("openingTime", element.getOpeningTimeElement(), false);
45501        composeTimeExtras("openingTime", element.getOpeningTimeElement(), false);
45502      }
45503      if (element.hasClosingTimeElement()) {
45504        composeTimeCore("closingTime", element.getClosingTimeElement(), false);
45505        composeTimeExtras("closingTime", element.getClosingTimeElement(), false);
45506      }
45507  }
45508
45509  protected void composeMeasure(String name, Measure element) throws IOException {
45510    if (element != null) {
45511      prop("resourceType", name);
45512      composeMeasureInner(element);
45513    }
45514  }
45515
45516  protected void composeMeasureInner(Measure element) throws IOException {
45517      composeDomainResourceElements(element);
45518      if (element.hasUrlElement()) {
45519        composeUriCore("url", element.getUrlElement(), false);
45520        composeUriExtras("url", element.getUrlElement(), false);
45521      }
45522      if (element.hasIdentifier()) {
45523        openArray("identifier");
45524        for (Identifier e : element.getIdentifier()) 
45525          composeIdentifier(null, e);
45526        closeArray();
45527      };
45528      if (element.hasVersionElement()) {
45529        composeStringCore("version", element.getVersionElement(), false);
45530        composeStringExtras("version", element.getVersionElement(), false);
45531      }
45532      if (element.hasNameElement()) {
45533        composeStringCore("name", element.getNameElement(), false);
45534        composeStringExtras("name", element.getNameElement(), false);
45535      }
45536      if (element.hasTitleElement()) {
45537        composeStringCore("title", element.getTitleElement(), false);
45538        composeStringExtras("title", element.getTitleElement(), false);
45539      }
45540      if (element.hasSubtitleElement()) {
45541        composeStringCore("subtitle", element.getSubtitleElement(), false);
45542        composeStringExtras("subtitle", element.getSubtitleElement(), false);
45543      }
45544      if (element.hasStatusElement()) {
45545        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45546        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45547      }
45548      if (element.hasExperimentalElement()) {
45549        composeBooleanCore("experimental", element.getExperimentalElement(), false);
45550        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
45551      }
45552      if (element.hasSubject()) {
45553        composeType("subject", element.getSubject());
45554      }
45555      if (element.hasDateElement()) {
45556        composeDateTimeCore("date", element.getDateElement(), false);
45557        composeDateTimeExtras("date", element.getDateElement(), false);
45558      }
45559      if (element.hasPublisherElement()) {
45560        composeStringCore("publisher", element.getPublisherElement(), false);
45561        composeStringExtras("publisher", element.getPublisherElement(), false);
45562      }
45563      if (element.hasContact()) {
45564        openArray("contact");
45565        for (ContactDetail e : element.getContact()) 
45566          composeContactDetail(null, e);
45567        closeArray();
45568      };
45569      if (element.hasDescriptionElement()) {
45570        composeMarkdownCore("description", element.getDescriptionElement(), false);
45571        composeMarkdownExtras("description", element.getDescriptionElement(), false);
45572      }
45573      if (element.hasUseContext()) {
45574        openArray("useContext");
45575        for (UsageContext e : element.getUseContext()) 
45576          composeUsageContext(null, e);
45577        closeArray();
45578      };
45579      if (element.hasJurisdiction()) {
45580        openArray("jurisdiction");
45581        for (CodeableConcept e : element.getJurisdiction()) 
45582          composeCodeableConcept(null, e);
45583        closeArray();
45584      };
45585      if (element.hasPurposeElement()) {
45586        composeMarkdownCore("purpose", element.getPurposeElement(), false);
45587        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
45588      }
45589      if (element.hasUsageElement()) {
45590        composeStringCore("usage", element.getUsageElement(), false);
45591        composeStringExtras("usage", element.getUsageElement(), false);
45592      }
45593      if (element.hasCopyrightElement()) {
45594        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
45595        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
45596      }
45597      if (element.hasApprovalDateElement()) {
45598        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
45599        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
45600      }
45601      if (element.hasLastReviewDateElement()) {
45602        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
45603        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
45604      }
45605      if (element.hasEffectivePeriod()) {
45606        composePeriod("effectivePeriod", element.getEffectivePeriod());
45607      }
45608      if (element.hasTopic()) {
45609        openArray("topic");
45610        for (CodeableConcept e : element.getTopic()) 
45611          composeCodeableConcept(null, e);
45612        closeArray();
45613      };
45614      if (element.hasAuthor()) {
45615        openArray("author");
45616        for (ContactDetail e : element.getAuthor()) 
45617          composeContactDetail(null, e);
45618        closeArray();
45619      };
45620      if (element.hasEditor()) {
45621        openArray("editor");
45622        for (ContactDetail e : element.getEditor()) 
45623          composeContactDetail(null, e);
45624        closeArray();
45625      };
45626      if (element.hasReviewer()) {
45627        openArray("reviewer");
45628        for (ContactDetail e : element.getReviewer()) 
45629          composeContactDetail(null, e);
45630        closeArray();
45631      };
45632      if (element.hasEndorser()) {
45633        openArray("endorser");
45634        for (ContactDetail e : element.getEndorser()) 
45635          composeContactDetail(null, e);
45636        closeArray();
45637      };
45638      if (element.hasRelatedArtifact()) {
45639        openArray("relatedArtifact");
45640        for (RelatedArtifact e : element.getRelatedArtifact()) 
45641          composeRelatedArtifact(null, e);
45642        closeArray();
45643      };
45644      if (element.hasLibrary()) {
45645        openArray("library");
45646        for (CanonicalType e : element.getLibrary()) 
45647          composeCanonicalCore(null, e, true);
45648        closeArray();
45649        if (anyHasExtras(element.getLibrary())) {
45650          openArray("_library");
45651          for (CanonicalType e : element.getLibrary()) 
45652            composeCanonicalExtras(null, e, true);
45653          closeArray();
45654        }
45655      };
45656      if (element.hasDisclaimerElement()) {
45657        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
45658        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
45659      }
45660      if (element.hasScoring()) {
45661        composeCodeableConcept("scoring", element.getScoring());
45662      }
45663      if (element.hasCompositeScoring()) {
45664        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
45665      }
45666      if (element.hasType()) {
45667        openArray("type");
45668        for (CodeableConcept e : element.getType()) 
45669          composeCodeableConcept(null, e);
45670        closeArray();
45671      };
45672      if (element.hasRiskAdjustmentElement()) {
45673        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
45674        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
45675      }
45676      if (element.hasRateAggregationElement()) {
45677        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
45678        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
45679      }
45680      if (element.hasRationaleElement()) {
45681        composeMarkdownCore("rationale", element.getRationaleElement(), false);
45682        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
45683      }
45684      if (element.hasClinicalRecommendationStatementElement()) {
45685        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
45686        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
45687      }
45688      if (element.hasImprovementNotation()) {
45689        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
45690      }
45691      if (element.hasDefinition()) {
45692        openArray("definition");
45693        for (MarkdownType e : element.getDefinition()) 
45694          composeMarkdownCore(null, e, true);
45695        closeArray();
45696        if (anyHasExtras(element.getDefinition())) {
45697          openArray("_definition");
45698          for (MarkdownType e : element.getDefinition()) 
45699            composeMarkdownExtras(null, e, true);
45700          closeArray();
45701        }
45702      };
45703      if (element.hasGuidanceElement()) {
45704        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
45705        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
45706      }
45707      if (element.hasGroup()) {
45708        openArray("group");
45709        for (Measure.MeasureGroupComponent e : element.getGroup()) 
45710          composeMeasureMeasureGroupComponent(null, e);
45711        closeArray();
45712      };
45713      if (element.hasSupplementalData()) {
45714        openArray("supplementalData");
45715        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
45716          composeMeasureMeasureSupplementalDataComponent(null, e);
45717        closeArray();
45718      };
45719  }
45720
45721  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
45722    if (element != null) {
45723      open(name);
45724      composeMeasureMeasureGroupComponentInner(element);
45725      close();
45726    }
45727  }
45728
45729  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
45730      composeBackbone(element);
45731      if (element.hasCode()) {
45732        composeCodeableConcept("code", element.getCode());
45733      }
45734      if (element.hasDescriptionElement()) {
45735        composeStringCore("description", element.getDescriptionElement(), false);
45736        composeStringExtras("description", element.getDescriptionElement(), false);
45737      }
45738      if (element.hasPopulation()) {
45739        openArray("population");
45740        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
45741          composeMeasureMeasureGroupPopulationComponent(null, e);
45742        closeArray();
45743      };
45744      if (element.hasStratifier()) {
45745        openArray("stratifier");
45746        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
45747          composeMeasureMeasureGroupStratifierComponent(null, e);
45748        closeArray();
45749      };
45750  }
45751
45752  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
45753    if (element != null) {
45754      open(name);
45755      composeMeasureMeasureGroupPopulationComponentInner(element);
45756      close();
45757    }
45758  }
45759
45760  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
45761      composeBackbone(element);
45762      if (element.hasCode()) {
45763        composeCodeableConcept("code", element.getCode());
45764      }
45765      if (element.hasDescriptionElement()) {
45766        composeStringCore("description", element.getDescriptionElement(), false);
45767        composeStringExtras("description", element.getDescriptionElement(), false);
45768      }
45769      if (element.hasCriteria()) {
45770        composeExpression("criteria", element.getCriteria());
45771      }
45772  }
45773
45774  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
45775    if (element != null) {
45776      open(name);
45777      composeMeasureMeasureGroupStratifierComponentInner(element);
45778      close();
45779    }
45780  }
45781
45782  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
45783      composeBackbone(element);
45784      if (element.hasCode()) {
45785        composeCodeableConcept("code", element.getCode());
45786      }
45787      if (element.hasDescriptionElement()) {
45788        composeStringCore("description", element.getDescriptionElement(), false);
45789        composeStringExtras("description", element.getDescriptionElement(), false);
45790      }
45791      if (element.hasCriteria()) {
45792        composeExpression("criteria", element.getCriteria());
45793      }
45794      if (element.hasComponent()) {
45795        openArray("component");
45796        for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent()) 
45797          composeMeasureMeasureGroupStratifierComponentComponent(null, e);
45798        closeArray();
45799      };
45800  }
45801
45802  protected void composeMeasureMeasureGroupStratifierComponentComponent(String name, Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
45803    if (element != null) {
45804      open(name);
45805      composeMeasureMeasureGroupStratifierComponentComponentInner(element);
45806      close();
45807    }
45808  }
45809
45810  protected void composeMeasureMeasureGroupStratifierComponentComponentInner(Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
45811      composeBackbone(element);
45812      if (element.hasCode()) {
45813        composeCodeableConcept("code", element.getCode());
45814      }
45815      if (element.hasDescriptionElement()) {
45816        composeStringCore("description", element.getDescriptionElement(), false);
45817        composeStringExtras("description", element.getDescriptionElement(), false);
45818      }
45819      if (element.hasCriteria()) {
45820        composeExpression("criteria", element.getCriteria());
45821      }
45822  }
45823
45824  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
45825    if (element != null) {
45826      open(name);
45827      composeMeasureMeasureSupplementalDataComponentInner(element);
45828      close();
45829    }
45830  }
45831
45832  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
45833      composeBackbone(element);
45834      if (element.hasCode()) {
45835        composeCodeableConcept("code", element.getCode());
45836      }
45837      if (element.hasUsage()) {
45838        openArray("usage");
45839        for (CodeableConcept e : element.getUsage()) 
45840          composeCodeableConcept(null, e);
45841        closeArray();
45842      };
45843      if (element.hasDescriptionElement()) {
45844        composeStringCore("description", element.getDescriptionElement(), false);
45845        composeStringExtras("description", element.getDescriptionElement(), false);
45846      }
45847      if (element.hasCriteria()) {
45848        composeExpression("criteria", element.getCriteria());
45849      }
45850  }
45851
45852  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
45853    if (element != null) {
45854      prop("resourceType", name);
45855      composeMeasureReportInner(element);
45856    }
45857  }
45858
45859  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
45860      composeDomainResourceElements(element);
45861      if (element.hasIdentifier()) {
45862        openArray("identifier");
45863        for (Identifier e : element.getIdentifier()) 
45864          composeIdentifier(null, e);
45865        closeArray();
45866      };
45867      if (element.hasStatusElement()) {
45868        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
45869        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
45870      }
45871      if (element.hasTypeElement()) {
45872        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
45873        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
45874      }
45875      if (element.hasMeasureElement()) {
45876        composeCanonicalCore("measure", element.getMeasureElement(), false);
45877        composeCanonicalExtras("measure", element.getMeasureElement(), false);
45878      }
45879      if (element.hasSubject()) {
45880        composeReference("subject", element.getSubject());
45881      }
45882      if (element.hasDateElement()) {
45883        composeDateTimeCore("date", element.getDateElement(), false);
45884        composeDateTimeExtras("date", element.getDateElement(), false);
45885      }
45886      if (element.hasReporter()) {
45887        composeReference("reporter", element.getReporter());
45888      }
45889      if (element.hasPeriod()) {
45890        composePeriod("period", element.getPeriod());
45891      }
45892      if (element.hasImprovementNotation()) {
45893        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
45894      }
45895      if (element.hasGroup()) {
45896        openArray("group");
45897        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
45898          composeMeasureReportMeasureReportGroupComponent(null, e);
45899        closeArray();
45900      };
45901      if (element.hasEvaluatedResource()) {
45902        openArray("evaluatedResource");
45903        for (Reference e : element.getEvaluatedResource()) 
45904          composeReference(null, e);
45905        closeArray();
45906      };
45907  }
45908
45909  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
45910    if (element != null) {
45911      open(name);
45912      composeMeasureReportMeasureReportGroupComponentInner(element);
45913      close();
45914    }
45915  }
45916
45917  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
45918      composeBackbone(element);
45919      if (element.hasCode()) {
45920        composeCodeableConcept("code", element.getCode());
45921      }
45922      if (element.hasPopulation()) {
45923        openArray("population");
45924        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
45925          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
45926        closeArray();
45927      };
45928      if (element.hasMeasureScore()) {
45929        composeQuantity("measureScore", element.getMeasureScore());
45930      }
45931      if (element.hasStratifier()) {
45932        openArray("stratifier");
45933        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
45934          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
45935        closeArray();
45936      };
45937  }
45938
45939  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
45940    if (element != null) {
45941      open(name);
45942      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
45943      close();
45944    }
45945  }
45946
45947  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
45948      composeBackbone(element);
45949      if (element.hasCode()) {
45950        composeCodeableConcept("code", element.getCode());
45951      }
45952      if (element.hasCountElement()) {
45953        composeIntegerCore("count", element.getCountElement(), false);
45954        composeIntegerExtras("count", element.getCountElement(), false);
45955      }
45956      if (element.hasSubjectResults()) {
45957        composeReference("subjectResults", element.getSubjectResults());
45958      }
45959  }
45960
45961  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
45962    if (element != null) {
45963      open(name);
45964      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
45965      close();
45966    }
45967  }
45968
45969  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
45970      composeBackbone(element);
45971      if (element.hasCode()) {
45972        openArray("code");
45973        for (CodeableConcept e : element.getCode()) 
45974          composeCodeableConcept(null, e);
45975        closeArray();
45976      };
45977      if (element.hasStratum()) {
45978        openArray("stratum");
45979        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
45980          composeMeasureReportStratifierGroupComponent(null, e);
45981        closeArray();
45982      };
45983  }
45984
45985  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
45986    if (element != null) {
45987      open(name);
45988      composeMeasureReportStratifierGroupComponentInner(element);
45989      close();
45990    }
45991  }
45992
45993  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element) throws IOException {
45994      composeBackbone(element);
45995      if (element.hasValue()) {
45996        composeCodeableConcept("value", element.getValue());
45997      }
45998      if (element.hasComponent()) {
45999        openArray("component");
46000        for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent()) 
46001          composeMeasureReportStratifierGroupComponentComponent(null, e);
46002        closeArray();
46003      };
46004      if (element.hasPopulation()) {
46005        openArray("population");
46006        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
46007          composeMeasureReportStratifierGroupPopulationComponent(null, e);
46008        closeArray();
46009      };
46010      if (element.hasMeasureScore()) {
46011        composeQuantity("measureScore", element.getMeasureScore());
46012      }
46013  }
46014
46015  protected void composeMeasureReportStratifierGroupComponentComponent(String name, MeasureReport.StratifierGroupComponentComponent element) throws IOException {
46016    if (element != null) {
46017      open(name);
46018      composeMeasureReportStratifierGroupComponentComponentInner(element);
46019      close();
46020    }
46021  }
46022
46023  protected void composeMeasureReportStratifierGroupComponentComponentInner(MeasureReport.StratifierGroupComponentComponent element) throws IOException {
46024      composeBackbone(element);
46025      if (element.hasCode()) {
46026        composeCodeableConcept("code", element.getCode());
46027      }
46028      if (element.hasValue()) {
46029        composeCodeableConcept("value", element.getValue());
46030      }
46031  }
46032
46033  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
46034    if (element != null) {
46035      open(name);
46036      composeMeasureReportStratifierGroupPopulationComponentInner(element);
46037      close();
46038    }
46039  }
46040
46041  protected void composeMeasureReportStratifierGroupPopulationComponentInner(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
46042      composeBackbone(element);
46043      if (element.hasCode()) {
46044        composeCodeableConcept("code", element.getCode());
46045      }
46046      if (element.hasCountElement()) {
46047        composeIntegerCore("count", element.getCountElement(), false);
46048        composeIntegerExtras("count", element.getCountElement(), false);
46049      }
46050      if (element.hasSubjectResults()) {
46051        composeReference("subjectResults", element.getSubjectResults());
46052      }
46053  }
46054
46055  protected void composeMedia(String name, Media element) throws IOException {
46056    if (element != null) {
46057      prop("resourceType", name);
46058      composeMediaInner(element);
46059    }
46060  }
46061
46062  protected void composeMediaInner(Media element) throws IOException {
46063      composeDomainResourceElements(element);
46064      if (element.hasIdentifier()) {
46065        openArray("identifier");
46066        for (Identifier e : element.getIdentifier()) 
46067          composeIdentifier(null, e);
46068        closeArray();
46069      };
46070      if (element.hasBasedOn()) {
46071        openArray("basedOn");
46072        for (Reference e : element.getBasedOn()) 
46073          composeReference(null, e);
46074        closeArray();
46075      };
46076      if (element.hasPartOf()) {
46077        openArray("partOf");
46078        for (Reference e : element.getPartOf()) 
46079          composeReference(null, e);
46080        closeArray();
46081      };
46082      if (element.hasStatusElement()) {
46083        composeEnumerationCore("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
46084        composeEnumerationExtras("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
46085      }
46086      if (element.hasType()) {
46087        composeCodeableConcept("type", element.getType());
46088      }
46089      if (element.hasModality()) {
46090        composeCodeableConcept("modality", element.getModality());
46091      }
46092      if (element.hasView()) {
46093        composeCodeableConcept("view", element.getView());
46094      }
46095      if (element.hasSubject()) {
46096        composeReference("subject", element.getSubject());
46097      }
46098      if (element.hasEncounter()) {
46099        composeReference("encounter", element.getEncounter());
46100      }
46101      if (element.hasCreated()) {
46102        composeType("created", element.getCreated());
46103      }
46104      if (element.hasIssuedElement()) {
46105        composeInstantCore("issued", element.getIssuedElement(), false);
46106        composeInstantExtras("issued", element.getIssuedElement(), false);
46107      }
46108      if (element.hasOperator()) {
46109        composeReference("operator", element.getOperator());
46110      }
46111      if (element.hasReasonCode()) {
46112        openArray("reasonCode");
46113        for (CodeableConcept e : element.getReasonCode()) 
46114          composeCodeableConcept(null, e);
46115        closeArray();
46116      };
46117      if (element.hasBodySite()) {
46118        composeCodeableConcept("bodySite", element.getBodySite());
46119      }
46120      if (element.hasDeviceNameElement()) {
46121        composeStringCore("deviceName", element.getDeviceNameElement(), false);
46122        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
46123      }
46124      if (element.hasDevice()) {
46125        composeReference("device", element.getDevice());
46126      }
46127      if (element.hasHeightElement()) {
46128        composePositiveIntCore("height", element.getHeightElement(), false);
46129        composePositiveIntExtras("height", element.getHeightElement(), false);
46130      }
46131      if (element.hasWidthElement()) {
46132        composePositiveIntCore("width", element.getWidthElement(), false);
46133        composePositiveIntExtras("width", element.getWidthElement(), false);
46134      }
46135      if (element.hasFramesElement()) {
46136        composePositiveIntCore("frames", element.getFramesElement(), false);
46137        composePositiveIntExtras("frames", element.getFramesElement(), false);
46138      }
46139      if (element.hasDurationElement()) {
46140        composeDecimalCore("duration", element.getDurationElement(), false);
46141        composeDecimalExtras("duration", element.getDurationElement(), false);
46142      }
46143      if (element.hasContent()) {
46144        composeAttachment("content", element.getContent());
46145      }
46146      if (element.hasNote()) {
46147        openArray("note");
46148        for (Annotation e : element.getNote()) 
46149          composeAnnotation(null, e);
46150        closeArray();
46151      };
46152  }
46153
46154  protected void composeMedication(String name, Medication element) throws IOException {
46155    if (element != null) {
46156      prop("resourceType", name);
46157      composeMedicationInner(element);
46158    }
46159  }
46160
46161  protected void composeMedicationInner(Medication element) throws IOException {
46162      composeDomainResourceElements(element);
46163      if (element.hasIdentifier()) {
46164        openArray("identifier");
46165        for (Identifier e : element.getIdentifier()) 
46166          composeIdentifier(null, e);
46167        closeArray();
46168      };
46169      if (element.hasCode()) {
46170        composeCodeableConcept("code", element.getCode());
46171      }
46172      if (element.hasStatusElement()) {
46173        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
46174        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
46175      }
46176      if (element.hasManufacturer()) {
46177        composeReference("manufacturer", element.getManufacturer());
46178      }
46179      if (element.hasForm()) {
46180        composeCodeableConcept("form", element.getForm());
46181      }
46182      if (element.hasAmount()) {
46183        composeRatio("amount", element.getAmount());
46184      }
46185      if (element.hasIngredient()) {
46186        openArray("ingredient");
46187        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
46188          composeMedicationMedicationIngredientComponent(null, e);
46189        closeArray();
46190      };
46191      if (element.hasBatch()) {
46192        composeMedicationMedicationBatchComponent("batch", element.getBatch());
46193      }
46194  }
46195
46196  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
46197    if (element != null) {
46198      open(name);
46199      composeMedicationMedicationIngredientComponentInner(element);
46200      close();
46201    }
46202  }
46203
46204  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element) throws IOException {
46205      composeBackbone(element);
46206      if (element.hasItem()) {
46207        composeType("item", element.getItem());
46208      }
46209      if (element.hasIsActiveElement()) {
46210        composeBooleanCore("isActive", element.getIsActiveElement(), false);
46211        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
46212      }
46213      if (element.hasStrength()) {
46214        composeRatio("strength", element.getStrength());
46215      }
46216  }
46217
46218  protected void composeMedicationMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
46219    if (element != null) {
46220      open(name);
46221      composeMedicationMedicationBatchComponentInner(element);
46222      close();
46223    }
46224  }
46225
46226  protected void composeMedicationMedicationBatchComponentInner(Medication.MedicationBatchComponent element) throws IOException {
46227      composeBackbone(element);
46228      if (element.hasLotNumberElement()) {
46229        composeStringCore("lotNumber", element.getLotNumberElement(), false);
46230        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
46231      }
46232      if (element.hasExpirationDateElement()) {
46233        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
46234        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
46235      }
46236  }
46237
46238  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
46239    if (element != null) {
46240      prop("resourceType", name);
46241      composeMedicationAdministrationInner(element);
46242    }
46243  }
46244
46245  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
46246      composeDomainResourceElements(element);
46247      if (element.hasIdentifier()) {
46248        openArray("identifier");
46249        for (Identifier e : element.getIdentifier()) 
46250          composeIdentifier(null, e);
46251        closeArray();
46252      };
46253      if (element.hasInstantiates()) {
46254        openArray("instantiates");
46255        for (UriType e : element.getInstantiates()) 
46256          composeUriCore(null, e, true);
46257        closeArray();
46258        if (anyHasExtras(element.getInstantiates())) {
46259          openArray("_instantiates");
46260          for (UriType e : element.getInstantiates()) 
46261            composeUriExtras(null, e, true);
46262          closeArray();
46263        }
46264      };
46265      if (element.hasPartOf()) {
46266        openArray("partOf");
46267        for (Reference e : element.getPartOf()) 
46268          composeReference(null, e);
46269        closeArray();
46270      };
46271      if (element.hasStatusElement()) {
46272        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
46273        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
46274      }
46275      if (element.hasStatusReason()) {
46276        openArray("statusReason");
46277        for (CodeableConcept e : element.getStatusReason()) 
46278          composeCodeableConcept(null, e);
46279        closeArray();
46280      };
46281      if (element.hasCategory()) {
46282        composeCodeableConcept("category", element.getCategory());
46283      }
46284      if (element.hasMedication()) {
46285        composeType("medication", element.getMedication());
46286      }
46287      if (element.hasSubject()) {
46288        composeReference("subject", element.getSubject());
46289      }
46290      if (element.hasContext()) {
46291        composeReference("context", element.getContext());
46292      }
46293      if (element.hasSupportingInformation()) {
46294        openArray("supportingInformation");
46295        for (Reference e : element.getSupportingInformation()) 
46296          composeReference(null, e);
46297        closeArray();
46298      };
46299      if (element.hasEffective()) {
46300        composeType("effective", element.getEffective());
46301      }
46302      if (element.hasPerformer()) {
46303        openArray("performer");
46304        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
46305          composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
46306        closeArray();
46307      };
46308      if (element.hasReasonCode()) {
46309        openArray("reasonCode");
46310        for (CodeableConcept e : element.getReasonCode()) 
46311          composeCodeableConcept(null, e);
46312        closeArray();
46313      };
46314      if (element.hasReasonReference()) {
46315        openArray("reasonReference");
46316        for (Reference e : element.getReasonReference()) 
46317          composeReference(null, e);
46318        closeArray();
46319      };
46320      if (element.hasRequest()) {
46321        composeReference("request", element.getRequest());
46322      }
46323      if (element.hasDevice()) {
46324        openArray("device");
46325        for (Reference e : element.getDevice()) 
46326          composeReference(null, e);
46327        closeArray();
46328      };
46329      if (element.hasNote()) {
46330        openArray("note");
46331        for (Annotation e : element.getNote()) 
46332          composeAnnotation(null, e);
46333        closeArray();
46334      };
46335      if (element.hasDosage()) {
46336        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
46337      }
46338      if (element.hasEventHistory()) {
46339        openArray("eventHistory");
46340        for (Reference e : element.getEventHistory()) 
46341          composeReference(null, e);
46342        closeArray();
46343      };
46344  }
46345
46346  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
46347    if (element != null) {
46348      open(name);
46349      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
46350      close();
46351    }
46352  }
46353
46354  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
46355      composeBackbone(element);
46356      if (element.hasFunction()) {
46357        composeCodeableConcept("function", element.getFunction());
46358      }
46359      if (element.hasActor()) {
46360        composeReference("actor", element.getActor());
46361      }
46362  }
46363
46364  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
46365    if (element != null) {
46366      open(name);
46367      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
46368      close();
46369    }
46370  }
46371
46372  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
46373      composeBackbone(element);
46374      if (element.hasTextElement()) {
46375        composeStringCore("text", element.getTextElement(), false);
46376        composeStringExtras("text", element.getTextElement(), false);
46377      }
46378      if (element.hasSite()) {
46379        composeCodeableConcept("site", element.getSite());
46380      }
46381      if (element.hasRoute()) {
46382        composeCodeableConcept("route", element.getRoute());
46383      }
46384      if (element.hasMethod()) {
46385        composeCodeableConcept("method", element.getMethod());
46386      }
46387      if (element.hasDose()) {
46388        composeQuantity("dose", element.getDose());
46389      }
46390      if (element.hasRate()) {
46391        composeType("rate", element.getRate());
46392      }
46393  }
46394
46395  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
46396    if (element != null) {
46397      prop("resourceType", name);
46398      composeMedicationDispenseInner(element);
46399    }
46400  }
46401
46402  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
46403      composeDomainResourceElements(element);
46404      if (element.hasIdentifier()) {
46405        openArray("identifier");
46406        for (Identifier e : element.getIdentifier()) 
46407          composeIdentifier(null, e);
46408        closeArray();
46409      };
46410      if (element.hasPartOf()) {
46411        openArray("partOf");
46412        for (Reference e : element.getPartOf()) 
46413          composeReference(null, e);
46414        closeArray();
46415      };
46416      if (element.hasStatusElement()) {
46417        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
46418        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
46419      }
46420      if (element.hasStatusReason()) {
46421        composeType("statusReason", element.getStatusReason());
46422      }
46423      if (element.hasCategory()) {
46424        composeCodeableConcept("category", element.getCategory());
46425      }
46426      if (element.hasMedication()) {
46427        composeType("medication", element.getMedication());
46428      }
46429      if (element.hasSubject()) {
46430        composeReference("subject", element.getSubject());
46431      }
46432      if (element.hasContext()) {
46433        composeReference("context", element.getContext());
46434      }
46435      if (element.hasSupportingInformation()) {
46436        openArray("supportingInformation");
46437        for (Reference e : element.getSupportingInformation()) 
46438          composeReference(null, e);
46439        closeArray();
46440      };
46441      if (element.hasPerformer()) {
46442        openArray("performer");
46443        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
46444          composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
46445        closeArray();
46446      };
46447      if (element.hasLocation()) {
46448        composeReference("location", element.getLocation());
46449      }
46450      if (element.hasAuthorizingPrescription()) {
46451        openArray("authorizingPrescription");
46452        for (Reference e : element.getAuthorizingPrescription()) 
46453          composeReference(null, e);
46454        closeArray();
46455      };
46456      if (element.hasType()) {
46457        composeCodeableConcept("type", element.getType());
46458      }
46459      if (element.hasQuantity()) {
46460        composeQuantity("quantity", element.getQuantity());
46461      }
46462      if (element.hasDaysSupply()) {
46463        composeQuantity("daysSupply", element.getDaysSupply());
46464      }
46465      if (element.hasWhenPreparedElement()) {
46466        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
46467        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
46468      }
46469      if (element.hasWhenHandedOverElement()) {
46470        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
46471        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
46472      }
46473      if (element.hasDestination()) {
46474        composeReference("destination", element.getDestination());
46475      }
46476      if (element.hasReceiver()) {
46477        openArray("receiver");
46478        for (Reference e : element.getReceiver()) 
46479          composeReference(null, e);
46480        closeArray();
46481      };
46482      if (element.hasNote()) {
46483        openArray("note");
46484        for (Annotation e : element.getNote()) 
46485          composeAnnotation(null, e);
46486        closeArray();
46487      };
46488      if (element.hasDosageInstruction()) {
46489        openArray("dosageInstruction");
46490        for (Dosage e : element.getDosageInstruction()) 
46491          composeDosage(null, e);
46492        closeArray();
46493      };
46494      if (element.hasSubstitution()) {
46495        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
46496      }
46497      if (element.hasDetectedIssue()) {
46498        openArray("detectedIssue");
46499        for (Reference e : element.getDetectedIssue()) 
46500          composeReference(null, e);
46501        closeArray();
46502      };
46503      if (element.hasEventHistory()) {
46504        openArray("eventHistory");
46505        for (Reference e : element.getEventHistory()) 
46506          composeReference(null, e);
46507        closeArray();
46508      };
46509  }
46510
46511  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
46512    if (element != null) {
46513      open(name);
46514      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
46515      close();
46516    }
46517  }
46518
46519  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
46520      composeBackbone(element);
46521      if (element.hasFunction()) {
46522        composeCodeableConcept("function", element.getFunction());
46523      }
46524      if (element.hasActor()) {
46525        composeReference("actor", element.getActor());
46526      }
46527  }
46528
46529  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
46530    if (element != null) {
46531      open(name);
46532      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
46533      close();
46534    }
46535  }
46536
46537  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
46538      composeBackbone(element);
46539      if (element.hasWasSubstitutedElement()) {
46540        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
46541        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
46542      }
46543      if (element.hasType()) {
46544        composeCodeableConcept("type", element.getType());
46545      }
46546      if (element.hasReason()) {
46547        openArray("reason");
46548        for (CodeableConcept e : element.getReason()) 
46549          composeCodeableConcept(null, e);
46550        closeArray();
46551      };
46552      if (element.hasResponsibleParty()) {
46553        openArray("responsibleParty");
46554        for (Reference e : element.getResponsibleParty()) 
46555          composeReference(null, e);
46556        closeArray();
46557      };
46558  }
46559
46560  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
46561    if (element != null) {
46562      prop("resourceType", name);
46563      composeMedicationKnowledgeInner(element);
46564    }
46565  }
46566
46567  protected void composeMedicationKnowledgeInner(MedicationKnowledge element) throws IOException {
46568      composeDomainResourceElements(element);
46569      if (element.hasCode()) {
46570        composeCodeableConcept("code", element.getCode());
46571      }
46572      if (element.hasStatusElement()) {
46573        composeEnumerationCore("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
46574        composeEnumerationExtras("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
46575      }
46576      if (element.hasManufacturer()) {
46577        composeReference("manufacturer", element.getManufacturer());
46578      }
46579      if (element.hasDoseForm()) {
46580        composeCodeableConcept("doseForm", element.getDoseForm());
46581      }
46582      if (element.hasAmount()) {
46583        composeQuantity("amount", element.getAmount());
46584      }
46585      if (element.hasSynonym()) {
46586        openArray("synonym");
46587        for (StringType e : element.getSynonym()) 
46588          composeStringCore(null, e, true);
46589        closeArray();
46590        if (anyHasExtras(element.getSynonym())) {
46591          openArray("_synonym");
46592          for (StringType e : element.getSynonym()) 
46593            composeStringExtras(null, e, true);
46594          closeArray();
46595        }
46596      };
46597      if (element.hasRelatedMedicationKnowledge()) {
46598        openArray("relatedMedicationKnowledge");
46599        for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element.getRelatedMedicationKnowledge()) 
46600          composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
46601        closeArray();
46602      };
46603      if (element.hasAssociatedMedication()) {
46604        openArray("associatedMedication");
46605        for (Reference e : element.getAssociatedMedication()) 
46606          composeReference(null, e);
46607        closeArray();
46608      };
46609      if (element.hasProductType()) {
46610        openArray("productType");
46611        for (CodeableConcept e : element.getProductType()) 
46612          composeCodeableConcept(null, e);
46613        closeArray();
46614      };
46615      if (element.hasMonograph()) {
46616        openArray("monograph");
46617        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
46618          composeMedicationKnowledgeMedicationKnowledgeMonographComponent(null, e);
46619        closeArray();
46620      };
46621      if (element.hasIngredient()) {
46622        openArray("ingredient");
46623        for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient()) 
46624          composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(null, e);
46625        closeArray();
46626      };
46627      if (element.hasPreparationInstructionElement()) {
46628        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
46629        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
46630      }
46631      if (element.hasIntendedRoute()) {
46632        openArray("intendedRoute");
46633        for (CodeableConcept e : element.getIntendedRoute()) 
46634          composeCodeableConcept(null, e);
46635        closeArray();
46636      };
46637      if (element.hasCost()) {
46638        openArray("cost");
46639        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
46640          composeMedicationKnowledgeMedicationKnowledgeCostComponent(null, e);
46641        closeArray();
46642      };
46643      if (element.hasMonitoringProgram()) {
46644        openArray("monitoringProgram");
46645        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
46646          composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(null, e);
46647        closeArray();
46648      };
46649      if (element.hasAdministrationGuidelines()) {
46650        openArray("administrationGuidelines");
46651        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent e : element.getAdministrationGuidelines()) 
46652          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(null, e);
46653        closeArray();
46654      };
46655      if (element.hasMedicineClassification()) {
46656        openArray("medicineClassification");
46657        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
46658          composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(null, e);
46659        closeArray();
46660      };
46661      if (element.hasPackaging()) {
46662        composeMedicationKnowledgeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
46663      }
46664      if (element.hasDrugCharacteristic()) {
46665        openArray("drugCharacteristic");
46666        for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
46667          composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(null, e);
46668        closeArray();
46669      };
46670      if (element.hasContraindication()) {
46671        openArray("contraindication");
46672        for (Reference e : element.getContraindication()) 
46673          composeReference(null, e);
46674        closeArray();
46675      };
46676      if (element.hasRegulatory()) {
46677        openArray("regulatory");
46678        for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
46679          composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(null, e);
46680        closeArray();
46681      };
46682      if (element.hasKinetics()) {
46683        openArray("kinetics");
46684        for (MedicationKnowledge.MedicationKnowledgeKineticsComponent e : element.getKinetics()) 
46685          composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(null, e);
46686        closeArray();
46687      };
46688  }
46689
46690  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
46691    if (element != null) {
46692      open(name);
46693      composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(element);
46694      close();
46695    }
46696  }
46697
46698  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
46699      composeBackbone(element);
46700      if (element.hasType()) {
46701        composeCodeableConcept("type", element.getType());
46702      }
46703      if (element.hasReference()) {
46704        openArray("reference");
46705        for (Reference e : element.getReference()) 
46706          composeReference(null, e);
46707        closeArray();
46708      };
46709  }
46710
46711  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
46712    if (element != null) {
46713      open(name);
46714      composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(element);
46715      close();
46716    }
46717  }
46718
46719  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
46720      composeBackbone(element);
46721      if (element.hasType()) {
46722        composeCodeableConcept("type", element.getType());
46723      }
46724      if (element.hasSource()) {
46725        composeReference("source", element.getSource());
46726      }
46727  }
46728
46729  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
46730    if (element != null) {
46731      open(name);
46732      composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(element);
46733      close();
46734    }
46735  }
46736
46737  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
46738      composeBackbone(element);
46739      if (element.hasItem()) {
46740        composeType("item", element.getItem());
46741      }
46742      if (element.hasIsActiveElement()) {
46743        composeBooleanCore("isActive", element.getIsActiveElement(), false);
46744        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
46745      }
46746      if (element.hasStrength()) {
46747        composeRatio("strength", element.getStrength());
46748      }
46749  }
46750
46751  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
46752    if (element != null) {
46753      open(name);
46754      composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(element);
46755      close();
46756    }
46757  }
46758
46759  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
46760      composeBackbone(element);
46761      if (element.hasType()) {
46762        composeCodeableConcept("type", element.getType());
46763      }
46764      if (element.hasSourceElement()) {
46765        composeStringCore("source", element.getSourceElement(), false);
46766        composeStringExtras("source", element.getSourceElement(), false);
46767      }
46768      if (element.hasCost()) {
46769        composeMoney("cost", element.getCost());
46770      }
46771  }
46772
46773  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
46774    if (element != null) {
46775      open(name);
46776      composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(element);
46777      close();
46778    }
46779  }
46780
46781  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
46782      composeBackbone(element);
46783      if (element.hasType()) {
46784        composeCodeableConcept("type", element.getType());
46785      }
46786      if (element.hasNameElement()) {
46787        composeStringCore("name", element.getNameElement(), false);
46788        composeStringExtras("name", element.getNameElement(), false);
46789      }
46790  }
46791
46792  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
46793    if (element != null) {
46794      open(name);
46795      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(element);
46796      close();
46797    }
46798  }
46799
46800  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
46801      composeBackbone(element);
46802      if (element.hasDosage()) {
46803        openArray("dosage");
46804        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent e : element.getDosage()) 
46805          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(null, e);
46806        closeArray();
46807      };
46808      if (element.hasIndication()) {
46809        composeType("indication", element.getIndication());
46810      }
46811      if (element.hasPatientCharacteristics()) {
46812        openArray("patientCharacteristics");
46813        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent e : element.getPatientCharacteristics()) 
46814          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(null, e);
46815        closeArray();
46816      };
46817  }
46818
46819  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
46820    if (element != null) {
46821      open(name);
46822      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(element);
46823      close();
46824    }
46825  }
46826
46827  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
46828      composeBackbone(element);
46829      if (element.hasType()) {
46830        composeCodeableConcept("type", element.getType());
46831      }
46832      if (element.hasDosage()) {
46833        openArray("dosage");
46834        for (Dosage e : element.getDosage()) 
46835          composeDosage(null, e);
46836        closeArray();
46837      };
46838  }
46839
46840  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
46841    if (element != null) {
46842      open(name);
46843      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(element);
46844      close();
46845    }
46846  }
46847
46848  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
46849      composeBackbone(element);
46850      if (element.hasCharacteristic()) {
46851        composeType("characteristic", element.getCharacteristic());
46852      }
46853      if (element.hasValue()) {
46854        openArray("value");
46855        for (StringType e : element.getValue()) 
46856          composeStringCore(null, e, true);
46857        closeArray();
46858        if (anyHasExtras(element.getValue())) {
46859          openArray("_value");
46860          for (StringType e : element.getValue()) 
46861            composeStringExtras(null, e, true);
46862          closeArray();
46863        }
46864      };
46865  }
46866
46867  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
46868    if (element != null) {
46869      open(name);
46870      composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(element);
46871      close();
46872    }
46873  }
46874
46875  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
46876      composeBackbone(element);
46877      if (element.hasType()) {
46878        composeCodeableConcept("type", element.getType());
46879      }
46880      if (element.hasClassification()) {
46881        openArray("classification");
46882        for (CodeableConcept e : element.getClassification()) 
46883          composeCodeableConcept(null, e);
46884        closeArray();
46885      };
46886  }
46887
46888  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
46889    if (element != null) {
46890      open(name);
46891      composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(element);
46892      close();
46893    }
46894  }
46895
46896  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
46897      composeBackbone(element);
46898      if (element.hasType()) {
46899        composeCodeableConcept("type", element.getType());
46900      }
46901      if (element.hasQuantity()) {
46902        composeQuantity("quantity", element.getQuantity());
46903      }
46904  }
46905
46906  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
46907    if (element != null) {
46908      open(name);
46909      composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(element);
46910      close();
46911    }
46912  }
46913
46914  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
46915      composeBackbone(element);
46916      if (element.hasType()) {
46917        composeCodeableConcept("type", element.getType());
46918      }
46919      if (element.hasValue()) {
46920        composeType("value", element.getValue());
46921      }
46922  }
46923
46924  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
46925    if (element != null) {
46926      open(name);
46927      composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(element);
46928      close();
46929    }
46930  }
46931
46932  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
46933      composeBackbone(element);
46934      if (element.hasRegulatoryAuthority()) {
46935        composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
46936      }
46937      if (element.hasSubstitution()) {
46938        openArray("substitution");
46939        for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
46940          composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
46941        closeArray();
46942      };
46943      if (element.hasSchedule()) {
46944        openArray("schedule");
46945        for (MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent e : element.getSchedule()) 
46946          composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(null, e);
46947        closeArray();
46948      };
46949      if (element.hasMaxDispense()) {
46950        composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
46951      }
46952  }
46953
46954  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
46955    if (element != null) {
46956      open(name);
46957      composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(element);
46958      close();
46959    }
46960  }
46961
46962  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
46963      composeBackbone(element);
46964      if (element.hasType()) {
46965        composeCodeableConcept("type", element.getType());
46966      }
46967      if (element.hasAllowedElement()) {
46968        composeBooleanCore("allowed", element.getAllowedElement(), false);
46969        composeBooleanExtras("allowed", element.getAllowedElement(), false);
46970      }
46971  }
46972
46973  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
46974    if (element != null) {
46975      open(name);
46976      composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(element);
46977      close();
46978    }
46979  }
46980
46981  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
46982      composeBackbone(element);
46983      if (element.hasSchedule()) {
46984        composeCodeableConcept("schedule", element.getSchedule());
46985      }
46986  }
46987
46988  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
46989    if (element != null) {
46990      open(name);
46991      composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(element);
46992      close();
46993    }
46994  }
46995
46996  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
46997      composeBackbone(element);
46998      if (element.hasQuantity()) {
46999        composeQuantity("quantity", element.getQuantity());
47000      }
47001      if (element.hasPeriod()) {
47002        composeDuration("period", element.getPeriod());
47003      }
47004  }
47005
47006  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(String name, MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
47007    if (element != null) {
47008      open(name);
47009      composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(element);
47010      close();
47011    }
47012  }
47013
47014  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
47015      composeBackbone(element);
47016      if (element.hasAreaUnderCurve()) {
47017        openArray("areaUnderCurve");
47018        for (Quantity e : element.getAreaUnderCurve()) 
47019          composeQuantity(null, e);
47020        closeArray();
47021      };
47022      if (element.hasLethalDose50()) {
47023        openArray("lethalDose50");
47024        for (Quantity e : element.getLethalDose50()) 
47025          composeQuantity(null, e);
47026        closeArray();
47027      };
47028      if (element.hasHalfLifePeriod()) {
47029        composeDuration("halfLifePeriod", element.getHalfLifePeriod());
47030      }
47031  }
47032
47033  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
47034    if (element != null) {
47035      prop("resourceType", name);
47036      composeMedicationRequestInner(element);
47037    }
47038  }
47039
47040  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
47041      composeDomainResourceElements(element);
47042      if (element.hasIdentifier()) {
47043        openArray("identifier");
47044        for (Identifier e : element.getIdentifier()) 
47045          composeIdentifier(null, e);
47046        closeArray();
47047      };
47048      if (element.hasStatusElement()) {
47049        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
47050        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
47051      }
47052      if (element.hasStatusReason()) {
47053        composeCodeableConcept("statusReason", element.getStatusReason());
47054      }
47055      if (element.hasIntentElement()) {
47056        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
47057        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
47058      }
47059      if (element.hasCategory()) {
47060        openArray("category");
47061        for (CodeableConcept e : element.getCategory()) 
47062          composeCodeableConcept(null, e);
47063        closeArray();
47064      };
47065      if (element.hasPriorityElement()) {
47066        composeEnumerationCore("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
47067        composeEnumerationExtras("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
47068      }
47069      if (element.hasDoNotPerformElement()) {
47070        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
47071        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
47072      }
47073      if (element.hasReported()) {
47074        composeType("reported", element.getReported());
47075      }
47076      if (element.hasMedication()) {
47077        composeType("medication", element.getMedication());
47078      }
47079      if (element.hasSubject()) {
47080        composeReference("subject", element.getSubject());
47081      }
47082      if (element.hasEncounter()) {
47083        composeReference("encounter", element.getEncounter());
47084      }
47085      if (element.hasSupportingInformation()) {
47086        openArray("supportingInformation");
47087        for (Reference e : element.getSupportingInformation()) 
47088          composeReference(null, e);
47089        closeArray();
47090      };
47091      if (element.hasAuthoredOnElement()) {
47092        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
47093        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
47094      }
47095      if (element.hasRequester()) {
47096        composeReference("requester", element.getRequester());
47097      }
47098      if (element.hasPerformer()) {
47099        composeReference("performer", element.getPerformer());
47100      }
47101      if (element.hasPerformerType()) {
47102        composeCodeableConcept("performerType", element.getPerformerType());
47103      }
47104      if (element.hasRecorder()) {
47105        composeReference("recorder", element.getRecorder());
47106      }
47107      if (element.hasReasonCode()) {
47108        openArray("reasonCode");
47109        for (CodeableConcept e : element.getReasonCode()) 
47110          composeCodeableConcept(null, e);
47111        closeArray();
47112      };
47113      if (element.hasReasonReference()) {
47114        openArray("reasonReference");
47115        for (Reference e : element.getReasonReference()) 
47116          composeReference(null, e);
47117        closeArray();
47118      };
47119      if (element.hasInstantiatesCanonical()) {
47120        openArray("instantiatesCanonical");
47121        for (CanonicalType e : element.getInstantiatesCanonical()) 
47122          composeCanonicalCore(null, e, true);
47123        closeArray();
47124        if (anyHasExtras(element.getInstantiatesCanonical())) {
47125          openArray("_instantiatesCanonical");
47126          for (CanonicalType e : element.getInstantiatesCanonical()) 
47127            composeCanonicalExtras(null, e, true);
47128          closeArray();
47129        }
47130      };
47131      if (element.hasInstantiatesUri()) {
47132        openArray("instantiatesUri");
47133        for (UriType e : element.getInstantiatesUri()) 
47134          composeUriCore(null, e, true);
47135        closeArray();
47136        if (anyHasExtras(element.getInstantiatesUri())) {
47137          openArray("_instantiatesUri");
47138          for (UriType e : element.getInstantiatesUri()) 
47139            composeUriExtras(null, e, true);
47140          closeArray();
47141        }
47142      };
47143      if (element.hasBasedOn()) {
47144        openArray("basedOn");
47145        for (Reference e : element.getBasedOn()) 
47146          composeReference(null, e);
47147        closeArray();
47148      };
47149      if (element.hasGroupIdentifier()) {
47150        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
47151      }
47152      if (element.hasCourseOfTherapyType()) {
47153        composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
47154      }
47155      if (element.hasInsurance()) {
47156        openArray("insurance");
47157        for (Reference e : element.getInsurance()) 
47158          composeReference(null, e);
47159        closeArray();
47160      };
47161      if (element.hasNote()) {
47162        openArray("note");
47163        for (Annotation e : element.getNote()) 
47164          composeAnnotation(null, e);
47165        closeArray();
47166      };
47167      if (element.hasDosageInstruction()) {
47168        openArray("dosageInstruction");
47169        for (Dosage e : element.getDosageInstruction()) 
47170          composeDosage(null, e);
47171        closeArray();
47172      };
47173      if (element.hasDispenseRequest()) {
47174        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
47175      }
47176      if (element.hasSubstitution()) {
47177        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
47178      }
47179      if (element.hasPriorPrescription()) {
47180        composeReference("priorPrescription", element.getPriorPrescription());
47181      }
47182      if (element.hasDetectedIssue()) {
47183        openArray("detectedIssue");
47184        for (Reference e : element.getDetectedIssue()) 
47185          composeReference(null, e);
47186        closeArray();
47187      };
47188      if (element.hasEventHistory()) {
47189        openArray("eventHistory");
47190        for (Reference e : element.getEventHistory()) 
47191          composeReference(null, e);
47192        closeArray();
47193      };
47194  }
47195
47196  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
47197    if (element != null) {
47198      open(name);
47199      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
47200      close();
47201    }
47202  }
47203
47204  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
47205      composeBackbone(element);
47206      if (element.hasInitialFill()) {
47207        composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent("initialFill", element.getInitialFill());
47208      }
47209      if (element.hasDispenseInterval()) {
47210        composeDuration("dispenseInterval", element.getDispenseInterval());
47211      }
47212      if (element.hasValidityPeriod()) {
47213        composePeriod("validityPeriod", element.getValidityPeriod());
47214      }
47215      if (element.hasNumberOfRepeatsAllowedElement()) {
47216        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
47217        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
47218      }
47219      if (element.hasQuantity()) {
47220        composeQuantity("quantity", element.getQuantity());
47221      }
47222      if (element.hasExpectedSupplyDuration()) {
47223        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
47224      }
47225      if (element.hasPerformer()) {
47226        composeReference("performer", element.getPerformer());
47227      }
47228  }
47229
47230  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
47231    if (element != null) {
47232      open(name);
47233      composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(element);
47234      close();
47235    }
47236  }
47237
47238  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
47239      composeBackbone(element);
47240      if (element.hasQuantity()) {
47241        composeQuantity("quantity", element.getQuantity());
47242      }
47243      if (element.hasDuration()) {
47244        composeDuration("duration", element.getDuration());
47245      }
47246  }
47247
47248  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
47249    if (element != null) {
47250      open(name);
47251      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
47252      close();
47253    }
47254  }
47255
47256  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
47257      composeBackbone(element);
47258      if (element.hasAllowed()) {
47259        composeType("allowed", element.getAllowed());
47260      }
47261      if (element.hasReason()) {
47262        composeCodeableConcept("reason", element.getReason());
47263      }
47264  }
47265
47266  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
47267    if (element != null) {
47268      prop("resourceType", name);
47269      composeMedicationStatementInner(element);
47270    }
47271  }
47272
47273  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
47274      composeDomainResourceElements(element);
47275      if (element.hasIdentifier()) {
47276        openArray("identifier");
47277        for (Identifier e : element.getIdentifier()) 
47278          composeIdentifier(null, e);
47279        closeArray();
47280      };
47281      if (element.hasBasedOn()) {
47282        openArray("basedOn");
47283        for (Reference e : element.getBasedOn()) 
47284          composeReference(null, e);
47285        closeArray();
47286      };
47287      if (element.hasPartOf()) {
47288        openArray("partOf");
47289        for (Reference e : element.getPartOf()) 
47290          composeReference(null, e);
47291        closeArray();
47292      };
47293      if (element.hasStatusElement()) {
47294        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
47295        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
47296      }
47297      if (element.hasStatusReason()) {
47298        openArray("statusReason");
47299        for (CodeableConcept e : element.getStatusReason()) 
47300          composeCodeableConcept(null, e);
47301        closeArray();
47302      };
47303      if (element.hasCategory()) {
47304        composeCodeableConcept("category", element.getCategory());
47305      }
47306      if (element.hasMedication()) {
47307        composeType("medication", element.getMedication());
47308      }
47309      if (element.hasSubject()) {
47310        composeReference("subject", element.getSubject());
47311      }
47312      if (element.hasContext()) {
47313        composeReference("context", element.getContext());
47314      }
47315      if (element.hasEffective()) {
47316        composeType("effective", element.getEffective());
47317      }
47318      if (element.hasDateAssertedElement()) {
47319        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
47320        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
47321      }
47322      if (element.hasInformationSource()) {
47323        composeReference("informationSource", element.getInformationSource());
47324      }
47325      if (element.hasDerivedFrom()) {
47326        openArray("derivedFrom");
47327        for (Reference e : element.getDerivedFrom()) 
47328          composeReference(null, e);
47329        closeArray();
47330      };
47331      if (element.hasReasonCode()) {
47332        openArray("reasonCode");
47333        for (CodeableConcept e : element.getReasonCode()) 
47334          composeCodeableConcept(null, e);
47335        closeArray();
47336      };
47337      if (element.hasReasonReference()) {
47338        openArray("reasonReference");
47339        for (Reference e : element.getReasonReference()) 
47340          composeReference(null, e);
47341        closeArray();
47342      };
47343      if (element.hasNote()) {
47344        openArray("note");
47345        for (Annotation e : element.getNote()) 
47346          composeAnnotation(null, e);
47347        closeArray();
47348      };
47349      if (element.hasDosage()) {
47350        openArray("dosage");
47351        for (Dosage e : element.getDosage()) 
47352          composeDosage(null, e);
47353        closeArray();
47354      };
47355  }
47356
47357  protected void composeMedicinalProduct(String name, MedicinalProduct element) throws IOException {
47358    if (element != null) {
47359      prop("resourceType", name);
47360      composeMedicinalProductInner(element);
47361    }
47362  }
47363
47364  protected void composeMedicinalProductInner(MedicinalProduct element) throws IOException {
47365      composeDomainResourceElements(element);
47366      if (element.hasIdentifier()) {
47367        openArray("identifier");
47368        for (Identifier e : element.getIdentifier()) 
47369          composeIdentifier(null, e);
47370        closeArray();
47371      };
47372      if (element.hasType()) {
47373        composeCodeableConcept("type", element.getType());
47374      }
47375      if (element.hasDomain()) {
47376        composeCoding("domain", element.getDomain());
47377      }
47378      if (element.hasCombinedPharmaceuticalDoseForm()) {
47379        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
47380      }
47381      if (element.hasLegalStatusOfSupply()) {
47382        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
47383      }
47384      if (element.hasAdditionalMonitoringIndicator()) {
47385        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
47386      }
47387      if (element.hasSpecialMeasures()) {
47388        openArray("specialMeasures");
47389        for (StringType e : element.getSpecialMeasures()) 
47390          composeStringCore(null, e, true);
47391        closeArray();
47392        if (anyHasExtras(element.getSpecialMeasures())) {
47393          openArray("_specialMeasures");
47394          for (StringType e : element.getSpecialMeasures()) 
47395            composeStringExtras(null, e, true);
47396          closeArray();
47397        }
47398      };
47399      if (element.hasPaediatricUseIndicator()) {
47400        composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
47401      }
47402      if (element.hasProductClassification()) {
47403        openArray("productClassification");
47404        for (CodeableConcept e : element.getProductClassification()) 
47405          composeCodeableConcept(null, e);
47406        closeArray();
47407      };
47408      if (element.hasMarketingStatus()) {
47409        openArray("marketingStatus");
47410        for (MarketingStatus e : element.getMarketingStatus()) 
47411          composeMarketingStatus(null, e);
47412        closeArray();
47413      };
47414      if (element.hasPharmaceuticalProduct()) {
47415        openArray("pharmaceuticalProduct");
47416        for (Reference e : element.getPharmaceuticalProduct()) 
47417          composeReference(null, e);
47418        closeArray();
47419      };
47420      if (element.hasPackagedMedicinalProduct()) {
47421        openArray("packagedMedicinalProduct");
47422        for (Reference e : element.getPackagedMedicinalProduct()) 
47423          composeReference(null, e);
47424        closeArray();
47425      };
47426      if (element.hasAttachedDocument()) {
47427        openArray("attachedDocument");
47428        for (Reference e : element.getAttachedDocument()) 
47429          composeReference(null, e);
47430        closeArray();
47431      };
47432      if (element.hasMasterFile()) {
47433        openArray("masterFile");
47434        for (Reference e : element.getMasterFile()) 
47435          composeReference(null, e);
47436        closeArray();
47437      };
47438      if (element.hasContact()) {
47439        openArray("contact");
47440        for (Reference e : element.getContact()) 
47441          composeReference(null, e);
47442        closeArray();
47443      };
47444      if (element.hasClinicalTrial()) {
47445        openArray("clinicalTrial");
47446        for (Reference e : element.getClinicalTrial()) 
47447          composeReference(null, e);
47448        closeArray();
47449      };
47450      if (element.hasName()) {
47451        openArray("name");
47452        for (MedicinalProduct.MedicinalProductNameComponent e : element.getName()) 
47453          composeMedicinalProductMedicinalProductNameComponent(null, e);
47454        closeArray();
47455      };
47456      if (element.hasCrossReference()) {
47457        openArray("crossReference");
47458        for (Identifier e : element.getCrossReference()) 
47459          composeIdentifier(null, e);
47460        closeArray();
47461      };
47462      if (element.hasManufacturingBusinessOperation()) {
47463        openArray("manufacturingBusinessOperation");
47464        for (MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent e : element.getManufacturingBusinessOperation()) 
47465          composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(null, e);
47466        closeArray();
47467      };
47468      if (element.hasSpecialDesignation()) {
47469        openArray("specialDesignation");
47470        for (MedicinalProduct.MedicinalProductSpecialDesignationComponent e : element.getSpecialDesignation()) 
47471          composeMedicinalProductMedicinalProductSpecialDesignationComponent(null, e);
47472        closeArray();
47473      };
47474  }
47475
47476  protected void composeMedicinalProductMedicinalProductNameComponent(String name, MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
47477    if (element != null) {
47478      open(name);
47479      composeMedicinalProductMedicinalProductNameComponentInner(element);
47480      close();
47481    }
47482  }
47483
47484  protected void composeMedicinalProductMedicinalProductNameComponentInner(MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
47485      composeBackbone(element);
47486      if (element.hasProductNameElement()) {
47487        composeStringCore("productName", element.getProductNameElement(), false);
47488        composeStringExtras("productName", element.getProductNameElement(), false);
47489      }
47490      if (element.hasNamePart()) {
47491        openArray("namePart");
47492        for (MedicinalProduct.MedicinalProductNameNamePartComponent e : element.getNamePart()) 
47493          composeMedicinalProductMedicinalProductNameNamePartComponent(null, e);
47494        closeArray();
47495      };
47496      if (element.hasCountryLanguage()) {
47497        openArray("countryLanguage");
47498        for (MedicinalProduct.MedicinalProductNameCountryLanguageComponent e : element.getCountryLanguage()) 
47499          composeMedicinalProductMedicinalProductNameCountryLanguageComponent(null, e);
47500        closeArray();
47501      };
47502  }
47503
47504  protected void composeMedicinalProductMedicinalProductNameNamePartComponent(String name, MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
47505    if (element != null) {
47506      open(name);
47507      composeMedicinalProductMedicinalProductNameNamePartComponentInner(element);
47508      close();
47509    }
47510  }
47511
47512  protected void composeMedicinalProductMedicinalProductNameNamePartComponentInner(MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
47513      composeBackbone(element);
47514      if (element.hasPartElement()) {
47515        composeStringCore("part", element.getPartElement(), false);
47516        composeStringExtras("part", element.getPartElement(), false);
47517      }
47518      if (element.hasType()) {
47519        composeCoding("type", element.getType());
47520      }
47521  }
47522
47523  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponent(String name, MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
47524    if (element != null) {
47525      open(name);
47526      composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(element);
47527      close();
47528    }
47529  }
47530
47531  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
47532      composeBackbone(element);
47533      if (element.hasCountry()) {
47534        composeCodeableConcept("country", element.getCountry());
47535      }
47536      if (element.hasJurisdiction()) {
47537        composeCodeableConcept("jurisdiction", element.getJurisdiction());
47538      }
47539      if (element.hasLanguage()) {
47540        composeCodeableConcept("language", element.getLanguage());
47541      }
47542  }
47543
47544  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(String name, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
47545    if (element != null) {
47546      open(name);
47547      composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(element);
47548      close();
47549    }
47550  }
47551
47552  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
47553      composeBackbone(element);
47554      if (element.hasOperationType()) {
47555        composeCodeableConcept("operationType", element.getOperationType());
47556      }
47557      if (element.hasAuthorisationReferenceNumber()) {
47558        composeIdentifier("authorisationReferenceNumber", element.getAuthorisationReferenceNumber());
47559      }
47560      if (element.hasEffectiveDateElement()) {
47561        composeDateTimeCore("effectiveDate", element.getEffectiveDateElement(), false);
47562        composeDateTimeExtras("effectiveDate", element.getEffectiveDateElement(), false);
47563      }
47564      if (element.hasConfidentialityIndicator()) {
47565        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
47566      }
47567      if (element.hasManufacturer()) {
47568        openArray("manufacturer");
47569        for (Reference e : element.getManufacturer()) 
47570          composeReference(null, e);
47571        closeArray();
47572      };
47573      if (element.hasRegulator()) {
47574        composeReference("regulator", element.getRegulator());
47575      }
47576  }
47577
47578  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponent(String name, MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
47579    if (element != null) {
47580      open(name);
47581      composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(element);
47582      close();
47583    }
47584  }
47585
47586  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
47587      composeBackbone(element);
47588      if (element.hasIdentifier()) {
47589        openArray("identifier");
47590        for (Identifier e : element.getIdentifier()) 
47591          composeIdentifier(null, e);
47592        closeArray();
47593      };
47594      if (element.hasType()) {
47595        composeCodeableConcept("type", element.getType());
47596      }
47597      if (element.hasIntendedUse()) {
47598        composeCodeableConcept("intendedUse", element.getIntendedUse());
47599      }
47600      if (element.hasIndication()) {
47601        composeType("indication", element.getIndication());
47602      }
47603      if (element.hasStatus()) {
47604        composeCodeableConcept("status", element.getStatus());
47605      }
47606      if (element.hasDateElement()) {
47607        composeDateTimeCore("date", element.getDateElement(), false);
47608        composeDateTimeExtras("date", element.getDateElement(), false);
47609      }
47610      if (element.hasSpecies()) {
47611        composeCodeableConcept("species", element.getSpecies());
47612      }
47613  }
47614
47615  protected void composeMedicinalProductAuthorization(String name, MedicinalProductAuthorization element) throws IOException {
47616    if (element != null) {
47617      prop("resourceType", name);
47618      composeMedicinalProductAuthorizationInner(element);
47619    }
47620  }
47621
47622  protected void composeMedicinalProductAuthorizationInner(MedicinalProductAuthorization element) throws IOException {
47623      composeDomainResourceElements(element);
47624      if (element.hasIdentifier()) {
47625        openArray("identifier");
47626        for (Identifier e : element.getIdentifier()) 
47627          composeIdentifier(null, e);
47628        closeArray();
47629      };
47630      if (element.hasSubject()) {
47631        composeReference("subject", element.getSubject());
47632      }
47633      if (element.hasCountry()) {
47634        openArray("country");
47635        for (CodeableConcept e : element.getCountry()) 
47636          composeCodeableConcept(null, e);
47637        closeArray();
47638      };
47639      if (element.hasJurisdiction()) {
47640        openArray("jurisdiction");
47641        for (CodeableConcept e : element.getJurisdiction()) 
47642          composeCodeableConcept(null, e);
47643        closeArray();
47644      };
47645      if (element.hasStatus()) {
47646        composeCodeableConcept("status", element.getStatus());
47647      }
47648      if (element.hasStatusDateElement()) {
47649        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
47650        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
47651      }
47652      if (element.hasRestoreDateElement()) {
47653        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
47654        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
47655      }
47656      if (element.hasValidityPeriod()) {
47657        composePeriod("validityPeriod", element.getValidityPeriod());
47658      }
47659      if (element.hasDataExclusivityPeriod()) {
47660        composePeriod("dataExclusivityPeriod", element.getDataExclusivityPeriod());
47661      }
47662      if (element.hasDateOfFirstAuthorizationElement()) {
47663        composeDateTimeCore("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
47664        composeDateTimeExtras("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
47665      }
47666      if (element.hasInternationalBirthDateElement()) {
47667        composeDateTimeCore("internationalBirthDate", element.getInternationalBirthDateElement(), false);
47668        composeDateTimeExtras("internationalBirthDate", element.getInternationalBirthDateElement(), false);
47669      }
47670      if (element.hasLegalBasis()) {
47671        composeCodeableConcept("legalBasis", element.getLegalBasis());
47672      }
47673      if (element.hasJurisdictionalAuthorization()) {
47674        openArray("jurisdictionalAuthorization");
47675        for (MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent e : element.getJurisdictionalAuthorization()) 
47676          composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(null, e);
47677        closeArray();
47678      };
47679      if (element.hasHolder()) {
47680        composeReference("holder", element.getHolder());
47681      }
47682      if (element.hasRegulator()) {
47683        composeReference("regulator", element.getRegulator());
47684      }
47685      if (element.hasProcedure()) {
47686        composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent("procedure", element.getProcedure());
47687      }
47688  }
47689
47690  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
47691    if (element != null) {
47692      open(name);
47693      composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(element);
47694      close();
47695    }
47696  }
47697
47698  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
47699      composeBackbone(element);
47700      if (element.hasIdentifier()) {
47701        openArray("identifier");
47702        for (Identifier e : element.getIdentifier()) 
47703          composeIdentifier(null, e);
47704        closeArray();
47705      };
47706      if (element.hasCountry()) {
47707        composeCodeableConcept("country", element.getCountry());
47708      }
47709      if (element.hasJurisdiction()) {
47710        openArray("jurisdiction");
47711        for (CodeableConcept e : element.getJurisdiction()) 
47712          composeCodeableConcept(null, e);
47713        closeArray();
47714      };
47715      if (element.hasLegalStatusOfSupply()) {
47716        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
47717      }
47718      if (element.hasValidityPeriod()) {
47719        composePeriod("validityPeriod", element.getValidityPeriod());
47720      }
47721  }
47722
47723  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
47724    if (element != null) {
47725      open(name);
47726      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(element);
47727      close();
47728    }
47729  }
47730
47731  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
47732      composeBackbone(element);
47733      if (element.hasIdentifier()) {
47734        composeIdentifier("identifier", element.getIdentifier());
47735      }
47736      if (element.hasType()) {
47737        composeCodeableConcept("type", element.getType());
47738      }
47739      if (element.hasDate()) {
47740        composeType("date", element.getDate());
47741      }
47742      if (element.hasApplication()) {
47743        openArray("application");
47744        for (MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent e : element.getApplication()) 
47745          composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(null, e);
47746        closeArray();
47747      };
47748  }
47749
47750  protected void composeMedicinalProductContraindication(String name, MedicinalProductContraindication element) throws IOException {
47751    if (element != null) {
47752      prop("resourceType", name);
47753      composeMedicinalProductContraindicationInner(element);
47754    }
47755  }
47756
47757  protected void composeMedicinalProductContraindicationInner(MedicinalProductContraindication element) throws IOException {
47758      composeDomainResourceElements(element);
47759      if (element.hasSubject()) {
47760        openArray("subject");
47761        for (Reference e : element.getSubject()) 
47762          composeReference(null, e);
47763        closeArray();
47764      };
47765      if (element.hasDisease()) {
47766        composeCodeableConcept("disease", element.getDisease());
47767      }
47768      if (element.hasDiseaseStatus()) {
47769        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
47770      }
47771      if (element.hasComorbidity()) {
47772        openArray("comorbidity");
47773        for (CodeableConcept e : element.getComorbidity()) 
47774          composeCodeableConcept(null, e);
47775        closeArray();
47776      };
47777      if (element.hasTherapeuticIndication()) {
47778        openArray("therapeuticIndication");
47779        for (Reference e : element.getTherapeuticIndication()) 
47780          composeReference(null, e);
47781        closeArray();
47782      };
47783      if (element.hasOtherTherapy()) {
47784        openArray("otherTherapy");
47785        for (MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
47786          composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(null, e);
47787        closeArray();
47788      };
47789      if (element.hasPopulation()) {
47790        openArray("population");
47791        for (Population e : element.getPopulation()) 
47792          composePopulation(null, e);
47793        closeArray();
47794      };
47795  }
47796
47797  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(String name, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element) throws IOException {
47798    if (element != null) {
47799      open(name);
47800      composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(element);
47801      close();
47802    }
47803  }
47804
47805  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element) throws IOException {
47806      composeBackbone(element);
47807      if (element.hasTherapyRelationshipType()) {
47808        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
47809      }
47810      if (element.hasMedication()) {
47811        composeType("medication", element.getMedication());
47812      }
47813  }
47814
47815  protected void composeMedicinalProductIndication(String name, MedicinalProductIndication element) throws IOException {
47816    if (element != null) {
47817      prop("resourceType", name);
47818      composeMedicinalProductIndicationInner(element);
47819    }
47820  }
47821
47822  protected void composeMedicinalProductIndicationInner(MedicinalProductIndication element) throws IOException {
47823      composeDomainResourceElements(element);
47824      if (element.hasSubject()) {
47825        openArray("subject");
47826        for (Reference e : element.getSubject()) 
47827          composeReference(null, e);
47828        closeArray();
47829      };
47830      if (element.hasDiseaseSymptomProcedure()) {
47831        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
47832      }
47833      if (element.hasDiseaseStatus()) {
47834        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
47835      }
47836      if (element.hasComorbidity()) {
47837        openArray("comorbidity");
47838        for (CodeableConcept e : element.getComorbidity()) 
47839          composeCodeableConcept(null, e);
47840        closeArray();
47841      };
47842      if (element.hasIntendedEffect()) {
47843        composeCodeableConcept("intendedEffect", element.getIntendedEffect());
47844      }
47845      if (element.hasDuration()) {
47846        composeQuantity("duration", element.getDuration());
47847      }
47848      if (element.hasOtherTherapy()) {
47849        openArray("otherTherapy");
47850        for (MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent e : element.getOtherTherapy()) 
47851          composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(null, e);
47852        closeArray();
47853      };
47854      if (element.hasUndesirableEffect()) {
47855        openArray("undesirableEffect");
47856        for (Reference e : element.getUndesirableEffect()) 
47857          composeReference(null, e);
47858        closeArray();
47859      };
47860      if (element.hasPopulation()) {
47861        openArray("population");
47862        for (Population e : element.getPopulation()) 
47863          composePopulation(null, e);
47864        closeArray();
47865      };
47866  }
47867
47868  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(String name, MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
47869    if (element != null) {
47870      open(name);
47871      composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(element);
47872      close();
47873    }
47874  }
47875
47876  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
47877      composeBackbone(element);
47878      if (element.hasTherapyRelationshipType()) {
47879        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
47880      }
47881      if (element.hasMedication()) {
47882        composeType("medication", element.getMedication());
47883      }
47884  }
47885
47886  protected void composeMedicinalProductIngredient(String name, MedicinalProductIngredient element) throws IOException {
47887    if (element != null) {
47888      prop("resourceType", name);
47889      composeMedicinalProductIngredientInner(element);
47890    }
47891  }
47892
47893  protected void composeMedicinalProductIngredientInner(MedicinalProductIngredient element) throws IOException {
47894      composeDomainResourceElements(element);
47895      if (element.hasIdentifier()) {
47896        composeIdentifier("identifier", element.getIdentifier());
47897      }
47898      if (element.hasRole()) {
47899        composeCodeableConcept("role", element.getRole());
47900      }
47901      if (element.hasAllergenicIndicatorElement()) {
47902        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
47903        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
47904      }
47905      if (element.hasManufacturer()) {
47906        openArray("manufacturer");
47907        for (Reference e : element.getManufacturer()) 
47908          composeReference(null, e);
47909        closeArray();
47910      };
47911      if (element.hasSpecifiedSubstance()) {
47912        openArray("specifiedSubstance");
47913        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent e : element.getSpecifiedSubstance()) 
47914          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(null, e);
47915        closeArray();
47916      };
47917      if (element.hasSubstance()) {
47918        composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent("substance", element.getSubstance());
47919      }
47920  }
47921
47922  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
47923    if (element != null) {
47924      open(name);
47925      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(element);
47926      close();
47927    }
47928  }
47929
47930  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
47931      composeBackbone(element);
47932      if (element.hasCode()) {
47933        composeCodeableConcept("code", element.getCode());
47934      }
47935      if (element.hasGroup()) {
47936        composeCodeableConcept("group", element.getGroup());
47937      }
47938      if (element.hasConfidentiality()) {
47939        composeCodeableConcept("confidentiality", element.getConfidentiality());
47940      }
47941      if (element.hasStrength()) {
47942        openArray("strength");
47943        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
47944          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
47945        closeArray();
47946      };
47947  }
47948
47949  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
47950    if (element != null) {
47951      open(name);
47952      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(element);
47953      close();
47954    }
47955  }
47956
47957  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
47958      composeBackbone(element);
47959      if (element.hasPresentation()) {
47960        composeRatio("presentation", element.getPresentation());
47961      }
47962      if (element.hasPresentationLowLimit()) {
47963        composeRatio("presentationLowLimit", element.getPresentationLowLimit());
47964      }
47965      if (element.hasConcentration()) {
47966        composeRatio("concentration", element.getConcentration());
47967      }
47968      if (element.hasConcentrationLowLimit()) {
47969        composeRatio("concentrationLowLimit", element.getConcentrationLowLimit());
47970      }
47971      if (element.hasMeasurementPointElement()) {
47972        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
47973        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
47974      }
47975      if (element.hasCountry()) {
47976        openArray("country");
47977        for (CodeableConcept e : element.getCountry()) 
47978          composeCodeableConcept(null, e);
47979        closeArray();
47980      };
47981      if (element.hasReferenceStrength()) {
47982        openArray("referenceStrength");
47983        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
47984          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(null, e);
47985        closeArray();
47986      };
47987  }
47988
47989  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
47990    if (element != null) {
47991      open(name);
47992      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(element);
47993      close();
47994    }
47995  }
47996
47997  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
47998      composeBackbone(element);
47999      if (element.hasSubstance()) {
48000        composeCodeableConcept("substance", element.getSubstance());
48001      }
48002      if (element.hasStrength()) {
48003        composeRatio("strength", element.getStrength());
48004      }
48005      if (element.hasStrengthLowLimit()) {
48006        composeRatio("strengthLowLimit", element.getStrengthLowLimit());
48007      }
48008      if (element.hasMeasurementPointElement()) {
48009        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
48010        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
48011      }
48012      if (element.hasCountry()) {
48013        openArray("country");
48014        for (CodeableConcept e : element.getCountry()) 
48015          composeCodeableConcept(null, e);
48016        closeArray();
48017      };
48018  }
48019
48020  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
48021    if (element != null) {
48022      open(name);
48023      composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(element);
48024      close();
48025    }
48026  }
48027
48028  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
48029      composeBackbone(element);
48030      if (element.hasCode()) {
48031        composeCodeableConcept("code", element.getCode());
48032      }
48033      if (element.hasStrength()) {
48034        openArray("strength");
48035        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
48036          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
48037        closeArray();
48038      };
48039  }
48040
48041  protected void composeMedicinalProductInteraction(String name, MedicinalProductInteraction element) throws IOException {
48042    if (element != null) {
48043      prop("resourceType", name);
48044      composeMedicinalProductInteractionInner(element);
48045    }
48046  }
48047
48048  protected void composeMedicinalProductInteractionInner(MedicinalProductInteraction element) throws IOException {
48049      composeDomainResourceElements(element);
48050      if (element.hasSubject()) {
48051        openArray("subject");
48052        for (Reference e : element.getSubject()) 
48053          composeReference(null, e);
48054        closeArray();
48055      };
48056      if (element.hasDescriptionElement()) {
48057        composeStringCore("description", element.getDescriptionElement(), false);
48058        composeStringExtras("description", element.getDescriptionElement(), false);
48059      }
48060      if (element.hasInteractant()) {
48061        openArray("interactant");
48062        for (MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent e : element.getInteractant()) 
48063          composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(null, e);
48064        closeArray();
48065      };
48066      if (element.hasType()) {
48067        composeCodeableConcept("type", element.getType());
48068      }
48069      if (element.hasEffect()) {
48070        composeCodeableConcept("effect", element.getEffect());
48071      }
48072      if (element.hasIncidence()) {
48073        composeCodeableConcept("incidence", element.getIncidence());
48074      }
48075      if (element.hasManagement()) {
48076        composeCodeableConcept("management", element.getManagement());
48077      }
48078  }
48079
48080  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(String name, MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
48081    if (element != null) {
48082      open(name);
48083      composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentInner(element);
48084      close();
48085    }
48086  }
48087
48088  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentInner(MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
48089      composeBackbone(element);
48090      if (element.hasItem()) {
48091        composeType("item", element.getItem());
48092      }
48093  }
48094
48095  protected void composeMedicinalProductManufactured(String name, MedicinalProductManufactured element) throws IOException {
48096    if (element != null) {
48097      prop("resourceType", name);
48098      composeMedicinalProductManufacturedInner(element);
48099    }
48100  }
48101
48102  protected void composeMedicinalProductManufacturedInner(MedicinalProductManufactured element) throws IOException {
48103      composeDomainResourceElements(element);
48104      if (element.hasManufacturedDoseForm()) {
48105        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
48106      }
48107      if (element.hasUnitOfPresentation()) {
48108        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
48109      }
48110      if (element.hasQuantity()) {
48111        composeQuantity("quantity", element.getQuantity());
48112      }
48113      if (element.hasManufacturer()) {
48114        openArray("manufacturer");
48115        for (Reference e : element.getManufacturer()) 
48116          composeReference(null, e);
48117        closeArray();
48118      };
48119      if (element.hasIngredient()) {
48120        openArray("ingredient");
48121        for (Reference e : element.getIngredient()) 
48122          composeReference(null, e);
48123        closeArray();
48124      };
48125      if (element.hasPhysicalCharacteristics()) {
48126        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
48127      }
48128      if (element.hasOtherCharacteristics()) {
48129        openArray("otherCharacteristics");
48130        for (CodeableConcept e : element.getOtherCharacteristics()) 
48131          composeCodeableConcept(null, e);
48132        closeArray();
48133      };
48134  }
48135
48136  protected void composeMedicinalProductPackaged(String name, MedicinalProductPackaged element) throws IOException {
48137    if (element != null) {
48138      prop("resourceType", name);
48139      composeMedicinalProductPackagedInner(element);
48140    }
48141  }
48142
48143  protected void composeMedicinalProductPackagedInner(MedicinalProductPackaged element) throws IOException {
48144      composeDomainResourceElements(element);
48145      if (element.hasIdentifier()) {
48146        openArray("identifier");
48147        for (Identifier e : element.getIdentifier()) 
48148          composeIdentifier(null, e);
48149        closeArray();
48150      };
48151      if (element.hasSubject()) {
48152        openArray("subject");
48153        for (Reference e : element.getSubject()) 
48154          composeReference(null, e);
48155        closeArray();
48156      };
48157      if (element.hasDescriptionElement()) {
48158        composeStringCore("description", element.getDescriptionElement(), false);
48159        composeStringExtras("description", element.getDescriptionElement(), false);
48160      }
48161      if (element.hasLegalStatusOfSupply()) {
48162        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
48163      }
48164      if (element.hasMarketingStatus()) {
48165        openArray("marketingStatus");
48166        for (MarketingStatus e : element.getMarketingStatus()) 
48167          composeMarketingStatus(null, e);
48168        closeArray();
48169      };
48170      if (element.hasMarketingAuthorization()) {
48171        composeReference("marketingAuthorization", element.getMarketingAuthorization());
48172      }
48173      if (element.hasManufacturer()) {
48174        openArray("manufacturer");
48175        for (Reference e : element.getManufacturer()) 
48176          composeReference(null, e);
48177        closeArray();
48178      };
48179      if (element.hasBatchIdentifier()) {
48180        openArray("batchIdentifier");
48181        for (MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent e : element.getBatchIdentifier()) 
48182          composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(null, e);
48183        closeArray();
48184      };
48185      if (element.hasPackageItem()) {
48186        openArray("packageItem");
48187        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
48188          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
48189        closeArray();
48190      };
48191  }
48192
48193  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
48194    if (element != null) {
48195      open(name);
48196      composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(element);
48197      close();
48198    }
48199  }
48200
48201  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
48202      composeBackbone(element);
48203      if (element.hasOuterPackaging()) {
48204        composeIdentifier("outerPackaging", element.getOuterPackaging());
48205      }
48206      if (element.hasImmediatePackaging()) {
48207        composeIdentifier("immediatePackaging", element.getImmediatePackaging());
48208      }
48209  }
48210
48211  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
48212    if (element != null) {
48213      open(name);
48214      composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(element);
48215      close();
48216    }
48217  }
48218
48219  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
48220      composeBackbone(element);
48221      if (element.hasIdentifier()) {
48222        openArray("identifier");
48223        for (Identifier e : element.getIdentifier()) 
48224          composeIdentifier(null, e);
48225        closeArray();
48226      };
48227      if (element.hasType()) {
48228        composeCodeableConcept("type", element.getType());
48229      }
48230      if (element.hasQuantity()) {
48231        composeQuantity("quantity", element.getQuantity());
48232      }
48233      if (element.hasMaterial()) {
48234        openArray("material");
48235        for (CodeableConcept e : element.getMaterial()) 
48236          composeCodeableConcept(null, e);
48237        closeArray();
48238      };
48239      if (element.hasAlternateMaterial()) {
48240        openArray("alternateMaterial");
48241        for (CodeableConcept e : element.getAlternateMaterial()) 
48242          composeCodeableConcept(null, e);
48243        closeArray();
48244      };
48245      if (element.hasDevice()) {
48246        openArray("device");
48247        for (Reference e : element.getDevice()) 
48248          composeReference(null, e);
48249        closeArray();
48250      };
48251      if (element.hasManufacturedItem()) {
48252        openArray("manufacturedItem");
48253        for (Reference e : element.getManufacturedItem()) 
48254          composeReference(null, e);
48255        closeArray();
48256      };
48257      if (element.hasPackageItem()) {
48258        openArray("packageItem");
48259        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
48260          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
48261        closeArray();
48262      };
48263      if (element.hasPhysicalCharacteristics()) {
48264        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
48265      }
48266      if (element.hasOtherCharacteristics()) {
48267        openArray("otherCharacteristics");
48268        for (CodeableConcept e : element.getOtherCharacteristics()) 
48269          composeCodeableConcept(null, e);
48270        closeArray();
48271      };
48272      if (element.hasShelfLifeStorage()) {
48273        openArray("shelfLifeStorage");
48274        for (ProductShelfLife e : element.getShelfLifeStorage()) 
48275          composeProductShelfLife(null, e);
48276        closeArray();
48277      };
48278      if (element.hasManufacturer()) {
48279        openArray("manufacturer");
48280        for (Reference e : element.getManufacturer()) 
48281          composeReference(null, e);
48282        closeArray();
48283      };
48284  }
48285
48286  protected void composeMedicinalProductPharmaceutical(String name, MedicinalProductPharmaceutical element) throws IOException {
48287    if (element != null) {
48288      prop("resourceType", name);
48289      composeMedicinalProductPharmaceuticalInner(element);
48290    }
48291  }
48292
48293  protected void composeMedicinalProductPharmaceuticalInner(MedicinalProductPharmaceutical element) throws IOException {
48294      composeDomainResourceElements(element);
48295      if (element.hasIdentifier()) {
48296        openArray("identifier");
48297        for (Identifier e : element.getIdentifier()) 
48298          composeIdentifier(null, e);
48299        closeArray();
48300      };
48301      if (element.hasAdministrableDoseForm()) {
48302        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
48303      }
48304      if (element.hasUnitOfPresentation()) {
48305        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
48306      }
48307      if (element.hasIngredient()) {
48308        openArray("ingredient");
48309        for (Reference e : element.getIngredient()) 
48310          composeReference(null, e);
48311        closeArray();
48312      };
48313      if (element.hasDevice()) {
48314        openArray("device");
48315        for (Reference e : element.getDevice()) 
48316          composeReference(null, e);
48317        closeArray();
48318      };
48319      if (element.hasCharacteristics()) {
48320        openArray("characteristics");
48321        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent e : element.getCharacteristics()) 
48322          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(null, e);
48323        closeArray();
48324      };
48325      if (element.hasRouteOfAdministration()) {
48326        openArray("routeOfAdministration");
48327        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
48328          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(null, e);
48329        closeArray();
48330      };
48331  }
48332
48333  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
48334    if (element != null) {
48335      open(name);
48336      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(element);
48337      close();
48338    }
48339  }
48340
48341  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
48342      composeBackbone(element);
48343      if (element.hasCode()) {
48344        composeCodeableConcept("code", element.getCode());
48345      }
48346      if (element.hasStatus()) {
48347        composeCodeableConcept("status", element.getStatus());
48348      }
48349  }
48350
48351  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element) throws IOException {
48352    if (element != null) {
48353      open(name);
48354      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(element);
48355      close();
48356    }
48357  }
48358
48359  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element) throws IOException {
48360      composeBackbone(element);
48361      if (element.hasCode()) {
48362        composeCodeableConcept("code", element.getCode());
48363      }
48364      if (element.hasFirstDose()) {
48365        composeQuantity("firstDose", element.getFirstDose());
48366      }
48367      if (element.hasMaxSingleDose()) {
48368        composeQuantity("maxSingleDose", element.getMaxSingleDose());
48369      }
48370      if (element.hasMaxDosePerDay()) {
48371        composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
48372      }
48373      if (element.hasMaxDosePerTreatmentPeriod()) {
48374        composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
48375      }
48376      if (element.hasMaxTreatmentPeriod()) {
48377        composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
48378      }
48379      if (element.hasTargetSpecies()) {
48380        openArray("targetSpecies");
48381        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
48382          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(null, e);
48383        closeArray();
48384      };
48385  }
48386
48387  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
48388    if (element != null) {
48389      open(name);
48390      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(element);
48391      close();
48392    }
48393  }
48394
48395  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
48396      composeBackbone(element);
48397      if (element.hasCode()) {
48398        composeCodeableConcept("code", element.getCode());
48399      }
48400      if (element.hasWithdrawalPeriod()) {
48401        openArray("withdrawalPeriod");
48402        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
48403          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(null, e);
48404        closeArray();
48405      };
48406  }
48407
48408  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
48409    if (element != null) {
48410      open(name);
48411      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(element);
48412      close();
48413    }
48414  }
48415
48416  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
48417      composeBackbone(element);
48418      if (element.hasTissue()) {
48419        composeCodeableConcept("tissue", element.getTissue());
48420      }
48421      if (element.hasValue()) {
48422        composeQuantity("value", element.getValue());
48423      }
48424      if (element.hasSupportingInformationElement()) {
48425        composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
48426        composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
48427      }
48428  }
48429
48430  protected void composeMedicinalProductUndesirableEffect(String name, MedicinalProductUndesirableEffect element) throws IOException {
48431    if (element != null) {
48432      prop("resourceType", name);
48433      composeMedicinalProductUndesirableEffectInner(element);
48434    }
48435  }
48436
48437  protected void composeMedicinalProductUndesirableEffectInner(MedicinalProductUndesirableEffect element) throws IOException {
48438      composeDomainResourceElements(element);
48439      if (element.hasSubject()) {
48440        openArray("subject");
48441        for (Reference e : element.getSubject()) 
48442          composeReference(null, e);
48443        closeArray();
48444      };
48445      if (element.hasSymptomConditionEffect()) {
48446        composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
48447      }
48448      if (element.hasClassification()) {
48449        composeCodeableConcept("classification", element.getClassification());
48450      }
48451      if (element.hasFrequencyOfOccurrence()) {
48452        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
48453      }
48454      if (element.hasPopulation()) {
48455        openArray("population");
48456        for (Population e : element.getPopulation()) 
48457          composePopulation(null, e);
48458        closeArray();
48459      };
48460  }
48461
48462  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
48463    if (element != null) {
48464      prop("resourceType", name);
48465      composeMessageDefinitionInner(element);
48466    }
48467  }
48468
48469  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
48470      composeDomainResourceElements(element);
48471      if (element.hasUrlElement()) {
48472        composeUriCore("url", element.getUrlElement(), false);
48473        composeUriExtras("url", element.getUrlElement(), false);
48474      }
48475      if (element.hasIdentifier()) {
48476        openArray("identifier");
48477        for (Identifier e : element.getIdentifier()) 
48478          composeIdentifier(null, e);
48479        closeArray();
48480      };
48481      if (element.hasVersionElement()) {
48482        composeStringCore("version", element.getVersionElement(), false);
48483        composeStringExtras("version", element.getVersionElement(), false);
48484      }
48485      if (element.hasNameElement()) {
48486        composeStringCore("name", element.getNameElement(), false);
48487        composeStringExtras("name", element.getNameElement(), false);
48488      }
48489      if (element.hasTitleElement()) {
48490        composeStringCore("title", element.getTitleElement(), false);
48491        composeStringExtras("title", element.getTitleElement(), false);
48492      }
48493      if (element.hasReplaces()) {
48494        openArray("replaces");
48495        for (CanonicalType e : element.getReplaces()) 
48496          composeCanonicalCore(null, e, true);
48497        closeArray();
48498        if (anyHasExtras(element.getReplaces())) {
48499          openArray("_replaces");
48500          for (CanonicalType e : element.getReplaces()) 
48501            composeCanonicalExtras(null, e, true);
48502          closeArray();
48503        }
48504      };
48505      if (element.hasStatusElement()) {
48506        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48507        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48508      }
48509      if (element.hasExperimentalElement()) {
48510        composeBooleanCore("experimental", element.getExperimentalElement(), false);
48511        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
48512      }
48513      if (element.hasDateElement()) {
48514        composeDateTimeCore("date", element.getDateElement(), false);
48515        composeDateTimeExtras("date", element.getDateElement(), false);
48516      }
48517      if (element.hasPublisherElement()) {
48518        composeStringCore("publisher", element.getPublisherElement(), false);
48519        composeStringExtras("publisher", element.getPublisherElement(), false);
48520      }
48521      if (element.hasContact()) {
48522        openArray("contact");
48523        for (ContactDetail e : element.getContact()) 
48524          composeContactDetail(null, e);
48525        closeArray();
48526      };
48527      if (element.hasDescriptionElement()) {
48528        composeMarkdownCore("description", element.getDescriptionElement(), false);
48529        composeMarkdownExtras("description", element.getDescriptionElement(), false);
48530      }
48531      if (element.hasUseContext()) {
48532        openArray("useContext");
48533        for (UsageContext e : element.getUseContext()) 
48534          composeUsageContext(null, e);
48535        closeArray();
48536      };
48537      if (element.hasJurisdiction()) {
48538        openArray("jurisdiction");
48539        for (CodeableConcept e : element.getJurisdiction()) 
48540          composeCodeableConcept(null, e);
48541        closeArray();
48542      };
48543      if (element.hasPurposeElement()) {
48544        composeMarkdownCore("purpose", element.getPurposeElement(), false);
48545        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
48546      }
48547      if (element.hasCopyrightElement()) {
48548        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
48549        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
48550      }
48551      if (element.hasBaseElement()) {
48552        composeCanonicalCore("base", element.getBaseElement(), false);
48553        composeCanonicalExtras("base", element.getBaseElement(), false);
48554      }
48555      if (element.hasParent()) {
48556        openArray("parent");
48557        for (CanonicalType e : element.getParent()) 
48558          composeCanonicalCore(null, e, true);
48559        closeArray();
48560        if (anyHasExtras(element.getParent())) {
48561          openArray("_parent");
48562          for (CanonicalType e : element.getParent()) 
48563            composeCanonicalExtras(null, e, true);
48564          closeArray();
48565        }
48566      };
48567      if (element.hasEvent()) {
48568        composeType("event", element.getEvent());
48569      }
48570      if (element.hasCategoryElement()) {
48571        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
48572        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
48573      }
48574      if (element.hasFocus()) {
48575        openArray("focus");
48576        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
48577          composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
48578        closeArray();
48579      };
48580      if (element.hasResponseRequiredElement()) {
48581        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
48582        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
48583      }
48584      if (element.hasAllowedResponse()) {
48585        openArray("allowedResponse");
48586        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
48587          composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
48588        closeArray();
48589      };
48590      if (element.hasGraph()) {
48591        openArray("graph");
48592        for (CanonicalType e : element.getGraph()) 
48593          composeCanonicalCore(null, e, true);
48594        closeArray();
48595        if (anyHasExtras(element.getGraph())) {
48596          openArray("_graph");
48597          for (CanonicalType e : element.getGraph()) 
48598            composeCanonicalExtras(null, e, true);
48599          closeArray();
48600        }
48601      };
48602  }
48603
48604  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
48605    if (element != null) {
48606      open(name);
48607      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
48608      close();
48609    }
48610  }
48611
48612  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
48613      composeBackbone(element);
48614      if (element.hasCodeElement()) {
48615        composeCodeCore("code", element.getCodeElement(), false);
48616        composeCodeExtras("code", element.getCodeElement(), false);
48617      }
48618      if (element.hasProfileElement()) {
48619        composeCanonicalCore("profile", element.getProfileElement(), false);
48620        composeCanonicalExtras("profile", element.getProfileElement(), false);
48621      }
48622      if (element.hasMinElement()) {
48623        composeUnsignedIntCore("min", element.getMinElement(), false);
48624        composeUnsignedIntExtras("min", element.getMinElement(), false);
48625      }
48626      if (element.hasMaxElement()) {
48627        composeStringCore("max", element.getMaxElement(), false);
48628        composeStringExtras("max", element.getMaxElement(), false);
48629      }
48630  }
48631
48632  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
48633    if (element != null) {
48634      open(name);
48635      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
48636      close();
48637    }
48638  }
48639
48640  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
48641      composeBackbone(element);
48642      if (element.hasMessageElement()) {
48643        composeCanonicalCore("message", element.getMessageElement(), false);
48644        composeCanonicalExtras("message", element.getMessageElement(), false);
48645      }
48646      if (element.hasSituationElement()) {
48647        composeMarkdownCore("situation", element.getSituationElement(), false);
48648        composeMarkdownExtras("situation", element.getSituationElement(), false);
48649      }
48650  }
48651
48652  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
48653    if (element != null) {
48654      prop("resourceType", name);
48655      composeMessageHeaderInner(element);
48656    }
48657  }
48658
48659  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
48660      composeDomainResourceElements(element);
48661      if (element.hasEvent()) {
48662        composeType("event", element.getEvent());
48663      }
48664      if (element.hasDestination()) {
48665        openArray("destination");
48666        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
48667          composeMessageHeaderMessageDestinationComponent(null, e);
48668        closeArray();
48669      };
48670      if (element.hasSender()) {
48671        composeReference("sender", element.getSender());
48672      }
48673      if (element.hasEnterer()) {
48674        composeReference("enterer", element.getEnterer());
48675      }
48676      if (element.hasAuthor()) {
48677        composeReference("author", element.getAuthor());
48678      }
48679      if (element.hasSource()) {
48680        composeMessageHeaderMessageSourceComponent("source", element.getSource());
48681      }
48682      if (element.hasResponsible()) {
48683        composeReference("responsible", element.getResponsible());
48684      }
48685      if (element.hasReason()) {
48686        composeCodeableConcept("reason", element.getReason());
48687      }
48688      if (element.hasResponse()) {
48689        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
48690      }
48691      if (element.hasFocus()) {
48692        openArray("focus");
48693        for (Reference e : element.getFocus()) 
48694          composeReference(null, e);
48695        closeArray();
48696      };
48697      if (element.hasDefinitionElement()) {
48698        composeCanonicalCore("definition", element.getDefinitionElement(), false);
48699        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
48700      }
48701  }
48702
48703  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
48704    if (element != null) {
48705      open(name);
48706      composeMessageHeaderMessageDestinationComponentInner(element);
48707      close();
48708    }
48709  }
48710
48711  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
48712      composeBackbone(element);
48713      if (element.hasNameElement()) {
48714        composeStringCore("name", element.getNameElement(), false);
48715        composeStringExtras("name", element.getNameElement(), false);
48716      }
48717      if (element.hasTarget()) {
48718        composeReference("target", element.getTarget());
48719      }
48720      if (element.hasEndpointElement()) {
48721        composeUrlCore("endpoint", element.getEndpointElement(), false);
48722        composeUrlExtras("endpoint", element.getEndpointElement(), false);
48723      }
48724      if (element.hasReceiver()) {
48725        composeReference("receiver", element.getReceiver());
48726      }
48727  }
48728
48729  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
48730    if (element != null) {
48731      open(name);
48732      composeMessageHeaderMessageSourceComponentInner(element);
48733      close();
48734    }
48735  }
48736
48737  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
48738      composeBackbone(element);
48739      if (element.hasNameElement()) {
48740        composeStringCore("name", element.getNameElement(), false);
48741        composeStringExtras("name", element.getNameElement(), false);
48742      }
48743      if (element.hasSoftwareElement()) {
48744        composeStringCore("software", element.getSoftwareElement(), false);
48745        composeStringExtras("software", element.getSoftwareElement(), false);
48746      }
48747      if (element.hasVersionElement()) {
48748        composeStringCore("version", element.getVersionElement(), false);
48749        composeStringExtras("version", element.getVersionElement(), false);
48750      }
48751      if (element.hasContact()) {
48752        composeContactPoint("contact", element.getContact());
48753      }
48754      if (element.hasEndpointElement()) {
48755        composeUrlCore("endpoint", element.getEndpointElement(), false);
48756        composeUrlExtras("endpoint", element.getEndpointElement(), false);
48757      }
48758  }
48759
48760  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
48761    if (element != null) {
48762      open(name);
48763      composeMessageHeaderMessageHeaderResponseComponentInner(element);
48764      close();
48765    }
48766  }
48767
48768  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
48769      composeBackbone(element);
48770      if (element.hasIdentifierElement()) {
48771        composeIdCore("identifier", element.getIdentifierElement(), false);
48772        composeIdExtras("identifier", element.getIdentifierElement(), false);
48773      }
48774      if (element.hasCodeElement()) {
48775        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
48776        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
48777      }
48778      if (element.hasDetails()) {
48779        composeReference("details", element.getDetails());
48780      }
48781  }
48782
48783  protected void composeMolecularSequence(String name, MolecularSequence element) throws IOException {
48784    if (element != null) {
48785      prop("resourceType", name);
48786      composeMolecularSequenceInner(element);
48787    }
48788  }
48789
48790  protected void composeMolecularSequenceInner(MolecularSequence element) throws IOException {
48791      composeDomainResourceElements(element);
48792      if (element.hasIdentifier()) {
48793        openArray("identifier");
48794        for (Identifier e : element.getIdentifier()) 
48795          composeIdentifier(null, e);
48796        closeArray();
48797      };
48798      if (element.hasTypeElement()) {
48799        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
48800        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
48801      }
48802      if (element.hasCoordinateSystemElement()) {
48803        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
48804        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
48805      }
48806      if (element.hasPatient()) {
48807        composeReference("patient", element.getPatient());
48808      }
48809      if (element.hasSpecimen()) {
48810        composeReference("specimen", element.getSpecimen());
48811      }
48812      if (element.hasDevice()) {
48813        composeReference("device", element.getDevice());
48814      }
48815      if (element.hasPerformer()) {
48816        composeReference("performer", element.getPerformer());
48817      }
48818      if (element.hasQuantity()) {
48819        composeQuantity("quantity", element.getQuantity());
48820      }
48821      if (element.hasReferenceSeq()) {
48822        composeMolecularSequenceMolecularSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
48823      }
48824      if (element.hasVariant()) {
48825        openArray("variant");
48826        for (MolecularSequence.MolecularSequenceVariantComponent e : element.getVariant()) 
48827          composeMolecularSequenceMolecularSequenceVariantComponent(null, e);
48828        closeArray();
48829      };
48830      if (element.hasObservedSeqElement()) {
48831        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
48832        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
48833      }
48834      if (element.hasQuality()) {
48835        openArray("quality");
48836        for (MolecularSequence.MolecularSequenceQualityComponent e : element.getQuality()) 
48837          composeMolecularSequenceMolecularSequenceQualityComponent(null, e);
48838        closeArray();
48839      };
48840      if (element.hasReadCoverageElement()) {
48841        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
48842        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
48843      }
48844      if (element.hasRepository()) {
48845        openArray("repository");
48846        for (MolecularSequence.MolecularSequenceRepositoryComponent e : element.getRepository()) 
48847          composeMolecularSequenceMolecularSequenceRepositoryComponent(null, e);
48848        closeArray();
48849      };
48850      if (element.hasPointer()) {
48851        openArray("pointer");
48852        for (Reference e : element.getPointer()) 
48853          composeReference(null, e);
48854        closeArray();
48855      };
48856      if (element.hasStructureVariant()) {
48857        openArray("structureVariant");
48858        for (MolecularSequence.MolecularSequenceStructureVariantComponent e : element.getStructureVariant()) 
48859          composeMolecularSequenceMolecularSequenceStructureVariantComponent(null, e);
48860        closeArray();
48861      };
48862  }
48863
48864  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponent(String name, MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
48865    if (element != null) {
48866      open(name);
48867      composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(element);
48868      close();
48869    }
48870  }
48871
48872  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
48873      composeBackbone(element);
48874      if (element.hasChromosome()) {
48875        composeCodeableConcept("chromosome", element.getChromosome());
48876      }
48877      if (element.hasGenomeBuildElement()) {
48878        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
48879        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
48880      }
48881      if (element.hasOrientationElement()) {
48882        composeEnumerationCore("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
48883        composeEnumerationExtras("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
48884      }
48885      if (element.hasReferenceSeqId()) {
48886        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
48887      }
48888      if (element.hasReferenceSeqPointer()) {
48889        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
48890      }
48891      if (element.hasReferenceSeqStringElement()) {
48892        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
48893        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
48894      }
48895      if (element.hasStrandElement()) {
48896        composeEnumerationCore("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
48897        composeEnumerationExtras("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
48898      }
48899      if (element.hasWindowStartElement()) {
48900        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
48901        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
48902      }
48903      if (element.hasWindowEndElement()) {
48904        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
48905        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
48906      }
48907  }
48908
48909  protected void composeMolecularSequenceMolecularSequenceVariantComponent(String name, MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
48910    if (element != null) {
48911      open(name);
48912      composeMolecularSequenceMolecularSequenceVariantComponentInner(element);
48913      close();
48914    }
48915  }
48916
48917  protected void composeMolecularSequenceMolecularSequenceVariantComponentInner(MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
48918      composeBackbone(element);
48919      if (element.hasStartElement()) {
48920        composeIntegerCore("start", element.getStartElement(), false);
48921        composeIntegerExtras("start", element.getStartElement(), false);
48922      }
48923      if (element.hasEndElement()) {
48924        composeIntegerCore("end", element.getEndElement(), false);
48925        composeIntegerExtras("end", element.getEndElement(), false);
48926      }
48927      if (element.hasObservedAlleleElement()) {
48928        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
48929        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
48930      }
48931      if (element.hasReferenceAlleleElement()) {
48932        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
48933        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
48934      }
48935      if (element.hasCigarElement()) {
48936        composeStringCore("cigar", element.getCigarElement(), false);
48937        composeStringExtras("cigar", element.getCigarElement(), false);
48938      }
48939      if (element.hasVariantPointer()) {
48940        composeReference("variantPointer", element.getVariantPointer());
48941      }
48942  }
48943
48944  protected void composeMolecularSequenceMolecularSequenceQualityComponent(String name, MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
48945    if (element != null) {
48946      open(name);
48947      composeMolecularSequenceMolecularSequenceQualityComponentInner(element);
48948      close();
48949    }
48950  }
48951
48952  protected void composeMolecularSequenceMolecularSequenceQualityComponentInner(MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
48953      composeBackbone(element);
48954      if (element.hasTypeElement()) {
48955        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
48956        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
48957      }
48958      if (element.hasStandardSequence()) {
48959        composeCodeableConcept("standardSequence", element.getStandardSequence());
48960      }
48961      if (element.hasStartElement()) {
48962        composeIntegerCore("start", element.getStartElement(), false);
48963        composeIntegerExtras("start", element.getStartElement(), false);
48964      }
48965      if (element.hasEndElement()) {
48966        composeIntegerCore("end", element.getEndElement(), false);
48967        composeIntegerExtras("end", element.getEndElement(), false);
48968      }
48969      if (element.hasScore()) {
48970        composeQuantity("score", element.getScore());
48971      }
48972      if (element.hasMethod()) {
48973        composeCodeableConcept("method", element.getMethod());
48974      }
48975      if (element.hasTruthTPElement()) {
48976        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
48977        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
48978      }
48979      if (element.hasQueryTPElement()) {
48980        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
48981        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
48982      }
48983      if (element.hasTruthFNElement()) {
48984        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
48985        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
48986      }
48987      if (element.hasQueryFPElement()) {
48988        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
48989        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
48990      }
48991      if (element.hasGtFPElement()) {
48992        composeDecimalCore("gtFP", element.getGtFPElement(), false);
48993        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
48994      }
48995      if (element.hasPrecisionElement()) {
48996        composeDecimalCore("precision", element.getPrecisionElement(), false);
48997        composeDecimalExtras("precision", element.getPrecisionElement(), false);
48998      }
48999      if (element.hasRecallElement()) {
49000        composeDecimalCore("recall", element.getRecallElement(), false);
49001        composeDecimalExtras("recall", element.getRecallElement(), false);
49002      }
49003      if (element.hasFScoreElement()) {
49004        composeDecimalCore("fScore", element.getFScoreElement(), false);
49005        composeDecimalExtras("fScore", element.getFScoreElement(), false);
49006      }
49007      if (element.hasRoc()) {
49008        composeMolecularSequenceMolecularSequenceQualityRocComponent("roc", element.getRoc());
49009      }
49010  }
49011
49012  protected void composeMolecularSequenceMolecularSequenceQualityRocComponent(String name, MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
49013    if (element != null) {
49014      open(name);
49015      composeMolecularSequenceMolecularSequenceQualityRocComponentInner(element);
49016      close();
49017    }
49018  }
49019
49020  protected void composeMolecularSequenceMolecularSequenceQualityRocComponentInner(MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
49021      composeBackbone(element);
49022      if (element.hasScore()) {
49023        openArray("score");
49024        for (IntegerType e : element.getScore()) 
49025          composeIntegerCore(null, e, true);
49026        closeArray();
49027        if (anyHasExtras(element.getScore())) {
49028          openArray("_score");
49029          for (IntegerType e : element.getScore()) 
49030            composeIntegerExtras(null, e, true);
49031          closeArray();
49032        }
49033      };
49034      if (element.hasNumTP()) {
49035        openArray("numTP");
49036        for (IntegerType e : element.getNumTP()) 
49037          composeIntegerCore(null, e, true);
49038        closeArray();
49039        if (anyHasExtras(element.getNumTP())) {
49040          openArray("_numTP");
49041          for (IntegerType e : element.getNumTP()) 
49042            composeIntegerExtras(null, e, true);
49043          closeArray();
49044        }
49045      };
49046      if (element.hasNumFP()) {
49047        openArray("numFP");
49048        for (IntegerType e : element.getNumFP()) 
49049          composeIntegerCore(null, e, true);
49050        closeArray();
49051        if (anyHasExtras(element.getNumFP())) {
49052          openArray("_numFP");
49053          for (IntegerType e : element.getNumFP()) 
49054            composeIntegerExtras(null, e, true);
49055          closeArray();
49056        }
49057      };
49058      if (element.hasNumFN()) {
49059        openArray("numFN");
49060        for (IntegerType e : element.getNumFN()) 
49061          composeIntegerCore(null, e, true);
49062        closeArray();
49063        if (anyHasExtras(element.getNumFN())) {
49064          openArray("_numFN");
49065          for (IntegerType e : element.getNumFN()) 
49066            composeIntegerExtras(null, e, true);
49067          closeArray();
49068        }
49069      };
49070      if (element.hasPrecision()) {
49071        openArray("precision");
49072        for (DecimalType e : element.getPrecision()) 
49073          composeDecimalCore(null, e, true);
49074        closeArray();
49075        if (anyHasExtras(element.getPrecision())) {
49076          openArray("_precision");
49077          for (DecimalType e : element.getPrecision()) 
49078            composeDecimalExtras(null, e, true);
49079          closeArray();
49080        }
49081      };
49082      if (element.hasSensitivity()) {
49083        openArray("sensitivity");
49084        for (DecimalType e : element.getSensitivity()) 
49085          composeDecimalCore(null, e, true);
49086        closeArray();
49087        if (anyHasExtras(element.getSensitivity())) {
49088          openArray("_sensitivity");
49089          for (DecimalType e : element.getSensitivity()) 
49090            composeDecimalExtras(null, e, true);
49091          closeArray();
49092        }
49093      };
49094      if (element.hasFMeasure()) {
49095        openArray("fMeasure");
49096        for (DecimalType e : element.getFMeasure()) 
49097          composeDecimalCore(null, e, true);
49098        closeArray();
49099        if (anyHasExtras(element.getFMeasure())) {
49100          openArray("_fMeasure");
49101          for (DecimalType e : element.getFMeasure()) 
49102            composeDecimalExtras(null, e, true);
49103          closeArray();
49104        }
49105      };
49106  }
49107
49108  protected void composeMolecularSequenceMolecularSequenceRepositoryComponent(String name, MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
49109    if (element != null) {
49110      open(name);
49111      composeMolecularSequenceMolecularSequenceRepositoryComponentInner(element);
49112      close();
49113    }
49114  }
49115
49116  protected void composeMolecularSequenceMolecularSequenceRepositoryComponentInner(MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
49117      composeBackbone(element);
49118      if (element.hasTypeElement()) {
49119        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
49120        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
49121      }
49122      if (element.hasUrlElement()) {
49123        composeUriCore("url", element.getUrlElement(), false);
49124        composeUriExtras("url", element.getUrlElement(), false);
49125      }
49126      if (element.hasNameElement()) {
49127        composeStringCore("name", element.getNameElement(), false);
49128        composeStringExtras("name", element.getNameElement(), false);
49129      }
49130      if (element.hasDatasetIdElement()) {
49131        composeStringCore("datasetId", element.getDatasetIdElement(), false);
49132        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
49133      }
49134      if (element.hasVariantsetIdElement()) {
49135        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
49136        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
49137      }
49138      if (element.hasReadsetIdElement()) {
49139        composeStringCore("readsetId", element.getReadsetIdElement(), false);
49140        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
49141      }
49142  }
49143
49144  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponent(String name, MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
49145    if (element != null) {
49146      open(name);
49147      composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(element);
49148      close();
49149    }
49150  }
49151
49152  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
49153      composeBackbone(element);
49154      if (element.hasVariantType()) {
49155        composeCodeableConcept("variantType", element.getVariantType());
49156      }
49157      if (element.hasExactElement()) {
49158        composeBooleanCore("exact", element.getExactElement(), false);
49159        composeBooleanExtras("exact", element.getExactElement(), false);
49160      }
49161      if (element.hasLengthElement()) {
49162        composeIntegerCore("length", element.getLengthElement(), false);
49163        composeIntegerExtras("length", element.getLengthElement(), false);
49164      }
49165      if (element.hasOuter()) {
49166        composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent("outer", element.getOuter());
49167      }
49168      if (element.hasInner()) {
49169        composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent("inner", element.getInner());
49170      }
49171  }
49172
49173  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent(String name, MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
49174    if (element != null) {
49175      open(name);
49176      composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(element);
49177      close();
49178    }
49179  }
49180
49181  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
49182      composeBackbone(element);
49183      if (element.hasStartElement()) {
49184        composeIntegerCore("start", element.getStartElement(), false);
49185        composeIntegerExtras("start", element.getStartElement(), false);
49186      }
49187      if (element.hasEndElement()) {
49188        composeIntegerCore("end", element.getEndElement(), false);
49189        composeIntegerExtras("end", element.getEndElement(), false);
49190      }
49191  }
49192
49193  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent(String name, MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
49194    if (element != null) {
49195      open(name);
49196      composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(element);
49197      close();
49198    }
49199  }
49200
49201  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
49202      composeBackbone(element);
49203      if (element.hasStartElement()) {
49204        composeIntegerCore("start", element.getStartElement(), false);
49205        composeIntegerExtras("start", element.getStartElement(), false);
49206      }
49207      if (element.hasEndElement()) {
49208        composeIntegerCore("end", element.getEndElement(), false);
49209        composeIntegerExtras("end", element.getEndElement(), false);
49210      }
49211  }
49212
49213  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
49214    if (element != null) {
49215      prop("resourceType", name);
49216      composeNamingSystemInner(element);
49217    }
49218  }
49219
49220  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
49221      composeDomainResourceElements(element);
49222      if (element.hasNameElement()) {
49223        composeStringCore("name", element.getNameElement(), false);
49224        composeStringExtras("name", element.getNameElement(), false);
49225      }
49226      if (element.hasStatusElement()) {
49227        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49228        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49229      }
49230      if (element.hasKindElement()) {
49231        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
49232        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
49233      }
49234      if (element.hasDateElement()) {
49235        composeDateTimeCore("date", element.getDateElement(), false);
49236        composeDateTimeExtras("date", element.getDateElement(), false);
49237      }
49238      if (element.hasPublisherElement()) {
49239        composeStringCore("publisher", element.getPublisherElement(), false);
49240        composeStringExtras("publisher", element.getPublisherElement(), false);
49241      }
49242      if (element.hasContact()) {
49243        openArray("contact");
49244        for (ContactDetail e : element.getContact()) 
49245          composeContactDetail(null, e);
49246        closeArray();
49247      };
49248      if (element.hasResponsibleElement()) {
49249        composeStringCore("responsible", element.getResponsibleElement(), false);
49250        composeStringExtras("responsible", element.getResponsibleElement(), false);
49251      }
49252      if (element.hasType()) {
49253        composeCodeableConcept("type", element.getType());
49254      }
49255      if (element.hasDescriptionElement()) {
49256        composeMarkdownCore("description", element.getDescriptionElement(), false);
49257        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49258      }
49259      if (element.hasUseContext()) {
49260        openArray("useContext");
49261        for (UsageContext e : element.getUseContext()) 
49262          composeUsageContext(null, e);
49263        closeArray();
49264      };
49265      if (element.hasJurisdiction()) {
49266        openArray("jurisdiction");
49267        for (CodeableConcept e : element.getJurisdiction()) 
49268          composeCodeableConcept(null, e);
49269        closeArray();
49270      };
49271      if (element.hasUsageElement()) {
49272        composeStringCore("usage", element.getUsageElement(), false);
49273        composeStringExtras("usage", element.getUsageElement(), false);
49274      }
49275      if (element.hasUniqueId()) {
49276        openArray("uniqueId");
49277        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
49278          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
49279        closeArray();
49280      };
49281  }
49282
49283  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
49284    if (element != null) {
49285      open(name);
49286      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
49287      close();
49288    }
49289  }
49290
49291  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
49292      composeBackbone(element);
49293      if (element.hasTypeElement()) {
49294        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
49295        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
49296      }
49297      if (element.hasValueElement()) {
49298        composeStringCore("value", element.getValueElement(), false);
49299        composeStringExtras("value", element.getValueElement(), false);
49300      }
49301      if (element.hasPreferredElement()) {
49302        composeBooleanCore("preferred", element.getPreferredElement(), false);
49303        composeBooleanExtras("preferred", element.getPreferredElement(), false);
49304      }
49305      if (element.hasCommentElement()) {
49306        composeStringCore("comment", element.getCommentElement(), false);
49307        composeStringExtras("comment", element.getCommentElement(), false);
49308      }
49309      if (element.hasPeriod()) {
49310        composePeriod("period", element.getPeriod());
49311      }
49312  }
49313
49314  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
49315    if (element != null) {
49316      prop("resourceType", name);
49317      composeNutritionOrderInner(element);
49318    }
49319  }
49320
49321  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
49322      composeDomainResourceElements(element);
49323      if (element.hasIdentifier()) {
49324        openArray("identifier");
49325        for (Identifier e : element.getIdentifier()) 
49326          composeIdentifier(null, e);
49327        closeArray();
49328      };
49329      if (element.hasInstantiatesCanonical()) {
49330        openArray("instantiatesCanonical");
49331        for (CanonicalType e : element.getInstantiatesCanonical()) 
49332          composeCanonicalCore(null, e, true);
49333        closeArray();
49334        if (anyHasExtras(element.getInstantiatesCanonical())) {
49335          openArray("_instantiatesCanonical");
49336          for (CanonicalType e : element.getInstantiatesCanonical()) 
49337            composeCanonicalExtras(null, e, true);
49338          closeArray();
49339        }
49340      };
49341      if (element.hasInstantiatesUri()) {
49342        openArray("instantiatesUri");
49343        for (UriType e : element.getInstantiatesUri()) 
49344          composeUriCore(null, e, true);
49345        closeArray();
49346        if (anyHasExtras(element.getInstantiatesUri())) {
49347          openArray("_instantiatesUri");
49348          for (UriType e : element.getInstantiatesUri()) 
49349            composeUriExtras(null, e, true);
49350          closeArray();
49351        }
49352      };
49353      if (element.hasInstantiates()) {
49354        openArray("instantiates");
49355        for (UriType e : element.getInstantiates()) 
49356          composeUriCore(null, e, true);
49357        closeArray();
49358        if (anyHasExtras(element.getInstantiates())) {
49359          openArray("_instantiates");
49360          for (UriType e : element.getInstantiates()) 
49361            composeUriExtras(null, e, true);
49362          closeArray();
49363        }
49364      };
49365      if (element.hasStatusElement()) {
49366        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
49367        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
49368      }
49369      if (element.hasIntentElement()) {
49370        composeEnumerationCore("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
49371        composeEnumerationExtras("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
49372      }
49373      if (element.hasPatient()) {
49374        composeReference("patient", element.getPatient());
49375      }
49376      if (element.hasEncounter()) {
49377        composeReference("encounter", element.getEncounter());
49378      }
49379      if (element.hasDateTimeElement()) {
49380        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
49381        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
49382      }
49383      if (element.hasOrderer()) {
49384        composeReference("orderer", element.getOrderer());
49385      }
49386      if (element.hasAllergyIntolerance()) {
49387        openArray("allergyIntolerance");
49388        for (Reference e : element.getAllergyIntolerance()) 
49389          composeReference(null, e);
49390        closeArray();
49391      };
49392      if (element.hasFoodPreferenceModifier()) {
49393        openArray("foodPreferenceModifier");
49394        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
49395          composeCodeableConcept(null, e);
49396        closeArray();
49397      };
49398      if (element.hasExcludeFoodModifier()) {
49399        openArray("excludeFoodModifier");
49400        for (CodeableConcept e : element.getExcludeFoodModifier()) 
49401          composeCodeableConcept(null, e);
49402        closeArray();
49403      };
49404      if (element.hasOralDiet()) {
49405        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
49406      }
49407      if (element.hasSupplement()) {
49408        openArray("supplement");
49409        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
49410          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
49411        closeArray();
49412      };
49413      if (element.hasEnteralFormula()) {
49414        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
49415      }
49416      if (element.hasNote()) {
49417        openArray("note");
49418        for (Annotation e : element.getNote()) 
49419          composeAnnotation(null, e);
49420        closeArray();
49421      };
49422  }
49423
49424  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
49425    if (element != null) {
49426      open(name);
49427      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
49428      close();
49429    }
49430  }
49431
49432  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
49433      composeBackbone(element);
49434      if (element.hasType()) {
49435        openArray("type");
49436        for (CodeableConcept e : element.getType()) 
49437          composeCodeableConcept(null, e);
49438        closeArray();
49439      };
49440      if (element.hasSchedule()) {
49441        openArray("schedule");
49442        for (Timing e : element.getSchedule()) 
49443          composeTiming(null, e);
49444        closeArray();
49445      };
49446      if (element.hasNutrient()) {
49447        openArray("nutrient");
49448        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
49449          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
49450        closeArray();
49451      };
49452      if (element.hasTexture()) {
49453        openArray("texture");
49454        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
49455          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
49456        closeArray();
49457      };
49458      if (element.hasFluidConsistencyType()) {
49459        openArray("fluidConsistencyType");
49460        for (CodeableConcept e : element.getFluidConsistencyType()) 
49461          composeCodeableConcept(null, e);
49462        closeArray();
49463      };
49464      if (element.hasInstructionElement()) {
49465        composeStringCore("instruction", element.getInstructionElement(), false);
49466        composeStringExtras("instruction", element.getInstructionElement(), false);
49467      }
49468  }
49469
49470  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
49471    if (element != null) {
49472      open(name);
49473      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
49474      close();
49475    }
49476  }
49477
49478  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
49479      composeBackbone(element);
49480      if (element.hasModifier()) {
49481        composeCodeableConcept("modifier", element.getModifier());
49482      }
49483      if (element.hasAmount()) {
49484        composeQuantity("amount", element.getAmount());
49485      }
49486  }
49487
49488  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
49489    if (element != null) {
49490      open(name);
49491      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
49492      close();
49493    }
49494  }
49495
49496  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
49497      composeBackbone(element);
49498      if (element.hasModifier()) {
49499        composeCodeableConcept("modifier", element.getModifier());
49500      }
49501      if (element.hasFoodType()) {
49502        composeCodeableConcept("foodType", element.getFoodType());
49503      }
49504  }
49505
49506  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
49507    if (element != null) {
49508      open(name);
49509      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
49510      close();
49511    }
49512  }
49513
49514  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
49515      composeBackbone(element);
49516      if (element.hasType()) {
49517        composeCodeableConcept("type", element.getType());
49518      }
49519      if (element.hasProductNameElement()) {
49520        composeStringCore("productName", element.getProductNameElement(), false);
49521        composeStringExtras("productName", element.getProductNameElement(), false);
49522      }
49523      if (element.hasSchedule()) {
49524        openArray("schedule");
49525        for (Timing e : element.getSchedule()) 
49526          composeTiming(null, e);
49527        closeArray();
49528      };
49529      if (element.hasQuantity()) {
49530        composeQuantity("quantity", element.getQuantity());
49531      }
49532      if (element.hasInstructionElement()) {
49533        composeStringCore("instruction", element.getInstructionElement(), false);
49534        composeStringExtras("instruction", element.getInstructionElement(), false);
49535      }
49536  }
49537
49538  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
49539    if (element != null) {
49540      open(name);
49541      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
49542      close();
49543    }
49544  }
49545
49546  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
49547      composeBackbone(element);
49548      if (element.hasBaseFormulaType()) {
49549        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
49550      }
49551      if (element.hasBaseFormulaProductNameElement()) {
49552        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
49553        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
49554      }
49555      if (element.hasAdditiveType()) {
49556        composeCodeableConcept("additiveType", element.getAdditiveType());
49557      }
49558      if (element.hasAdditiveProductNameElement()) {
49559        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
49560        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
49561      }
49562      if (element.hasCaloricDensity()) {
49563        composeQuantity("caloricDensity", element.getCaloricDensity());
49564      }
49565      if (element.hasRouteofAdministration()) {
49566        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
49567      }
49568      if (element.hasAdministration()) {
49569        openArray("administration");
49570        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
49571          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
49572        closeArray();
49573      };
49574      if (element.hasMaxVolumeToDeliver()) {
49575        composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
49576      }
49577      if (element.hasAdministrationInstructionElement()) {
49578        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
49579        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
49580      }
49581  }
49582
49583  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
49584    if (element != null) {
49585      open(name);
49586      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
49587      close();
49588    }
49589  }
49590
49591  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
49592      composeBackbone(element);
49593      if (element.hasSchedule()) {
49594        composeTiming("schedule", element.getSchedule());
49595      }
49596      if (element.hasQuantity()) {
49597        composeQuantity("quantity", element.getQuantity());
49598      }
49599      if (element.hasRate()) {
49600        composeType("rate", element.getRate());
49601      }
49602  }
49603
49604  protected void composeObservation(String name, Observation element) throws IOException {
49605    if (element != null) {
49606      prop("resourceType", name);
49607      composeObservationInner(element);
49608    }
49609  }
49610
49611  protected void composeObservationInner(Observation element) throws IOException {
49612      composeDomainResourceElements(element);
49613      if (element.hasIdentifier()) {
49614        openArray("identifier");
49615        for (Identifier e : element.getIdentifier()) 
49616          composeIdentifier(null, e);
49617        closeArray();
49618      };
49619      if (element.hasBasedOn()) {
49620        openArray("basedOn");
49621        for (Reference e : element.getBasedOn()) 
49622          composeReference(null, e);
49623        closeArray();
49624      };
49625      if (element.hasPartOf()) {
49626        openArray("partOf");
49627        for (Reference e : element.getPartOf()) 
49628          composeReference(null, e);
49629        closeArray();
49630      };
49631      if (element.hasStatusElement()) {
49632        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
49633        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
49634      }
49635      if (element.hasCategory()) {
49636        openArray("category");
49637        for (CodeableConcept e : element.getCategory()) 
49638          composeCodeableConcept(null, e);
49639        closeArray();
49640      };
49641      if (element.hasCode()) {
49642        composeCodeableConcept("code", element.getCode());
49643      }
49644      if (element.hasSubject()) {
49645        composeReference("subject", element.getSubject());
49646      }
49647      if (element.hasFocus()) {
49648        openArray("focus");
49649        for (Reference e : element.getFocus()) 
49650          composeReference(null, e);
49651        closeArray();
49652      };
49653      if (element.hasEncounter()) {
49654        composeReference("encounter", element.getEncounter());
49655      }
49656      if (element.hasEffective()) {
49657        composeType("effective", element.getEffective());
49658      }
49659      if (element.hasIssuedElement()) {
49660        composeInstantCore("issued", element.getIssuedElement(), false);
49661        composeInstantExtras("issued", element.getIssuedElement(), false);
49662      }
49663      if (element.hasPerformer()) {
49664        openArray("performer");
49665        for (Reference e : element.getPerformer()) 
49666          composeReference(null, e);
49667        closeArray();
49668      };
49669      if (element.hasValue()) {
49670        composeType("value", element.getValue());
49671      }
49672      if (element.hasDataAbsentReason()) {
49673        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
49674      }
49675      if (element.hasInterpretation()) {
49676        openArray("interpretation");
49677        for (CodeableConcept e : element.getInterpretation()) 
49678          composeCodeableConcept(null, e);
49679        closeArray();
49680      };
49681      if (element.hasNote()) {
49682        openArray("note");
49683        for (Annotation e : element.getNote()) 
49684          composeAnnotation(null, e);
49685        closeArray();
49686      };
49687      if (element.hasBodySite()) {
49688        composeCodeableConcept("bodySite", element.getBodySite());
49689      }
49690      if (element.hasMethod()) {
49691        composeCodeableConcept("method", element.getMethod());
49692      }
49693      if (element.hasSpecimen()) {
49694        composeReference("specimen", element.getSpecimen());
49695      }
49696      if (element.hasDevice()) {
49697        composeReference("device", element.getDevice());
49698      }
49699      if (element.hasReferenceRange()) {
49700        openArray("referenceRange");
49701        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
49702          composeObservationObservationReferenceRangeComponent(null, e);
49703        closeArray();
49704      };
49705      if (element.hasHasMember()) {
49706        openArray("hasMember");
49707        for (Reference e : element.getHasMember()) 
49708          composeReference(null, e);
49709        closeArray();
49710      };
49711      if (element.hasDerivedFrom()) {
49712        openArray("derivedFrom");
49713        for (Reference e : element.getDerivedFrom()) 
49714          composeReference(null, e);
49715        closeArray();
49716      };
49717      if (element.hasComponent()) {
49718        openArray("component");
49719        for (Observation.ObservationComponentComponent e : element.getComponent()) 
49720          composeObservationObservationComponentComponent(null, e);
49721        closeArray();
49722      };
49723  }
49724
49725  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
49726    if (element != null) {
49727      open(name);
49728      composeObservationObservationReferenceRangeComponentInner(element);
49729      close();
49730    }
49731  }
49732
49733  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
49734      composeBackbone(element);
49735      if (element.hasLow()) {
49736        composeQuantity("low", element.getLow());
49737      }
49738      if (element.hasHigh()) {
49739        composeQuantity("high", element.getHigh());
49740      }
49741      if (element.hasType()) {
49742        composeCodeableConcept("type", element.getType());
49743      }
49744      if (element.hasAppliesTo()) {
49745        openArray("appliesTo");
49746        for (CodeableConcept e : element.getAppliesTo()) 
49747          composeCodeableConcept(null, e);
49748        closeArray();
49749      };
49750      if (element.hasAge()) {
49751        composeRange("age", element.getAge());
49752      }
49753      if (element.hasTextElement()) {
49754        composeStringCore("text", element.getTextElement(), false);
49755        composeStringExtras("text", element.getTextElement(), false);
49756      }
49757  }
49758
49759  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
49760    if (element != null) {
49761      open(name);
49762      composeObservationObservationComponentComponentInner(element);
49763      close();
49764    }
49765  }
49766
49767  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
49768      composeBackbone(element);
49769      if (element.hasCode()) {
49770        composeCodeableConcept("code", element.getCode());
49771      }
49772      if (element.hasValue()) {
49773        composeType("value", element.getValue());
49774      }
49775      if (element.hasDataAbsentReason()) {
49776        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
49777      }
49778      if (element.hasInterpretation()) {
49779        openArray("interpretation");
49780        for (CodeableConcept e : element.getInterpretation()) 
49781          composeCodeableConcept(null, e);
49782        closeArray();
49783      };
49784      if (element.hasReferenceRange()) {
49785        openArray("referenceRange");
49786        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
49787          composeObservationObservationReferenceRangeComponent(null, e);
49788        closeArray();
49789      };
49790  }
49791
49792  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
49793    if (element != null) {
49794      prop("resourceType", name);
49795      composeObservationDefinitionInner(element);
49796    }
49797  }
49798
49799  protected void composeObservationDefinitionInner(ObservationDefinition element) throws IOException {
49800      composeDomainResourceElements(element);
49801      if (element.hasCategory()) {
49802        openArray("category");
49803        for (CodeableConcept e : element.getCategory()) 
49804          composeCodeableConcept(null, e);
49805        closeArray();
49806      };
49807      if (element.hasCode()) {
49808        composeCodeableConcept("code", element.getCode());
49809      }
49810      if (element.hasIdentifier()) {
49811        openArray("identifier");
49812        for (Identifier e : element.getIdentifier()) 
49813          composeIdentifier(null, e);
49814        closeArray();
49815      };
49816      if (element.hasPermittedDataType()) {
49817        openArray("permittedDataType");
49818        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
49819          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
49820        closeArray();
49821        if (anyHasExtras(element.getPermittedDataType())) {
49822          openArray("_permittedDataType");
49823          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
49824            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
49825          closeArray();
49826        }
49827      };
49828      if (element.hasMultipleResultsAllowedElement()) {
49829        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
49830        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
49831      }
49832      if (element.hasMethod()) {
49833        composeCodeableConcept("method", element.getMethod());
49834      }
49835      if (element.hasPreferredReportNameElement()) {
49836        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
49837        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
49838      }
49839      if (element.hasQuantitativeDetails()) {
49840        composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
49841      }
49842      if (element.hasQualifiedInterval()) {
49843        openArray("qualifiedInterval");
49844        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
49845          composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(null, e);
49846        closeArray();
49847      };
49848      if (element.hasValidCodedValueSet()) {
49849        composeReference("validCodedValueSet", element.getValidCodedValueSet());
49850      }
49851      if (element.hasNormalCodedValueSet()) {
49852        composeReference("normalCodedValueSet", element.getNormalCodedValueSet());
49853      }
49854      if (element.hasAbnormalCodedValueSet()) {
49855        composeReference("abnormalCodedValueSet", element.getAbnormalCodedValueSet());
49856      }
49857      if (element.hasCriticalCodedValueSet()) {
49858        composeReference("criticalCodedValueSet", element.getCriticalCodedValueSet());
49859      }
49860  }
49861
49862  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(String name, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
49863    if (element != null) {
49864      open(name);
49865      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(element);
49866      close();
49867    }
49868  }
49869
49870  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
49871      composeBackbone(element);
49872      if (element.hasCustomaryUnit()) {
49873        composeCodeableConcept("customaryUnit", element.getCustomaryUnit());
49874      }
49875      if (element.hasUnit()) {
49876        composeCodeableConcept("unit", element.getUnit());
49877      }
49878      if (element.hasConversionFactorElement()) {
49879        composeDecimalCore("conversionFactor", element.getConversionFactorElement(), false);
49880        composeDecimalExtras("conversionFactor", element.getConversionFactorElement(), false);
49881      }
49882      if (element.hasDecimalPrecisionElement()) {
49883        composeIntegerCore("decimalPrecision", element.getDecimalPrecisionElement(), false);
49884        composeIntegerExtras("decimalPrecision", element.getDecimalPrecisionElement(), false);
49885      }
49886  }
49887
49888  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
49889    if (element != null) {
49890      open(name);
49891      composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(element);
49892      close();
49893    }
49894  }
49895
49896  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
49897      composeBackbone(element);
49898      if (element.hasCategoryElement()) {
49899        composeEnumerationCore("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
49900        composeEnumerationExtras("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
49901      }
49902      if (element.hasRange()) {
49903        composeRange("range", element.getRange());
49904      }
49905      if (element.hasContext()) {
49906        composeCodeableConcept("context", element.getContext());
49907      }
49908      if (element.hasAppliesTo()) {
49909        openArray("appliesTo");
49910        for (CodeableConcept e : element.getAppliesTo()) 
49911          composeCodeableConcept(null, e);
49912        closeArray();
49913      };
49914      if (element.hasGenderElement()) {
49915        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49916        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49917      }
49918      if (element.hasAge()) {
49919        composeRange("age", element.getAge());
49920      }
49921      if (element.hasGestationalAge()) {
49922        composeRange("gestationalAge", element.getGestationalAge());
49923      }
49924      if (element.hasConditionElement()) {
49925        composeStringCore("condition", element.getConditionElement(), false);
49926        composeStringExtras("condition", element.getConditionElement(), false);
49927      }
49928  }
49929
49930  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
49931    if (element != null) {
49932      prop("resourceType", name);
49933      composeOperationDefinitionInner(element);
49934    }
49935  }
49936
49937  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
49938      composeDomainResourceElements(element);
49939      if (element.hasUrlElement()) {
49940        composeUriCore("url", element.getUrlElement(), false);
49941        composeUriExtras("url", element.getUrlElement(), false);
49942      }
49943      if (element.hasVersionElement()) {
49944        composeStringCore("version", element.getVersionElement(), false);
49945        composeStringExtras("version", element.getVersionElement(), false);
49946      }
49947      if (element.hasNameElement()) {
49948        composeStringCore("name", element.getNameElement(), false);
49949        composeStringExtras("name", element.getNameElement(), false);
49950      }
49951      if (element.hasTitleElement()) {
49952        composeStringCore("title", element.getTitleElement(), false);
49953        composeStringExtras("title", element.getTitleElement(), false);
49954      }
49955      if (element.hasStatusElement()) {
49956        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49957        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49958      }
49959      if (element.hasKindElement()) {
49960        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
49961        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
49962      }
49963      if (element.hasExperimentalElement()) {
49964        composeBooleanCore("experimental", element.getExperimentalElement(), false);
49965        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
49966      }
49967      if (element.hasDateElement()) {
49968        composeDateTimeCore("date", element.getDateElement(), false);
49969        composeDateTimeExtras("date", element.getDateElement(), false);
49970      }
49971      if (element.hasPublisherElement()) {
49972        composeStringCore("publisher", element.getPublisherElement(), false);
49973        composeStringExtras("publisher", element.getPublisherElement(), false);
49974      }
49975      if (element.hasContact()) {
49976        openArray("contact");
49977        for (ContactDetail e : element.getContact()) 
49978          composeContactDetail(null, e);
49979        closeArray();
49980      };
49981      if (element.hasDescriptionElement()) {
49982        composeMarkdownCore("description", element.getDescriptionElement(), false);
49983        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49984      }
49985      if (element.hasUseContext()) {
49986        openArray("useContext");
49987        for (UsageContext e : element.getUseContext()) 
49988          composeUsageContext(null, e);
49989        closeArray();
49990      };
49991      if (element.hasJurisdiction()) {
49992        openArray("jurisdiction");
49993        for (CodeableConcept e : element.getJurisdiction()) 
49994          composeCodeableConcept(null, e);
49995        closeArray();
49996      };
49997      if (element.hasPurposeElement()) {
49998        composeMarkdownCore("purpose", element.getPurposeElement(), false);
49999        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50000      }
50001      if (element.hasAffectsStateElement()) {
50002        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
50003        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
50004      }
50005      if (element.hasCodeElement()) {
50006        composeCodeCore("code", element.getCodeElement(), false);
50007        composeCodeExtras("code", element.getCodeElement(), false);
50008      }
50009      if (element.hasCommentElement()) {
50010        composeMarkdownCore("comment", element.getCommentElement(), false);
50011        composeMarkdownExtras("comment", element.getCommentElement(), false);
50012      }
50013      if (element.hasBaseElement()) {
50014        composeCanonicalCore("base", element.getBaseElement(), false);
50015        composeCanonicalExtras("base", element.getBaseElement(), false);
50016      }
50017      if (element.hasResource()) {
50018        openArray("resource");
50019        for (CodeType e : element.getResource()) 
50020          composeCodeCore(null, e, true);
50021        closeArray();
50022        if (anyHasExtras(element.getResource())) {
50023          openArray("_resource");
50024          for (CodeType e : element.getResource()) 
50025            composeCodeExtras(null, e, true);
50026          closeArray();
50027        }
50028      };
50029      if (element.hasSystemElement()) {
50030        composeBooleanCore("system", element.getSystemElement(), false);
50031        composeBooleanExtras("system", element.getSystemElement(), false);
50032      }
50033      if (element.hasTypeElement()) {
50034        composeBooleanCore("type", element.getTypeElement(), false);
50035        composeBooleanExtras("type", element.getTypeElement(), false);
50036      }
50037      if (element.hasInstanceElement()) {
50038        composeBooleanCore("instance", element.getInstanceElement(), false);
50039        composeBooleanExtras("instance", element.getInstanceElement(), false);
50040      }
50041      if (element.hasInputProfileElement()) {
50042        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
50043        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
50044      }
50045      if (element.hasOutputProfileElement()) {
50046        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
50047        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
50048      }
50049      if (element.hasParameter()) {
50050        openArray("parameter");
50051        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
50052          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
50053        closeArray();
50054      };
50055      if (element.hasOverload()) {
50056        openArray("overload");
50057        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
50058          composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
50059        closeArray();
50060      };
50061  }
50062
50063  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
50064    if (element != null) {
50065      open(name);
50066      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
50067      close();
50068    }
50069  }
50070
50071  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
50072      composeBackbone(element);
50073      if (element.hasNameElement()) {
50074        composeCodeCore("name", element.getNameElement(), false);
50075        composeCodeExtras("name", element.getNameElement(), false);
50076      }
50077      if (element.hasUseElement()) {
50078        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
50079        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
50080      }
50081      if (element.hasMinElement()) {
50082        composeIntegerCore("min", element.getMinElement(), false);
50083        composeIntegerExtras("min", element.getMinElement(), false);
50084      }
50085      if (element.hasMaxElement()) {
50086        composeStringCore("max", element.getMaxElement(), false);
50087        composeStringExtras("max", element.getMaxElement(), false);
50088      }
50089      if (element.hasDocumentationElement()) {
50090        composeStringCore("documentation", element.getDocumentationElement(), false);
50091        composeStringExtras("documentation", element.getDocumentationElement(), false);
50092      }
50093      if (element.hasTypeElement()) {
50094        composeCodeCore("type", element.getTypeElement(), false);
50095        composeCodeExtras("type", element.getTypeElement(), false);
50096      }
50097      if (element.hasTargetProfile()) {
50098        openArray("targetProfile");
50099        for (CanonicalType e : element.getTargetProfile()) 
50100          composeCanonicalCore(null, e, true);
50101        closeArray();
50102        if (anyHasExtras(element.getTargetProfile())) {
50103          openArray("_targetProfile");
50104          for (CanonicalType e : element.getTargetProfile()) 
50105            composeCanonicalExtras(null, e, true);
50106          closeArray();
50107        }
50108      };
50109      if (element.hasSearchTypeElement()) {
50110        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
50111        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
50112      }
50113      if (element.hasBinding()) {
50114        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
50115      }
50116      if (element.hasReferencedFrom()) {
50117        openArray("referencedFrom");
50118        for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
50119          composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(null, e);
50120        closeArray();
50121      };
50122      if (element.hasPart()) {
50123        openArray("part");
50124        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
50125          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
50126        closeArray();
50127      };
50128  }
50129
50130  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
50131    if (element != null) {
50132      open(name);
50133      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
50134      close();
50135    }
50136  }
50137
50138  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
50139      composeBackbone(element);
50140      if (element.hasStrengthElement()) {
50141        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
50142        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
50143      }
50144      if (element.hasValueSetElement()) {
50145        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
50146        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
50147      }
50148  }
50149
50150  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
50151    if (element != null) {
50152      open(name);
50153      composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(element);
50154      close();
50155    }
50156  }
50157
50158  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
50159      composeBackbone(element);
50160      if (element.hasSourceElement()) {
50161        composeStringCore("source", element.getSourceElement(), false);
50162        composeStringExtras("source", element.getSourceElement(), false);
50163      }
50164      if (element.hasSourceIdElement()) {
50165        composeStringCore("sourceId", element.getSourceIdElement(), false);
50166        composeStringExtras("sourceId", element.getSourceIdElement(), false);
50167      }
50168  }
50169
50170  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
50171    if (element != null) {
50172      open(name);
50173      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
50174      close();
50175    }
50176  }
50177
50178  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
50179      composeBackbone(element);
50180      if (element.hasParameterName()) {
50181        openArray("parameterName");
50182        for (StringType e : element.getParameterName()) 
50183          composeStringCore(null, e, true);
50184        closeArray();
50185        if (anyHasExtras(element.getParameterName())) {
50186          openArray("_parameterName");
50187          for (StringType e : element.getParameterName()) 
50188            composeStringExtras(null, e, true);
50189          closeArray();
50190        }
50191      };
50192      if (element.hasCommentElement()) {
50193        composeStringCore("comment", element.getCommentElement(), false);
50194        composeStringExtras("comment", element.getCommentElement(), false);
50195      }
50196  }
50197
50198  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
50199    if (element != null) {
50200      prop("resourceType", name);
50201      composeOperationOutcomeInner(element);
50202    }
50203  }
50204
50205  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
50206      composeDomainResourceElements(element);
50207      if (element.hasIssue()) {
50208        openArray("issue");
50209        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
50210          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
50211        closeArray();
50212      };
50213  }
50214
50215  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
50216    if (element != null) {
50217      open(name);
50218      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
50219      close();
50220    }
50221  }
50222
50223  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
50224      composeBackbone(element);
50225      if (element.hasSeverityElement()) {
50226        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
50227        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
50228      }
50229      if (element.hasCodeElement()) {
50230        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
50231        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
50232      }
50233      if (element.hasDetails()) {
50234        composeCodeableConcept("details", element.getDetails());
50235      }
50236      if (element.hasDiagnosticsElement()) {
50237        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
50238        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
50239      }
50240      if (element.hasLocation()) {
50241        openArray("location");
50242        for (StringType e : element.getLocation()) 
50243          composeStringCore(null, e, true);
50244        closeArray();
50245        if (anyHasExtras(element.getLocation())) {
50246          openArray("_location");
50247          for (StringType e : element.getLocation()) 
50248            composeStringExtras(null, e, true);
50249          closeArray();
50250        }
50251      };
50252      if (element.hasExpression()) {
50253        openArray("expression");
50254        for (StringType e : element.getExpression()) 
50255          composeStringCore(null, e, true);
50256        closeArray();
50257        if (anyHasExtras(element.getExpression())) {
50258          openArray("_expression");
50259          for (StringType e : element.getExpression()) 
50260            composeStringExtras(null, e, true);
50261          closeArray();
50262        }
50263      };
50264  }
50265
50266  protected void composeOrganization(String name, Organization element) throws IOException {
50267    if (element != null) {
50268      prop("resourceType", name);
50269      composeOrganizationInner(element);
50270    }
50271  }
50272
50273  protected void composeOrganizationInner(Organization element) throws IOException {
50274      composeDomainResourceElements(element);
50275      if (element.hasIdentifier()) {
50276        openArray("identifier");
50277        for (Identifier e : element.getIdentifier()) 
50278          composeIdentifier(null, e);
50279        closeArray();
50280      };
50281      if (element.hasActiveElement()) {
50282        composeBooleanCore("active", element.getActiveElement(), false);
50283        composeBooleanExtras("active", element.getActiveElement(), false);
50284      }
50285      if (element.hasType()) {
50286        openArray("type");
50287        for (CodeableConcept e : element.getType()) 
50288          composeCodeableConcept(null, e);
50289        closeArray();
50290      };
50291      if (element.hasNameElement()) {
50292        composeStringCore("name", element.getNameElement(), false);
50293        composeStringExtras("name", element.getNameElement(), false);
50294      }
50295      if (element.hasAlias()) {
50296        openArray("alias");
50297        for (StringType e : element.getAlias()) 
50298          composeStringCore(null, e, true);
50299        closeArray();
50300        if (anyHasExtras(element.getAlias())) {
50301          openArray("_alias");
50302          for (StringType e : element.getAlias()) 
50303            composeStringExtras(null, e, true);
50304          closeArray();
50305        }
50306      };
50307      if (element.hasTelecom()) {
50308        openArray("telecom");
50309        for (ContactPoint e : element.getTelecom()) 
50310          composeContactPoint(null, e);
50311        closeArray();
50312      };
50313      if (element.hasAddress()) {
50314        openArray("address");
50315        for (Address e : element.getAddress()) 
50316          composeAddress(null, e);
50317        closeArray();
50318      };
50319      if (element.hasPartOf()) {
50320        composeReference("partOf", element.getPartOf());
50321      }
50322      if (element.hasContact()) {
50323        openArray("contact");
50324        for (Organization.OrganizationContactComponent e : element.getContact()) 
50325          composeOrganizationOrganizationContactComponent(null, e);
50326        closeArray();
50327      };
50328      if (element.hasEndpoint()) {
50329        openArray("endpoint");
50330        for (Reference e : element.getEndpoint()) 
50331          composeReference(null, e);
50332        closeArray();
50333      };
50334  }
50335
50336  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
50337    if (element != null) {
50338      open(name);
50339      composeOrganizationOrganizationContactComponentInner(element);
50340      close();
50341    }
50342  }
50343
50344  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
50345      composeBackbone(element);
50346      if (element.hasPurpose()) {
50347        composeCodeableConcept("purpose", element.getPurpose());
50348      }
50349      if (element.hasName()) {
50350        composeHumanName("name", element.getName());
50351      }
50352      if (element.hasTelecom()) {
50353        openArray("telecom");
50354        for (ContactPoint e : element.getTelecom()) 
50355          composeContactPoint(null, e);
50356        closeArray();
50357      };
50358      if (element.hasAddress()) {
50359        composeAddress("address", element.getAddress());
50360      }
50361  }
50362
50363  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
50364    if (element != null) {
50365      prop("resourceType", name);
50366      composeOrganizationAffiliationInner(element);
50367    }
50368  }
50369
50370  protected void composeOrganizationAffiliationInner(OrganizationAffiliation element) throws IOException {
50371      composeDomainResourceElements(element);
50372      if (element.hasIdentifier()) {
50373        openArray("identifier");
50374        for (Identifier e : element.getIdentifier()) 
50375          composeIdentifier(null, e);
50376        closeArray();
50377      };
50378      if (element.hasActiveElement()) {
50379        composeBooleanCore("active", element.getActiveElement(), false);
50380        composeBooleanExtras("active", element.getActiveElement(), false);
50381      }
50382      if (element.hasPeriod()) {
50383        composePeriod("period", element.getPeriod());
50384      }
50385      if (element.hasOrganization()) {
50386        composeReference("organization", element.getOrganization());
50387      }
50388      if (element.hasParticipatingOrganization()) {
50389        composeReference("participatingOrganization", element.getParticipatingOrganization());
50390      }
50391      if (element.hasNetwork()) {
50392        openArray("network");
50393        for (Reference e : element.getNetwork()) 
50394          composeReference(null, e);
50395        closeArray();
50396      };
50397      if (element.hasCode()) {
50398        openArray("code");
50399        for (CodeableConcept e : element.getCode()) 
50400          composeCodeableConcept(null, e);
50401        closeArray();
50402      };
50403      if (element.hasSpecialty()) {
50404        openArray("specialty");
50405        for (CodeableConcept e : element.getSpecialty()) 
50406          composeCodeableConcept(null, e);
50407        closeArray();
50408      };
50409      if (element.hasLocation()) {
50410        openArray("location");
50411        for (Reference e : element.getLocation()) 
50412          composeReference(null, e);
50413        closeArray();
50414      };
50415      if (element.hasHealthcareService()) {
50416        openArray("healthcareService");
50417        for (Reference e : element.getHealthcareService()) 
50418          composeReference(null, e);
50419        closeArray();
50420      };
50421      if (element.hasTelecom()) {
50422        openArray("telecom");
50423        for (ContactPoint e : element.getTelecom()) 
50424          composeContactPoint(null, e);
50425        closeArray();
50426      };
50427      if (element.hasEndpoint()) {
50428        openArray("endpoint");
50429        for (Reference e : element.getEndpoint()) 
50430          composeReference(null, e);
50431        closeArray();
50432      };
50433  }
50434
50435  protected void composePatient(String name, Patient element) throws IOException {
50436    if (element != null) {
50437      prop("resourceType", name);
50438      composePatientInner(element);
50439    }
50440  }
50441
50442  protected void composePatientInner(Patient element) throws IOException {
50443      composeDomainResourceElements(element);
50444      if (element.hasIdentifier()) {
50445        openArray("identifier");
50446        for (Identifier e : element.getIdentifier()) 
50447          composeIdentifier(null, e);
50448        closeArray();
50449      };
50450      if (element.hasActiveElement()) {
50451        composeBooleanCore("active", element.getActiveElement(), false);
50452        composeBooleanExtras("active", element.getActiveElement(), false);
50453      }
50454      if (element.hasName()) {
50455        openArray("name");
50456        for (HumanName e : element.getName()) 
50457          composeHumanName(null, e);
50458        closeArray();
50459      };
50460      if (element.hasTelecom()) {
50461        openArray("telecom");
50462        for (ContactPoint e : element.getTelecom()) 
50463          composeContactPoint(null, e);
50464        closeArray();
50465      };
50466      if (element.hasGenderElement()) {
50467        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50468        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50469      }
50470      if (element.hasBirthDateElement()) {
50471        composeDateCore("birthDate", element.getBirthDateElement(), false);
50472        composeDateExtras("birthDate", element.getBirthDateElement(), false);
50473      }
50474      if (element.hasDeceased()) {
50475        composeType("deceased", element.getDeceased());
50476      }
50477      if (element.hasAddress()) {
50478        openArray("address");
50479        for (Address e : element.getAddress()) 
50480          composeAddress(null, e);
50481        closeArray();
50482      };
50483      if (element.hasMaritalStatus()) {
50484        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
50485      }
50486      if (element.hasMultipleBirth()) {
50487        composeType("multipleBirth", element.getMultipleBirth());
50488      }
50489      if (element.hasPhoto()) {
50490        openArray("photo");
50491        for (Attachment e : element.getPhoto()) 
50492          composeAttachment(null, e);
50493        closeArray();
50494      };
50495      if (element.hasContact()) {
50496        openArray("contact");
50497        for (Patient.ContactComponent e : element.getContact()) 
50498          composePatientContactComponent(null, e);
50499        closeArray();
50500      };
50501      if (element.hasCommunication()) {
50502        openArray("communication");
50503        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
50504          composePatientPatientCommunicationComponent(null, e);
50505        closeArray();
50506      };
50507      if (element.hasGeneralPractitioner()) {
50508        openArray("generalPractitioner");
50509        for (Reference e : element.getGeneralPractitioner()) 
50510          composeReference(null, e);
50511        closeArray();
50512      };
50513      if (element.hasManagingOrganization()) {
50514        composeReference("managingOrganization", element.getManagingOrganization());
50515      }
50516      if (element.hasLink()) {
50517        openArray("link");
50518        for (Patient.PatientLinkComponent e : element.getLink()) 
50519          composePatientPatientLinkComponent(null, e);
50520        closeArray();
50521      };
50522  }
50523
50524  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
50525    if (element != null) {
50526      open(name);
50527      composePatientContactComponentInner(element);
50528      close();
50529    }
50530  }
50531
50532  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
50533      composeBackbone(element);
50534      if (element.hasRelationship()) {
50535        openArray("relationship");
50536        for (CodeableConcept e : element.getRelationship()) 
50537          composeCodeableConcept(null, e);
50538        closeArray();
50539      };
50540      if (element.hasName()) {
50541        composeHumanName("name", element.getName());
50542      }
50543      if (element.hasTelecom()) {
50544        openArray("telecom");
50545        for (ContactPoint e : element.getTelecom()) 
50546          composeContactPoint(null, e);
50547        closeArray();
50548      };
50549      if (element.hasAddress()) {
50550        composeAddress("address", element.getAddress());
50551      }
50552      if (element.hasGenderElement()) {
50553        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50554        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50555      }
50556      if (element.hasOrganization()) {
50557        composeReference("organization", element.getOrganization());
50558      }
50559      if (element.hasPeriod()) {
50560        composePeriod("period", element.getPeriod());
50561      }
50562  }
50563
50564  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
50565    if (element != null) {
50566      open(name);
50567      composePatientPatientCommunicationComponentInner(element);
50568      close();
50569    }
50570  }
50571
50572  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
50573      composeBackbone(element);
50574      if (element.hasLanguage()) {
50575        composeCodeableConcept("language", element.getLanguage());
50576      }
50577      if (element.hasPreferredElement()) {
50578        composeBooleanCore("preferred", element.getPreferredElement(), false);
50579        composeBooleanExtras("preferred", element.getPreferredElement(), false);
50580      }
50581  }
50582
50583  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
50584    if (element != null) {
50585      open(name);
50586      composePatientPatientLinkComponentInner(element);
50587      close();
50588    }
50589  }
50590
50591  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
50592      composeBackbone(element);
50593      if (element.hasOther()) {
50594        composeReference("other", element.getOther());
50595      }
50596      if (element.hasTypeElement()) {
50597        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
50598        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
50599      }
50600  }
50601
50602  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
50603    if (element != null) {
50604      prop("resourceType", name);
50605      composePaymentNoticeInner(element);
50606    }
50607  }
50608
50609  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
50610      composeDomainResourceElements(element);
50611      if (element.hasIdentifier()) {
50612        openArray("identifier");
50613        for (Identifier e : element.getIdentifier()) 
50614          composeIdentifier(null, e);
50615        closeArray();
50616      };
50617      if (element.hasStatusElement()) {
50618        composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
50619        composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
50620      }
50621      if (element.hasRequest()) {
50622        composeReference("request", element.getRequest());
50623      }
50624      if (element.hasResponse()) {
50625        composeReference("response", element.getResponse());
50626      }
50627      if (element.hasCreatedElement()) {
50628        composeDateTimeCore("created", element.getCreatedElement(), false);
50629        composeDateTimeExtras("created", element.getCreatedElement(), false);
50630      }
50631      if (element.hasProvider()) {
50632        composeReference("provider", element.getProvider());
50633      }
50634      if (element.hasPayment()) {
50635        composeReference("payment", element.getPayment());
50636      }
50637      if (element.hasPaymentDateElement()) {
50638        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
50639        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
50640      }
50641      if (element.hasPayee()) {
50642        composeReference("payee", element.getPayee());
50643      }
50644      if (element.hasRecipient()) {
50645        composeReference("recipient", element.getRecipient());
50646      }
50647      if (element.hasAmount()) {
50648        composeMoney("amount", element.getAmount());
50649      }
50650      if (element.hasPaymentStatus()) {
50651        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
50652      }
50653  }
50654
50655  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
50656    if (element != null) {
50657      prop("resourceType", name);
50658      composePaymentReconciliationInner(element);
50659    }
50660  }
50661
50662  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
50663      composeDomainResourceElements(element);
50664      if (element.hasIdentifier()) {
50665        openArray("identifier");
50666        for (Identifier e : element.getIdentifier()) 
50667          composeIdentifier(null, e);
50668        closeArray();
50669      };
50670      if (element.hasStatusElement()) {
50671        composeEnumerationCore("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
50672        composeEnumerationExtras("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
50673      }
50674      if (element.hasPeriod()) {
50675        composePeriod("period", element.getPeriod());
50676      }
50677      if (element.hasCreatedElement()) {
50678        composeDateTimeCore("created", element.getCreatedElement(), false);
50679        composeDateTimeExtras("created", element.getCreatedElement(), false);
50680      }
50681      if (element.hasPaymentIssuer()) {
50682        composeReference("paymentIssuer", element.getPaymentIssuer());
50683      }
50684      if (element.hasRequest()) {
50685        composeReference("request", element.getRequest());
50686      }
50687      if (element.hasRequestor()) {
50688        composeReference("requestor", element.getRequestor());
50689      }
50690      if (element.hasOutcomeElement()) {
50691        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
50692        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
50693      }
50694      if (element.hasDispositionElement()) {
50695        composeStringCore("disposition", element.getDispositionElement(), false);
50696        composeStringExtras("disposition", element.getDispositionElement(), false);
50697      }
50698      if (element.hasPaymentDateElement()) {
50699        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
50700        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
50701      }
50702      if (element.hasPaymentAmount()) {
50703        composeMoney("paymentAmount", element.getPaymentAmount());
50704      }
50705      if (element.hasPaymentIdentifier()) {
50706        composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
50707      }
50708      if (element.hasDetail()) {
50709        openArray("detail");
50710        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
50711          composePaymentReconciliationDetailsComponent(null, e);
50712        closeArray();
50713      };
50714      if (element.hasFormCode()) {
50715        composeCodeableConcept("formCode", element.getFormCode());
50716      }
50717      if (element.hasProcessNote()) {
50718        openArray("processNote");
50719        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
50720          composePaymentReconciliationNotesComponent(null, e);
50721        closeArray();
50722      };
50723  }
50724
50725  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
50726    if (element != null) {
50727      open(name);
50728      composePaymentReconciliationDetailsComponentInner(element);
50729      close();
50730    }
50731  }
50732
50733  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
50734      composeBackbone(element);
50735      if (element.hasIdentifier()) {
50736        composeIdentifier("identifier", element.getIdentifier());
50737      }
50738      if (element.hasPredecessor()) {
50739        composeIdentifier("predecessor", element.getPredecessor());
50740      }
50741      if (element.hasType()) {
50742        composeCodeableConcept("type", element.getType());
50743      }
50744      if (element.hasRequest()) {
50745        composeReference("request", element.getRequest());
50746      }
50747      if (element.hasSubmitter()) {
50748        composeReference("submitter", element.getSubmitter());
50749      }
50750      if (element.hasResponse()) {
50751        composeReference("response", element.getResponse());
50752      }
50753      if (element.hasDateElement()) {
50754        composeDateCore("date", element.getDateElement(), false);
50755        composeDateExtras("date", element.getDateElement(), false);
50756      }
50757      if (element.hasResponsible()) {
50758        composeReference("responsible", element.getResponsible());
50759      }
50760      if (element.hasPayee()) {
50761        composeReference("payee", element.getPayee());
50762      }
50763      if (element.hasAmount()) {
50764        composeMoney("amount", element.getAmount());
50765      }
50766  }
50767
50768  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
50769    if (element != null) {
50770      open(name);
50771      composePaymentReconciliationNotesComponentInner(element);
50772      close();
50773    }
50774  }
50775
50776  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
50777      composeBackbone(element);
50778      if (element.hasTypeElement()) {
50779        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
50780        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
50781      }
50782      if (element.hasTextElement()) {
50783        composeStringCore("text", element.getTextElement(), false);
50784        composeStringExtras("text", element.getTextElement(), false);
50785      }
50786  }
50787
50788  protected void composePerson(String name, Person element) throws IOException {
50789    if (element != null) {
50790      prop("resourceType", name);
50791      composePersonInner(element);
50792    }
50793  }
50794
50795  protected void composePersonInner(Person element) throws IOException {
50796      composeDomainResourceElements(element);
50797      if (element.hasIdentifier()) {
50798        openArray("identifier");
50799        for (Identifier e : element.getIdentifier()) 
50800          composeIdentifier(null, e);
50801        closeArray();
50802      };
50803      if (element.hasName()) {
50804        openArray("name");
50805        for (HumanName e : element.getName()) 
50806          composeHumanName(null, e);
50807        closeArray();
50808      };
50809      if (element.hasTelecom()) {
50810        openArray("telecom");
50811        for (ContactPoint e : element.getTelecom()) 
50812          composeContactPoint(null, e);
50813        closeArray();
50814      };
50815      if (element.hasGenderElement()) {
50816        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50817        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50818      }
50819      if (element.hasBirthDateElement()) {
50820        composeDateCore("birthDate", element.getBirthDateElement(), false);
50821        composeDateExtras("birthDate", element.getBirthDateElement(), false);
50822      }
50823      if (element.hasAddress()) {
50824        openArray("address");
50825        for (Address e : element.getAddress()) 
50826          composeAddress(null, e);
50827        closeArray();
50828      };
50829      if (element.hasPhoto()) {
50830        composeAttachment("photo", element.getPhoto());
50831      }
50832      if (element.hasManagingOrganization()) {
50833        composeReference("managingOrganization", element.getManagingOrganization());
50834      }
50835      if (element.hasActiveElement()) {
50836        composeBooleanCore("active", element.getActiveElement(), false);
50837        composeBooleanExtras("active", element.getActiveElement(), false);
50838      }
50839      if (element.hasLink()) {
50840        openArray("link");
50841        for (Person.PersonLinkComponent e : element.getLink()) 
50842          composePersonPersonLinkComponent(null, e);
50843        closeArray();
50844      };
50845  }
50846
50847  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
50848    if (element != null) {
50849      open(name);
50850      composePersonPersonLinkComponentInner(element);
50851      close();
50852    }
50853  }
50854
50855  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
50856      composeBackbone(element);
50857      if (element.hasTarget()) {
50858        composeReference("target", element.getTarget());
50859      }
50860      if (element.hasAssuranceElement()) {
50861        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
50862        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
50863      }
50864  }
50865
50866  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
50867    if (element != null) {
50868      prop("resourceType", name);
50869      composePlanDefinitionInner(element);
50870    }
50871  }
50872
50873  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
50874      composeDomainResourceElements(element);
50875      if (element.hasUrlElement()) {
50876        composeUriCore("url", element.getUrlElement(), false);
50877        composeUriExtras("url", element.getUrlElement(), false);
50878      }
50879      if (element.hasIdentifier()) {
50880        openArray("identifier");
50881        for (Identifier e : element.getIdentifier()) 
50882          composeIdentifier(null, e);
50883        closeArray();
50884      };
50885      if (element.hasVersionElement()) {
50886        composeStringCore("version", element.getVersionElement(), false);
50887        composeStringExtras("version", element.getVersionElement(), false);
50888      }
50889      if (element.hasNameElement()) {
50890        composeStringCore("name", element.getNameElement(), false);
50891        composeStringExtras("name", element.getNameElement(), false);
50892      }
50893      if (element.hasTitleElement()) {
50894        composeStringCore("title", element.getTitleElement(), false);
50895        composeStringExtras("title", element.getTitleElement(), false);
50896      }
50897      if (element.hasSubtitleElement()) {
50898        composeStringCore("subtitle", element.getSubtitleElement(), false);
50899        composeStringExtras("subtitle", element.getSubtitleElement(), false);
50900      }
50901      if (element.hasType()) {
50902        composeCodeableConcept("type", element.getType());
50903      }
50904      if (element.hasStatusElement()) {
50905        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50906        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50907      }
50908      if (element.hasExperimentalElement()) {
50909        composeBooleanCore("experimental", element.getExperimentalElement(), false);
50910        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50911      }
50912      if (element.hasSubject()) {
50913        composeType("subject", element.getSubject());
50914      }
50915      if (element.hasDateElement()) {
50916        composeDateTimeCore("date", element.getDateElement(), false);
50917        composeDateTimeExtras("date", element.getDateElement(), false);
50918      }
50919      if (element.hasPublisherElement()) {
50920        composeStringCore("publisher", element.getPublisherElement(), false);
50921        composeStringExtras("publisher", element.getPublisherElement(), false);
50922      }
50923      if (element.hasContact()) {
50924        openArray("contact");
50925        for (ContactDetail e : element.getContact()) 
50926          composeContactDetail(null, e);
50927        closeArray();
50928      };
50929      if (element.hasDescriptionElement()) {
50930        composeMarkdownCore("description", element.getDescriptionElement(), false);
50931        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50932      }
50933      if (element.hasUseContext()) {
50934        openArray("useContext");
50935        for (UsageContext e : element.getUseContext()) 
50936          composeUsageContext(null, e);
50937        closeArray();
50938      };
50939      if (element.hasJurisdiction()) {
50940        openArray("jurisdiction");
50941        for (CodeableConcept e : element.getJurisdiction()) 
50942          composeCodeableConcept(null, e);
50943        closeArray();
50944      };
50945      if (element.hasPurposeElement()) {
50946        composeMarkdownCore("purpose", element.getPurposeElement(), false);
50947        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50948      }
50949      if (element.hasUsageElement()) {
50950        composeStringCore("usage", element.getUsageElement(), false);
50951        composeStringExtras("usage", element.getUsageElement(), false);
50952      }
50953      if (element.hasCopyrightElement()) {
50954        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
50955        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
50956      }
50957      if (element.hasApprovalDateElement()) {
50958        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
50959        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
50960      }
50961      if (element.hasLastReviewDateElement()) {
50962        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
50963        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
50964      }
50965      if (element.hasEffectivePeriod()) {
50966        composePeriod("effectivePeriod", element.getEffectivePeriod());
50967      }
50968      if (element.hasTopic()) {
50969        openArray("topic");
50970        for (CodeableConcept e : element.getTopic()) 
50971          composeCodeableConcept(null, e);
50972        closeArray();
50973      };
50974      if (element.hasAuthor()) {
50975        openArray("author");
50976        for (ContactDetail e : element.getAuthor()) 
50977          composeContactDetail(null, e);
50978        closeArray();
50979      };
50980      if (element.hasEditor()) {
50981        openArray("editor");
50982        for (ContactDetail e : element.getEditor()) 
50983          composeContactDetail(null, e);
50984        closeArray();
50985      };
50986      if (element.hasReviewer()) {
50987        openArray("reviewer");
50988        for (ContactDetail e : element.getReviewer()) 
50989          composeContactDetail(null, e);
50990        closeArray();
50991      };
50992      if (element.hasEndorser()) {
50993        openArray("endorser");
50994        for (ContactDetail e : element.getEndorser()) 
50995          composeContactDetail(null, e);
50996        closeArray();
50997      };
50998      if (element.hasRelatedArtifact()) {
50999        openArray("relatedArtifact");
51000        for (RelatedArtifact e : element.getRelatedArtifact()) 
51001          composeRelatedArtifact(null, e);
51002        closeArray();
51003      };
51004      if (element.hasLibrary()) {
51005        openArray("library");
51006        for (CanonicalType e : element.getLibrary()) 
51007          composeCanonicalCore(null, e, true);
51008        closeArray();
51009        if (anyHasExtras(element.getLibrary())) {
51010          openArray("_library");
51011          for (CanonicalType e : element.getLibrary()) 
51012            composeCanonicalExtras(null, e, true);
51013          closeArray();
51014        }
51015      };
51016      if (element.hasGoal()) {
51017        openArray("goal");
51018        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
51019          composePlanDefinitionPlanDefinitionGoalComponent(null, e);
51020        closeArray();
51021      };
51022      if (element.hasAction()) {
51023        openArray("action");
51024        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
51025          composePlanDefinitionPlanDefinitionActionComponent(null, e);
51026        closeArray();
51027      };
51028  }
51029
51030  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
51031    if (element != null) {
51032      open(name);
51033      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
51034      close();
51035    }
51036  }
51037
51038  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
51039      composeBackbone(element);
51040      if (element.hasCategory()) {
51041        composeCodeableConcept("category", element.getCategory());
51042      }
51043      if (element.hasDescription()) {
51044        composeCodeableConcept("description", element.getDescription());
51045      }
51046      if (element.hasPriority()) {
51047        composeCodeableConcept("priority", element.getPriority());
51048      }
51049      if (element.hasStart()) {
51050        composeCodeableConcept("start", element.getStart());
51051      }
51052      if (element.hasAddresses()) {
51053        openArray("addresses");
51054        for (CodeableConcept e : element.getAddresses()) 
51055          composeCodeableConcept(null, e);
51056        closeArray();
51057      };
51058      if (element.hasDocumentation()) {
51059        openArray("documentation");
51060        for (RelatedArtifact e : element.getDocumentation()) 
51061          composeRelatedArtifact(null, e);
51062        closeArray();
51063      };
51064      if (element.hasTarget()) {
51065        openArray("target");
51066        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
51067          composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
51068        closeArray();
51069      };
51070  }
51071
51072  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
51073    if (element != null) {
51074      open(name);
51075      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
51076      close();
51077    }
51078  }
51079
51080  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
51081      composeBackbone(element);
51082      if (element.hasMeasure()) {
51083        composeCodeableConcept("measure", element.getMeasure());
51084      }
51085      if (element.hasDetail()) {
51086        composeType("detail", element.getDetail());
51087      }
51088      if (element.hasDue()) {
51089        composeDuration("due", element.getDue());
51090      }
51091  }
51092
51093  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
51094    if (element != null) {
51095      open(name);
51096      composePlanDefinitionPlanDefinitionActionComponentInner(element);
51097      close();
51098    }
51099  }
51100
51101  protected void composePlanDefinitionPlanDefinitionActionComponentInner(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
51102      composeBackbone(element);
51103      if (element.hasPrefixElement()) {
51104        composeStringCore("prefix", element.getPrefixElement(), false);
51105        composeStringExtras("prefix", element.getPrefixElement(), false);
51106      }
51107      if (element.hasTitleElement()) {
51108        composeStringCore("title", element.getTitleElement(), false);
51109        composeStringExtras("title", element.getTitleElement(), false);
51110      }
51111      if (element.hasDescriptionElement()) {
51112        composeStringCore("description", element.getDescriptionElement(), false);
51113        composeStringExtras("description", element.getDescriptionElement(), false);
51114      }
51115      if (element.hasTextEquivalentElement()) {
51116        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
51117        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
51118      }
51119      if (element.hasPriorityElement()) {
51120        composeEnumerationCore("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
51121        composeEnumerationExtras("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
51122      }
51123      if (element.hasCode()) {
51124        openArray("code");
51125        for (CodeableConcept e : element.getCode()) 
51126          composeCodeableConcept(null, e);
51127        closeArray();
51128      };
51129      if (element.hasReason()) {
51130        openArray("reason");
51131        for (CodeableConcept e : element.getReason()) 
51132          composeCodeableConcept(null, e);
51133        closeArray();
51134      };
51135      if (element.hasDocumentation()) {
51136        openArray("documentation");
51137        for (RelatedArtifact e : element.getDocumentation()) 
51138          composeRelatedArtifact(null, e);
51139        closeArray();
51140      };
51141      if (element.hasGoalId()) {
51142        openArray("goalId");
51143        for (IdType e : element.getGoalId()) 
51144          composeIdCore(null, e, true);
51145        closeArray();
51146        if (anyHasExtras(element.getGoalId())) {
51147          openArray("_goalId");
51148          for (IdType e : element.getGoalId()) 
51149            composeIdExtras(null, e, true);
51150          closeArray();
51151        }
51152      };
51153      if (element.hasSubject()) {
51154        composeType("subject", element.getSubject());
51155      }
51156      if (element.hasTrigger()) {
51157        openArray("trigger");
51158        for (TriggerDefinition e : element.getTrigger()) 
51159          composeTriggerDefinition(null, e);
51160        closeArray();
51161      };
51162      if (element.hasCondition()) {
51163        openArray("condition");
51164        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
51165          composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
51166        closeArray();
51167      };
51168      if (element.hasInput()) {
51169        openArray("input");
51170        for (DataRequirement e : element.getInput()) 
51171          composeDataRequirement(null, e);
51172        closeArray();
51173      };
51174      if (element.hasOutput()) {
51175        openArray("output");
51176        for (DataRequirement e : element.getOutput()) 
51177          composeDataRequirement(null, e);
51178        closeArray();
51179      };
51180      if (element.hasRelatedAction()) {
51181        openArray("relatedAction");
51182        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
51183          composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
51184        closeArray();
51185      };
51186      if (element.hasTiming()) {
51187        composeType("timing", element.getTiming());
51188      }
51189      if (element.hasParticipant()) {
51190        openArray("participant");
51191        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
51192          composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
51193        closeArray();
51194      };
51195      if (element.hasType()) {
51196        composeCodeableConcept("type", element.getType());
51197      }
51198      if (element.hasGroupingBehaviorElement()) {
51199        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
51200        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
51201      }
51202      if (element.hasSelectionBehaviorElement()) {
51203        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
51204        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
51205      }
51206      if (element.hasRequiredBehaviorElement()) {
51207        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
51208        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
51209      }
51210      if (element.hasPrecheckBehaviorElement()) {
51211        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
51212        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
51213      }
51214      if (element.hasCardinalityBehaviorElement()) {
51215        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
51216        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
51217      }
51218      if (element.hasDefinition()) {
51219        composeType("definition", element.getDefinition());
51220      }
51221      if (element.hasTransformElement()) {
51222        composeCanonicalCore("transform", element.getTransformElement(), false);
51223        composeCanonicalExtras("transform", element.getTransformElement(), false);
51224      }
51225      if (element.hasDynamicValue()) {
51226        openArray("dynamicValue");
51227        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
51228          composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
51229        closeArray();
51230      };
51231      if (element.hasAction()) {
51232        openArray("action");
51233        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
51234          composePlanDefinitionPlanDefinitionActionComponent(null, e);
51235        closeArray();
51236      };
51237  }
51238
51239  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
51240    if (element != null) {
51241      open(name);
51242      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
51243      close();
51244    }
51245  }
51246
51247  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
51248      composeBackbone(element);
51249      if (element.hasKindElement()) {
51250        composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
51251        composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
51252      }
51253      if (element.hasExpression()) {
51254        composeExpression("expression", element.getExpression());
51255      }
51256  }
51257
51258  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
51259    if (element != null) {
51260      open(name);
51261      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
51262      close();
51263    }
51264  }
51265
51266  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
51267      composeBackbone(element);
51268      if (element.hasActionIdElement()) {
51269        composeIdCore("actionId", element.getActionIdElement(), false);
51270        composeIdExtras("actionId", element.getActionIdElement(), false);
51271      }
51272      if (element.hasRelationshipElement()) {
51273        composeEnumerationCore("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
51274        composeEnumerationExtras("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
51275      }
51276      if (element.hasOffset()) {
51277        composeType("offset", element.getOffset());
51278      }
51279  }
51280
51281  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
51282    if (element != null) {
51283      open(name);
51284      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
51285      close();
51286    }
51287  }
51288
51289  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
51290      composeBackbone(element);
51291      if (element.hasTypeElement()) {
51292        composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
51293        composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
51294      }
51295      if (element.hasRole()) {
51296        composeCodeableConcept("role", element.getRole());
51297      }
51298  }
51299
51300  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
51301    if (element != null) {
51302      open(name);
51303      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
51304      close();
51305    }
51306  }
51307
51308  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
51309      composeBackbone(element);
51310      if (element.hasPathElement()) {
51311        composeStringCore("path", element.getPathElement(), false);
51312        composeStringExtras("path", element.getPathElement(), false);
51313      }
51314      if (element.hasExpression()) {
51315        composeExpression("expression", element.getExpression());
51316      }
51317  }
51318
51319  protected void composePractitioner(String name, Practitioner element) throws IOException {
51320    if (element != null) {
51321      prop("resourceType", name);
51322      composePractitionerInner(element);
51323    }
51324  }
51325
51326  protected void composePractitionerInner(Practitioner element) throws IOException {
51327      composeDomainResourceElements(element);
51328      if (element.hasIdentifier()) {
51329        openArray("identifier");
51330        for (Identifier e : element.getIdentifier()) 
51331          composeIdentifier(null, e);
51332        closeArray();
51333      };
51334      if (element.hasActiveElement()) {
51335        composeBooleanCore("active", element.getActiveElement(), false);
51336        composeBooleanExtras("active", element.getActiveElement(), false);
51337      }
51338      if (element.hasName()) {
51339        openArray("name");
51340        for (HumanName e : element.getName()) 
51341          composeHumanName(null, e);
51342        closeArray();
51343      };
51344      if (element.hasTelecom()) {
51345        openArray("telecom");
51346        for (ContactPoint e : element.getTelecom()) 
51347          composeContactPoint(null, e);
51348        closeArray();
51349      };
51350      if (element.hasAddress()) {
51351        openArray("address");
51352        for (Address e : element.getAddress()) 
51353          composeAddress(null, e);
51354        closeArray();
51355      };
51356      if (element.hasGenderElement()) {
51357        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51358        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51359      }
51360      if (element.hasBirthDateElement()) {
51361        composeDateCore("birthDate", element.getBirthDateElement(), false);
51362        composeDateExtras("birthDate", element.getBirthDateElement(), false);
51363      }
51364      if (element.hasPhoto()) {
51365        openArray("photo");
51366        for (Attachment e : element.getPhoto()) 
51367          composeAttachment(null, e);
51368        closeArray();
51369      };
51370      if (element.hasQualification()) {
51371        openArray("qualification");
51372        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
51373          composePractitionerPractitionerQualificationComponent(null, e);
51374        closeArray();
51375      };
51376      if (element.hasCommunication()) {
51377        openArray("communication");
51378        for (CodeableConcept e : element.getCommunication()) 
51379          composeCodeableConcept(null, e);
51380        closeArray();
51381      };
51382  }
51383
51384  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
51385    if (element != null) {
51386      open(name);
51387      composePractitionerPractitionerQualificationComponentInner(element);
51388      close();
51389    }
51390  }
51391
51392  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
51393      composeBackbone(element);
51394      if (element.hasIdentifier()) {
51395        openArray("identifier");
51396        for (Identifier e : element.getIdentifier()) 
51397          composeIdentifier(null, e);
51398        closeArray();
51399      };
51400      if (element.hasCode()) {
51401        composeCodeableConcept("code", element.getCode());
51402      }
51403      if (element.hasPeriod()) {
51404        composePeriod("period", element.getPeriod());
51405      }
51406      if (element.hasIssuer()) {
51407        composeReference("issuer", element.getIssuer());
51408      }
51409  }
51410
51411  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
51412    if (element != null) {
51413      prop("resourceType", name);
51414      composePractitionerRoleInner(element);
51415    }
51416  }
51417
51418  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
51419      composeDomainResourceElements(element);
51420      if (element.hasIdentifier()) {
51421        openArray("identifier");
51422        for (Identifier e : element.getIdentifier()) 
51423          composeIdentifier(null, e);
51424        closeArray();
51425      };
51426      if (element.hasActiveElement()) {
51427        composeBooleanCore("active", element.getActiveElement(), false);
51428        composeBooleanExtras("active", element.getActiveElement(), false);
51429      }
51430      if (element.hasPeriod()) {
51431        composePeriod("period", element.getPeriod());
51432      }
51433      if (element.hasPractitioner()) {
51434        composeReference("practitioner", element.getPractitioner());
51435      }
51436      if (element.hasOrganization()) {
51437        composeReference("organization", element.getOrganization());
51438      }
51439      if (element.hasCode()) {
51440        openArray("code");
51441        for (CodeableConcept e : element.getCode()) 
51442          composeCodeableConcept(null, e);
51443        closeArray();
51444      };
51445      if (element.hasSpecialty()) {
51446        openArray("specialty");
51447        for (CodeableConcept e : element.getSpecialty()) 
51448          composeCodeableConcept(null, e);
51449        closeArray();
51450      };
51451      if (element.hasLocation()) {
51452        openArray("location");
51453        for (Reference e : element.getLocation()) 
51454          composeReference(null, e);
51455        closeArray();
51456      };
51457      if (element.hasHealthcareService()) {
51458        openArray("healthcareService");
51459        for (Reference e : element.getHealthcareService()) 
51460          composeReference(null, e);
51461        closeArray();
51462      };
51463      if (element.hasTelecom()) {
51464        openArray("telecom");
51465        for (ContactPoint e : element.getTelecom()) 
51466          composeContactPoint(null, e);
51467        closeArray();
51468      };
51469      if (element.hasAvailableTime()) {
51470        openArray("availableTime");
51471        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
51472          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
51473        closeArray();
51474      };
51475      if (element.hasNotAvailable()) {
51476        openArray("notAvailable");
51477        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
51478          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
51479        closeArray();
51480      };
51481      if (element.hasAvailabilityExceptionsElement()) {
51482        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
51483        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
51484      }
51485      if (element.hasEndpoint()) {
51486        openArray("endpoint");
51487        for (Reference e : element.getEndpoint()) 
51488          composeReference(null, e);
51489        closeArray();
51490      };
51491  }
51492
51493  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
51494    if (element != null) {
51495      open(name);
51496      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
51497      close();
51498    }
51499  }
51500
51501  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
51502      composeBackbone(element);
51503      if (element.hasDaysOfWeek()) {
51504        openArray("daysOfWeek");
51505        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
51506          composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
51507        closeArray();
51508        if (anyHasExtras(element.getDaysOfWeek())) {
51509          openArray("_daysOfWeek");
51510          for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
51511            composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
51512          closeArray();
51513        }
51514      };
51515      if (element.hasAllDayElement()) {
51516        composeBooleanCore("allDay", element.getAllDayElement(), false);
51517        composeBooleanExtras("allDay", element.getAllDayElement(), false);
51518      }
51519      if (element.hasAvailableStartTimeElement()) {
51520        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
51521        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
51522      }
51523      if (element.hasAvailableEndTimeElement()) {
51524        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
51525        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
51526      }
51527  }
51528
51529  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
51530    if (element != null) {
51531      open(name);
51532      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
51533      close();
51534    }
51535  }
51536
51537  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
51538      composeBackbone(element);
51539      if (element.hasDescriptionElement()) {
51540        composeStringCore("description", element.getDescriptionElement(), false);
51541        composeStringExtras("description", element.getDescriptionElement(), false);
51542      }
51543      if (element.hasDuring()) {
51544        composePeriod("during", element.getDuring());
51545      }
51546  }
51547
51548  protected void composeProcedure(String name, Procedure element) throws IOException {
51549    if (element != null) {
51550      prop("resourceType", name);
51551      composeProcedureInner(element);
51552    }
51553  }
51554
51555  protected void composeProcedureInner(Procedure element) throws IOException {
51556      composeDomainResourceElements(element);
51557      if (element.hasIdentifier()) {
51558        openArray("identifier");
51559        for (Identifier e : element.getIdentifier()) 
51560          composeIdentifier(null, e);
51561        closeArray();
51562      };
51563      if (element.hasInstantiatesCanonical()) {
51564        openArray("instantiatesCanonical");
51565        for (CanonicalType e : element.getInstantiatesCanonical()) 
51566          composeCanonicalCore(null, e, true);
51567        closeArray();
51568        if (anyHasExtras(element.getInstantiatesCanonical())) {
51569          openArray("_instantiatesCanonical");
51570          for (CanonicalType e : element.getInstantiatesCanonical()) 
51571            composeCanonicalExtras(null, e, true);
51572          closeArray();
51573        }
51574      };
51575      if (element.hasInstantiatesUri()) {
51576        openArray("instantiatesUri");
51577        for (UriType e : element.getInstantiatesUri()) 
51578          composeUriCore(null, e, true);
51579        closeArray();
51580        if (anyHasExtras(element.getInstantiatesUri())) {
51581          openArray("_instantiatesUri");
51582          for (UriType e : element.getInstantiatesUri()) 
51583            composeUriExtras(null, e, true);
51584          closeArray();
51585        }
51586      };
51587      if (element.hasBasedOn()) {
51588        openArray("basedOn");
51589        for (Reference e : element.getBasedOn()) 
51590          composeReference(null, e);
51591        closeArray();
51592      };
51593      if (element.hasPartOf()) {
51594        openArray("partOf");
51595        for (Reference e : element.getPartOf()) 
51596          composeReference(null, e);
51597        closeArray();
51598      };
51599      if (element.hasStatusElement()) {
51600        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
51601        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
51602      }
51603      if (element.hasStatusReason()) {
51604        composeCodeableConcept("statusReason", element.getStatusReason());
51605      }
51606      if (element.hasCategory()) {
51607        composeCodeableConcept("category", element.getCategory());
51608      }
51609      if (element.hasCode()) {
51610        composeCodeableConcept("code", element.getCode());
51611      }
51612      if (element.hasSubject()) {
51613        composeReference("subject", element.getSubject());
51614      }
51615      if (element.hasEncounter()) {
51616        composeReference("encounter", element.getEncounter());
51617      }
51618      if (element.hasPerformed()) {
51619        composeType("performed", element.getPerformed());
51620      }
51621      if (element.hasRecorder()) {
51622        composeReference("recorder", element.getRecorder());
51623      }
51624      if (element.hasAsserter()) {
51625        composeReference("asserter", element.getAsserter());
51626      }
51627      if (element.hasPerformer()) {
51628        openArray("performer");
51629        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
51630          composeProcedureProcedurePerformerComponent(null, e);
51631        closeArray();
51632      };
51633      if (element.hasLocation()) {
51634        composeReference("location", element.getLocation());
51635      }
51636      if (element.hasReasonCode()) {
51637        openArray("reasonCode");
51638        for (CodeableConcept e : element.getReasonCode()) 
51639          composeCodeableConcept(null, e);
51640        closeArray();
51641      };
51642      if (element.hasReasonReference()) {
51643        openArray("reasonReference");
51644        for (Reference e : element.getReasonReference()) 
51645          composeReference(null, e);
51646        closeArray();
51647      };
51648      if (element.hasBodySite()) {
51649        openArray("bodySite");
51650        for (CodeableConcept e : element.getBodySite()) 
51651          composeCodeableConcept(null, e);
51652        closeArray();
51653      };
51654      if (element.hasOutcome()) {
51655        composeCodeableConcept("outcome", element.getOutcome());
51656      }
51657      if (element.hasReport()) {
51658        openArray("report");
51659        for (Reference e : element.getReport()) 
51660          composeReference(null, e);
51661        closeArray();
51662      };
51663      if (element.hasComplication()) {
51664        openArray("complication");
51665        for (CodeableConcept e : element.getComplication()) 
51666          composeCodeableConcept(null, e);
51667        closeArray();
51668      };
51669      if (element.hasComplicationDetail()) {
51670        openArray("complicationDetail");
51671        for (Reference e : element.getComplicationDetail()) 
51672          composeReference(null, e);
51673        closeArray();
51674      };
51675      if (element.hasFollowUp()) {
51676        openArray("followUp");
51677        for (CodeableConcept e : element.getFollowUp()) 
51678          composeCodeableConcept(null, e);
51679        closeArray();
51680      };
51681      if (element.hasNote()) {
51682        openArray("note");
51683        for (Annotation e : element.getNote()) 
51684          composeAnnotation(null, e);
51685        closeArray();
51686      };
51687      if (element.hasFocalDevice()) {
51688        openArray("focalDevice");
51689        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
51690          composeProcedureProcedureFocalDeviceComponent(null, e);
51691        closeArray();
51692      };
51693      if (element.hasUsedReference()) {
51694        openArray("usedReference");
51695        for (Reference e : element.getUsedReference()) 
51696          composeReference(null, e);
51697        closeArray();
51698      };
51699      if (element.hasUsedCode()) {
51700        openArray("usedCode");
51701        for (CodeableConcept e : element.getUsedCode()) 
51702          composeCodeableConcept(null, e);
51703        closeArray();
51704      };
51705  }
51706
51707  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
51708    if (element != null) {
51709      open(name);
51710      composeProcedureProcedurePerformerComponentInner(element);
51711      close();
51712    }
51713  }
51714
51715  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
51716      composeBackbone(element);
51717      if (element.hasFunction()) {
51718        composeCodeableConcept("function", element.getFunction());
51719      }
51720      if (element.hasActor()) {
51721        composeReference("actor", element.getActor());
51722      }
51723      if (element.hasOnBehalfOf()) {
51724        composeReference("onBehalfOf", element.getOnBehalfOf());
51725      }
51726  }
51727
51728  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
51729    if (element != null) {
51730      open(name);
51731      composeProcedureProcedureFocalDeviceComponentInner(element);
51732      close();
51733    }
51734  }
51735
51736  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
51737      composeBackbone(element);
51738      if (element.hasAction()) {
51739        composeCodeableConcept("action", element.getAction());
51740      }
51741      if (element.hasManipulated()) {
51742        composeReference("manipulated", element.getManipulated());
51743      }
51744  }
51745
51746  protected void composeProvenance(String name, Provenance element) throws IOException {
51747    if (element != null) {
51748      prop("resourceType", name);
51749      composeProvenanceInner(element);
51750    }
51751  }
51752
51753  protected void composeProvenanceInner(Provenance element) throws IOException {
51754      composeDomainResourceElements(element);
51755      if (element.hasTarget()) {
51756        openArray("target");
51757        for (Reference e : element.getTarget()) 
51758          composeReference(null, e);
51759        closeArray();
51760      };
51761      if (element.hasOccurred()) {
51762        composeType("occurred", element.getOccurred());
51763      }
51764      if (element.hasRecordedElement()) {
51765        composeInstantCore("recorded", element.getRecordedElement(), false);
51766        composeInstantExtras("recorded", element.getRecordedElement(), false);
51767      }
51768      if (element.hasPolicy()) {
51769        openArray("policy");
51770        for (UriType e : element.getPolicy()) 
51771          composeUriCore(null, e, true);
51772        closeArray();
51773        if (anyHasExtras(element.getPolicy())) {
51774          openArray("_policy");
51775          for (UriType e : element.getPolicy()) 
51776            composeUriExtras(null, e, true);
51777          closeArray();
51778        }
51779      };
51780      if (element.hasLocation()) {
51781        composeReference("location", element.getLocation());
51782      }
51783      if (element.hasReason()) {
51784        openArray("reason");
51785        for (CodeableConcept e : element.getReason()) 
51786          composeCodeableConcept(null, e);
51787        closeArray();
51788      };
51789      if (element.hasActivity()) {
51790        composeCodeableConcept("activity", element.getActivity());
51791      }
51792      if (element.hasAgent()) {
51793        openArray("agent");
51794        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
51795          composeProvenanceProvenanceAgentComponent(null, e);
51796        closeArray();
51797      };
51798      if (element.hasEntity()) {
51799        openArray("entity");
51800        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
51801          composeProvenanceProvenanceEntityComponent(null, e);
51802        closeArray();
51803      };
51804      if (element.hasSignature()) {
51805        openArray("signature");
51806        for (Signature e : element.getSignature()) 
51807          composeSignature(null, e);
51808        closeArray();
51809      };
51810  }
51811
51812  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
51813    if (element != null) {
51814      open(name);
51815      composeProvenanceProvenanceAgentComponentInner(element);
51816      close();
51817    }
51818  }
51819
51820  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
51821      composeBackbone(element);
51822      if (element.hasType()) {
51823        composeCodeableConcept("type", element.getType());
51824      }
51825      if (element.hasRole()) {
51826        openArray("role");
51827        for (CodeableConcept e : element.getRole()) 
51828          composeCodeableConcept(null, e);
51829        closeArray();
51830      };
51831      if (element.hasWho()) {
51832        composeReference("who", element.getWho());
51833      }
51834      if (element.hasOnBehalfOf()) {
51835        composeReference("onBehalfOf", element.getOnBehalfOf());
51836      }
51837  }
51838
51839  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
51840    if (element != null) {
51841      open(name);
51842      composeProvenanceProvenanceEntityComponentInner(element);
51843      close();
51844    }
51845  }
51846
51847  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
51848      composeBackbone(element);
51849      if (element.hasRoleElement()) {
51850        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
51851        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
51852      }
51853      if (element.hasWhat()) {
51854        composeReference("what", element.getWhat());
51855      }
51856      if (element.hasAgent()) {
51857        openArray("agent");
51858        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
51859          composeProvenanceProvenanceAgentComponent(null, e);
51860        closeArray();
51861      };
51862  }
51863
51864  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
51865    if (element != null) {
51866      prop("resourceType", name);
51867      composeQuestionnaireInner(element);
51868    }
51869  }
51870
51871  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
51872      composeDomainResourceElements(element);
51873      if (element.hasUrlElement()) {
51874        composeUriCore("url", element.getUrlElement(), false);
51875        composeUriExtras("url", element.getUrlElement(), false);
51876      }
51877      if (element.hasIdentifier()) {
51878        openArray("identifier");
51879        for (Identifier e : element.getIdentifier()) 
51880          composeIdentifier(null, e);
51881        closeArray();
51882      };
51883      if (element.hasVersionElement()) {
51884        composeStringCore("version", element.getVersionElement(), false);
51885        composeStringExtras("version", element.getVersionElement(), false);
51886      }
51887      if (element.hasNameElement()) {
51888        composeStringCore("name", element.getNameElement(), false);
51889        composeStringExtras("name", element.getNameElement(), false);
51890      }
51891      if (element.hasTitleElement()) {
51892        composeStringCore("title", element.getTitleElement(), false);
51893        composeStringExtras("title", element.getTitleElement(), false);
51894      }
51895      if (element.hasDerivedFrom()) {
51896        openArray("derivedFrom");
51897        for (CanonicalType e : element.getDerivedFrom()) 
51898          composeCanonicalCore(null, e, true);
51899        closeArray();
51900        if (anyHasExtras(element.getDerivedFrom())) {
51901          openArray("_derivedFrom");
51902          for (CanonicalType e : element.getDerivedFrom()) 
51903            composeCanonicalExtras(null, e, true);
51904          closeArray();
51905        }
51906      };
51907      if (element.hasStatusElement()) {
51908        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51909        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51910      }
51911      if (element.hasExperimentalElement()) {
51912        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51913        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51914      }
51915      if (element.hasSubjectType()) {
51916        openArray("subjectType");
51917        for (CodeType e : element.getSubjectType()) 
51918          composeCodeCore(null, e, true);
51919        closeArray();
51920        if (anyHasExtras(element.getSubjectType())) {
51921          openArray("_subjectType");
51922          for (CodeType e : element.getSubjectType()) 
51923            composeCodeExtras(null, e, true);
51924          closeArray();
51925        }
51926      };
51927      if (element.hasDateElement()) {
51928        composeDateTimeCore("date", element.getDateElement(), false);
51929        composeDateTimeExtras("date", element.getDateElement(), false);
51930      }
51931      if (element.hasPublisherElement()) {
51932        composeStringCore("publisher", element.getPublisherElement(), false);
51933        composeStringExtras("publisher", element.getPublisherElement(), false);
51934      }
51935      if (element.hasContact()) {
51936        openArray("contact");
51937        for (ContactDetail e : element.getContact()) 
51938          composeContactDetail(null, e);
51939        closeArray();
51940      };
51941      if (element.hasDescriptionElement()) {
51942        composeMarkdownCore("description", element.getDescriptionElement(), false);
51943        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51944      }
51945      if (element.hasUseContext()) {
51946        openArray("useContext");
51947        for (UsageContext e : element.getUseContext()) 
51948          composeUsageContext(null, e);
51949        closeArray();
51950      };
51951      if (element.hasJurisdiction()) {
51952        openArray("jurisdiction");
51953        for (CodeableConcept e : element.getJurisdiction()) 
51954          composeCodeableConcept(null, e);
51955        closeArray();
51956      };
51957      if (element.hasPurposeElement()) {
51958        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51959        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51960      }
51961      if (element.hasCopyrightElement()) {
51962        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51963        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51964      }
51965      if (element.hasApprovalDateElement()) {
51966        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51967        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51968      }
51969      if (element.hasLastReviewDateElement()) {
51970        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51971        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51972      }
51973      if (element.hasEffectivePeriod()) {
51974        composePeriod("effectivePeriod", element.getEffectivePeriod());
51975      }
51976      if (element.hasCode()) {
51977        openArray("code");
51978        for (Coding e : element.getCode()) 
51979          composeCoding(null, e);
51980        closeArray();
51981      };
51982      if (element.hasItem()) {
51983        openArray("item");
51984        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
51985          composeQuestionnaireQuestionnaireItemComponent(null, e);
51986        closeArray();
51987      };
51988  }
51989
51990  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
51991    if (element != null) {
51992      open(name);
51993      composeQuestionnaireQuestionnaireItemComponentInner(element);
51994      close();
51995    }
51996  }
51997
51998  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
51999      composeBackbone(element);
52000      if (element.hasLinkIdElement()) {
52001        composeStringCore("linkId", element.getLinkIdElement(), false);
52002        composeStringExtras("linkId", element.getLinkIdElement(), false);
52003      }
52004      if (element.hasDefinitionElement()) {
52005        composeUriCore("definition", element.getDefinitionElement(), false);
52006        composeUriExtras("definition", element.getDefinitionElement(), false);
52007      }
52008      if (element.hasCode()) {
52009        openArray("code");
52010        for (Coding e : element.getCode()) 
52011          composeCoding(null, e);
52012        closeArray();
52013      };
52014      if (element.hasPrefixElement()) {
52015        composeStringCore("prefix", element.getPrefixElement(), false);
52016        composeStringExtras("prefix", element.getPrefixElement(), false);
52017      }
52018      if (element.hasTextElement()) {
52019        composeStringCore("text", element.getTextElement(), false);
52020        composeStringExtras("text", element.getTextElement(), false);
52021      }
52022      if (element.hasTypeElement()) {
52023        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
52024        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
52025      }
52026      if (element.hasEnableWhen()) {
52027        openArray("enableWhen");
52028        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
52029          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
52030        closeArray();
52031      };
52032      if (element.hasEnableBehaviorElement()) {
52033        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
52034        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
52035      }
52036      if (element.hasRequiredElement()) {
52037        composeBooleanCore("required", element.getRequiredElement(), false);
52038        composeBooleanExtras("required", element.getRequiredElement(), false);
52039      }
52040      if (element.hasRepeatsElement()) {
52041        composeBooleanCore("repeats", element.getRepeatsElement(), false);
52042        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
52043      }
52044      if (element.hasReadOnlyElement()) {
52045        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
52046        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
52047      }
52048      if (element.hasMaxLengthElement()) {
52049        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
52050        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
52051      }
52052      if (element.hasAnswerValueSetElement()) {
52053        composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
52054        composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
52055      }
52056      if (element.hasAnswerOption()) {
52057        openArray("answerOption");
52058        for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption()) 
52059          composeQuestionnaireQuestionnaireItemAnswerOptionComponent(null, e);
52060        closeArray();
52061      };
52062      if (element.hasInitial()) {
52063        openArray("initial");
52064        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
52065          composeQuestionnaireQuestionnaireItemInitialComponent(null, e);
52066        closeArray();
52067      };
52068      if (element.hasItem()) {
52069        openArray("item");
52070        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
52071          composeQuestionnaireQuestionnaireItemComponent(null, e);
52072        closeArray();
52073      };
52074  }
52075
52076  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
52077    if (element != null) {
52078      open(name);
52079      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
52080      close();
52081    }
52082  }
52083
52084  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
52085      composeBackbone(element);
52086      if (element.hasQuestionElement()) {
52087        composeStringCore("question", element.getQuestionElement(), false);
52088        composeStringExtras("question", element.getQuestionElement(), false);
52089      }
52090      if (element.hasOperatorElement()) {
52091        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
52092        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
52093      }
52094      if (element.hasAnswer()) {
52095        composeType("answer", element.getAnswer());
52096      }
52097  }
52098
52099  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
52100    if (element != null) {
52101      open(name);
52102      composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(element);
52103      close();
52104    }
52105  }
52106
52107  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
52108      composeBackbone(element);
52109      if (element.hasValue()) {
52110        composeType("value", element.getValue());
52111      }
52112      if (element.hasInitialSelectedElement()) {
52113        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
52114        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
52115      }
52116  }
52117
52118  protected void composeQuestionnaireQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
52119    if (element != null) {
52120      open(name);
52121      composeQuestionnaireQuestionnaireItemInitialComponentInner(element);
52122      close();
52123    }
52124  }
52125
52126  protected void composeQuestionnaireQuestionnaireItemInitialComponentInner(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
52127      composeBackbone(element);
52128      if (element.hasValue()) {
52129        composeType("value", element.getValue());
52130      }
52131  }
52132
52133  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
52134    if (element != null) {
52135      prop("resourceType", name);
52136      composeQuestionnaireResponseInner(element);
52137    }
52138  }
52139
52140  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
52141      composeDomainResourceElements(element);
52142      if (element.hasIdentifier()) {
52143        composeIdentifier("identifier", element.getIdentifier());
52144      }
52145      if (element.hasBasedOn()) {
52146        openArray("basedOn");
52147        for (Reference e : element.getBasedOn()) 
52148          composeReference(null, e);
52149        closeArray();
52150      };
52151      if (element.hasPartOf()) {
52152        openArray("partOf");
52153        for (Reference e : element.getPartOf()) 
52154          composeReference(null, e);
52155        closeArray();
52156      };
52157      if (element.hasQuestionnaireElement()) {
52158        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
52159        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
52160      }
52161      if (element.hasStatusElement()) {
52162        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
52163        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
52164      }
52165      if (element.hasSubject()) {
52166        composeReference("subject", element.getSubject());
52167      }
52168      if (element.hasEncounter()) {
52169        composeReference("encounter", element.getEncounter());
52170      }
52171      if (element.hasAuthoredElement()) {
52172        composeDateTimeCore("authored", element.getAuthoredElement(), false);
52173        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
52174      }
52175      if (element.hasAuthor()) {
52176        composeReference("author", element.getAuthor());
52177      }
52178      if (element.hasSource()) {
52179        composeReference("source", element.getSource());
52180      }
52181      if (element.hasItem()) {
52182        openArray("item");
52183        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
52184          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
52185        closeArray();
52186      };
52187  }
52188
52189  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
52190    if (element != null) {
52191      open(name);
52192      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
52193      close();
52194    }
52195  }
52196
52197  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
52198      composeBackbone(element);
52199      if (element.hasLinkIdElement()) {
52200        composeStringCore("linkId", element.getLinkIdElement(), false);
52201        composeStringExtras("linkId", element.getLinkIdElement(), false);
52202      }
52203      if (element.hasDefinitionElement()) {
52204        composeUriCore("definition", element.getDefinitionElement(), false);
52205        composeUriExtras("definition", element.getDefinitionElement(), false);
52206      }
52207      if (element.hasTextElement()) {
52208        composeStringCore("text", element.getTextElement(), false);
52209        composeStringExtras("text", element.getTextElement(), false);
52210      }
52211      if (element.hasAnswer()) {
52212        openArray("answer");
52213        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
52214          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
52215        closeArray();
52216      };
52217      if (element.hasItem()) {
52218        openArray("item");
52219        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
52220          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
52221        closeArray();
52222      };
52223  }
52224
52225  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
52226    if (element != null) {
52227      open(name);
52228      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
52229      close();
52230    }
52231  }
52232
52233  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
52234      composeBackbone(element);
52235      if (element.hasValue()) {
52236        composeType("value", element.getValue());
52237      }
52238      if (element.hasItem()) {
52239        openArray("item");
52240        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
52241          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
52242        closeArray();
52243      };
52244  }
52245
52246  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
52247    if (element != null) {
52248      prop("resourceType", name);
52249      composeRelatedPersonInner(element);
52250    }
52251  }
52252
52253  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
52254      composeDomainResourceElements(element);
52255      if (element.hasIdentifier()) {
52256        openArray("identifier");
52257        for (Identifier e : element.getIdentifier()) 
52258          composeIdentifier(null, e);
52259        closeArray();
52260      };
52261      if (element.hasActiveElement()) {
52262        composeBooleanCore("active", element.getActiveElement(), false);
52263        composeBooleanExtras("active", element.getActiveElement(), false);
52264      }
52265      if (element.hasPatient()) {
52266        composeReference("patient", element.getPatient());
52267      }
52268      if (element.hasRelationship()) {
52269        openArray("relationship");
52270        for (CodeableConcept e : element.getRelationship()) 
52271          composeCodeableConcept(null, e);
52272        closeArray();
52273      };
52274      if (element.hasName()) {
52275        openArray("name");
52276        for (HumanName e : element.getName()) 
52277          composeHumanName(null, e);
52278        closeArray();
52279      };
52280      if (element.hasTelecom()) {
52281        openArray("telecom");
52282        for (ContactPoint e : element.getTelecom()) 
52283          composeContactPoint(null, e);
52284        closeArray();
52285      };
52286      if (element.hasGenderElement()) {
52287        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52288        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
52289      }
52290      if (element.hasBirthDateElement()) {
52291        composeDateCore("birthDate", element.getBirthDateElement(), false);
52292        composeDateExtras("birthDate", element.getBirthDateElement(), false);
52293      }
52294      if (element.hasAddress()) {
52295        openArray("address");
52296        for (Address e : element.getAddress()) 
52297          composeAddress(null, e);
52298        closeArray();
52299      };
52300      if (element.hasPhoto()) {
52301        openArray("photo");
52302        for (Attachment e : element.getPhoto()) 
52303          composeAttachment(null, e);
52304        closeArray();
52305      };
52306      if (element.hasPeriod()) {
52307        composePeriod("period", element.getPeriod());
52308      }
52309      if (element.hasCommunication()) {
52310        openArray("communication");
52311        for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication()) 
52312          composeRelatedPersonRelatedPersonCommunicationComponent(null, e);
52313        closeArray();
52314      };
52315  }
52316
52317  protected void composeRelatedPersonRelatedPersonCommunicationComponent(String name, RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
52318    if (element != null) {
52319      open(name);
52320      composeRelatedPersonRelatedPersonCommunicationComponentInner(element);
52321      close();
52322    }
52323  }
52324
52325  protected void composeRelatedPersonRelatedPersonCommunicationComponentInner(RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
52326      composeBackbone(element);
52327      if (element.hasLanguage()) {
52328        composeCodeableConcept("language", element.getLanguage());
52329      }
52330      if (element.hasPreferredElement()) {
52331        composeBooleanCore("preferred", element.getPreferredElement(), false);
52332        composeBooleanExtras("preferred", element.getPreferredElement(), false);
52333      }
52334  }
52335
52336  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
52337    if (element != null) {
52338      prop("resourceType", name);
52339      composeRequestGroupInner(element);
52340    }
52341  }
52342
52343  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
52344      composeDomainResourceElements(element);
52345      if (element.hasIdentifier()) {
52346        openArray("identifier");
52347        for (Identifier e : element.getIdentifier()) 
52348          composeIdentifier(null, e);
52349        closeArray();
52350      };
52351      if (element.hasInstantiatesCanonical()) {
52352        openArray("instantiatesCanonical");
52353        for (CanonicalType e : element.getInstantiatesCanonical()) 
52354          composeCanonicalCore(null, e, true);
52355        closeArray();
52356        if (anyHasExtras(element.getInstantiatesCanonical())) {
52357          openArray("_instantiatesCanonical");
52358          for (CanonicalType e : element.getInstantiatesCanonical()) 
52359            composeCanonicalExtras(null, e, true);
52360          closeArray();
52361        }
52362      };
52363      if (element.hasInstantiatesUri()) {
52364        openArray("instantiatesUri");
52365        for (UriType e : element.getInstantiatesUri()) 
52366          composeUriCore(null, e, true);
52367        closeArray();
52368        if (anyHasExtras(element.getInstantiatesUri())) {
52369          openArray("_instantiatesUri");
52370          for (UriType e : element.getInstantiatesUri()) 
52371            composeUriExtras(null, e, true);
52372          closeArray();
52373        }
52374      };
52375      if (element.hasBasedOn()) {
52376        openArray("basedOn");
52377        for (Reference e : element.getBasedOn()) 
52378          composeReference(null, e);
52379        closeArray();
52380      };
52381      if (element.hasReplaces()) {
52382        openArray("replaces");
52383        for (Reference e : element.getReplaces()) 
52384          composeReference(null, e);
52385        closeArray();
52386      };
52387      if (element.hasGroupIdentifier()) {
52388        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
52389      }
52390      if (element.hasStatusElement()) {
52391        composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
52392        composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
52393      }
52394      if (element.hasIntentElement()) {
52395        composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
52396        composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
52397      }
52398      if (element.hasPriorityElement()) {
52399        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
52400        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
52401      }
52402      if (element.hasCode()) {
52403        composeCodeableConcept("code", element.getCode());
52404      }
52405      if (element.hasSubject()) {
52406        composeReference("subject", element.getSubject());
52407      }
52408      if (element.hasEncounter()) {
52409        composeReference("encounter", element.getEncounter());
52410      }
52411      if (element.hasAuthoredOnElement()) {
52412        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
52413        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
52414      }
52415      if (element.hasAuthor()) {
52416        composeReference("author", element.getAuthor());
52417      }
52418      if (element.hasReasonCode()) {
52419        openArray("reasonCode");
52420        for (CodeableConcept e : element.getReasonCode()) 
52421          composeCodeableConcept(null, e);
52422        closeArray();
52423      };
52424      if (element.hasReasonReference()) {
52425        openArray("reasonReference");
52426        for (Reference e : element.getReasonReference()) 
52427          composeReference(null, e);
52428        closeArray();
52429      };
52430      if (element.hasNote()) {
52431        openArray("note");
52432        for (Annotation e : element.getNote()) 
52433          composeAnnotation(null, e);
52434        closeArray();
52435      };
52436      if (element.hasAction()) {
52437        openArray("action");
52438        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
52439          composeRequestGroupRequestGroupActionComponent(null, e);
52440        closeArray();
52441      };
52442  }
52443
52444  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
52445    if (element != null) {
52446      open(name);
52447      composeRequestGroupRequestGroupActionComponentInner(element);
52448      close();
52449    }
52450  }
52451
52452  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element) throws IOException {
52453      composeBackbone(element);
52454      if (element.hasPrefixElement()) {
52455        composeStringCore("prefix", element.getPrefixElement(), false);
52456        composeStringExtras("prefix", element.getPrefixElement(), false);
52457      }
52458      if (element.hasTitleElement()) {
52459        composeStringCore("title", element.getTitleElement(), false);
52460        composeStringExtras("title", element.getTitleElement(), false);
52461      }
52462      if (element.hasDescriptionElement()) {
52463        composeStringCore("description", element.getDescriptionElement(), false);
52464        composeStringExtras("description", element.getDescriptionElement(), false);
52465      }
52466      if (element.hasTextEquivalentElement()) {
52467        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
52468        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
52469      }
52470      if (element.hasPriorityElement()) {
52471        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
52472        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
52473      }
52474      if (element.hasCode()) {
52475        openArray("code");
52476        for (CodeableConcept e : element.getCode()) 
52477          composeCodeableConcept(null, e);
52478        closeArray();
52479      };
52480      if (element.hasDocumentation()) {
52481        openArray("documentation");
52482        for (RelatedArtifact e : element.getDocumentation()) 
52483          composeRelatedArtifact(null, e);
52484        closeArray();
52485      };
52486      if (element.hasCondition()) {
52487        openArray("condition");
52488        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
52489          composeRequestGroupRequestGroupActionConditionComponent(null, e);
52490        closeArray();
52491      };
52492      if (element.hasRelatedAction()) {
52493        openArray("relatedAction");
52494        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
52495          composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
52496        closeArray();
52497      };
52498      if (element.hasTiming()) {
52499        composeType("timing", element.getTiming());
52500      }
52501      if (element.hasParticipant()) {
52502        openArray("participant");
52503        for (Reference e : element.getParticipant()) 
52504          composeReference(null, e);
52505        closeArray();
52506      };
52507      if (element.hasType()) {
52508        composeCodeableConcept("type", element.getType());
52509      }
52510      if (element.hasGroupingBehaviorElement()) {
52511        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
52512        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
52513      }
52514      if (element.hasSelectionBehaviorElement()) {
52515        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
52516        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
52517      }
52518      if (element.hasRequiredBehaviorElement()) {
52519        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
52520        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
52521      }
52522      if (element.hasPrecheckBehaviorElement()) {
52523        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
52524        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
52525      }
52526      if (element.hasCardinalityBehaviorElement()) {
52527        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
52528        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
52529      }
52530      if (element.hasResource()) {
52531        composeReference("resource", element.getResource());
52532      }
52533      if (element.hasAction()) {
52534        openArray("action");
52535        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
52536          composeRequestGroupRequestGroupActionComponent(null, e);
52537        closeArray();
52538      };
52539  }
52540
52541  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
52542    if (element != null) {
52543      open(name);
52544      composeRequestGroupRequestGroupActionConditionComponentInner(element);
52545      close();
52546    }
52547  }
52548
52549  protected void composeRequestGroupRequestGroupActionConditionComponentInner(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
52550      composeBackbone(element);
52551      if (element.hasKindElement()) {
52552        composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
52553        composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
52554      }
52555      if (element.hasExpression()) {
52556        composeExpression("expression", element.getExpression());
52557      }
52558  }
52559
52560  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
52561    if (element != null) {
52562      open(name);
52563      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
52564      close();
52565    }
52566  }
52567
52568  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
52569      composeBackbone(element);
52570      if (element.hasActionIdElement()) {
52571        composeIdCore("actionId", element.getActionIdElement(), false);
52572        composeIdExtras("actionId", element.getActionIdElement(), false);
52573      }
52574      if (element.hasRelationshipElement()) {
52575        composeEnumerationCore("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
52576        composeEnumerationExtras("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
52577      }
52578      if (element.hasOffset()) {
52579        composeType("offset", element.getOffset());
52580      }
52581  }
52582
52583  protected void composeResearchDefinition(String name, ResearchDefinition element) throws IOException {
52584    if (element != null) {
52585      prop("resourceType", name);
52586      composeResearchDefinitionInner(element);
52587    }
52588  }
52589
52590  protected void composeResearchDefinitionInner(ResearchDefinition element) throws IOException {
52591      composeDomainResourceElements(element);
52592      if (element.hasUrlElement()) {
52593        composeUriCore("url", element.getUrlElement(), false);
52594        composeUriExtras("url", element.getUrlElement(), false);
52595      }
52596      if (element.hasIdentifier()) {
52597        openArray("identifier");
52598        for (Identifier e : element.getIdentifier()) 
52599          composeIdentifier(null, e);
52600        closeArray();
52601      };
52602      if (element.hasVersionElement()) {
52603        composeStringCore("version", element.getVersionElement(), false);
52604        composeStringExtras("version", element.getVersionElement(), false);
52605      }
52606      if (element.hasNameElement()) {
52607        composeStringCore("name", element.getNameElement(), false);
52608        composeStringExtras("name", element.getNameElement(), false);
52609      }
52610      if (element.hasTitleElement()) {
52611        composeStringCore("title", element.getTitleElement(), false);
52612        composeStringExtras("title", element.getTitleElement(), false);
52613      }
52614      if (element.hasShortTitleElement()) {
52615        composeStringCore("shortTitle", element.getShortTitleElement(), false);
52616        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
52617      }
52618      if (element.hasSubtitleElement()) {
52619        composeStringCore("subtitle", element.getSubtitleElement(), false);
52620        composeStringExtras("subtitle", element.getSubtitleElement(), false);
52621      }
52622      if (element.hasStatusElement()) {
52623        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52624        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52625      }
52626      if (element.hasExperimentalElement()) {
52627        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52628        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52629      }
52630      if (element.hasSubject()) {
52631        composeType("subject", element.getSubject());
52632      }
52633      if (element.hasDateElement()) {
52634        composeDateTimeCore("date", element.getDateElement(), false);
52635        composeDateTimeExtras("date", element.getDateElement(), false);
52636      }
52637      if (element.hasPublisherElement()) {
52638        composeStringCore("publisher", element.getPublisherElement(), false);
52639        composeStringExtras("publisher", element.getPublisherElement(), false);
52640      }
52641      if (element.hasContact()) {
52642        openArray("contact");
52643        for (ContactDetail e : element.getContact()) 
52644          composeContactDetail(null, e);
52645        closeArray();
52646      };
52647      if (element.hasDescriptionElement()) {
52648        composeMarkdownCore("description", element.getDescriptionElement(), false);
52649        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52650      }
52651      if (element.hasComment()) {
52652        openArray("comment");
52653        for (StringType e : element.getComment()) 
52654          composeStringCore(null, e, true);
52655        closeArray();
52656        if (anyHasExtras(element.getComment())) {
52657          openArray("_comment");
52658          for (StringType e : element.getComment()) 
52659            composeStringExtras(null, e, true);
52660          closeArray();
52661        }
52662      };
52663      if (element.hasUseContext()) {
52664        openArray("useContext");
52665        for (UsageContext e : element.getUseContext()) 
52666          composeUsageContext(null, e);
52667        closeArray();
52668      };
52669      if (element.hasJurisdiction()) {
52670        openArray("jurisdiction");
52671        for (CodeableConcept e : element.getJurisdiction()) 
52672          composeCodeableConcept(null, e);
52673        closeArray();
52674      };
52675      if (element.hasPurposeElement()) {
52676        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52677        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52678      }
52679      if (element.hasUsageElement()) {
52680        composeStringCore("usage", element.getUsageElement(), false);
52681        composeStringExtras("usage", element.getUsageElement(), false);
52682      }
52683      if (element.hasCopyrightElement()) {
52684        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52685        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52686      }
52687      if (element.hasApprovalDateElement()) {
52688        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52689        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52690      }
52691      if (element.hasLastReviewDateElement()) {
52692        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52693        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52694      }
52695      if (element.hasEffectivePeriod()) {
52696        composePeriod("effectivePeriod", element.getEffectivePeriod());
52697      }
52698      if (element.hasTopic()) {
52699        openArray("topic");
52700        for (CodeableConcept e : element.getTopic()) 
52701          composeCodeableConcept(null, e);
52702        closeArray();
52703      };
52704      if (element.hasAuthor()) {
52705        openArray("author");
52706        for (ContactDetail e : element.getAuthor()) 
52707          composeContactDetail(null, e);
52708        closeArray();
52709      };
52710      if (element.hasEditor()) {
52711        openArray("editor");
52712        for (ContactDetail e : element.getEditor()) 
52713          composeContactDetail(null, e);
52714        closeArray();
52715      };
52716      if (element.hasReviewer()) {
52717        openArray("reviewer");
52718        for (ContactDetail e : element.getReviewer()) 
52719          composeContactDetail(null, e);
52720        closeArray();
52721      };
52722      if (element.hasEndorser()) {
52723        openArray("endorser");
52724        for (ContactDetail e : element.getEndorser()) 
52725          composeContactDetail(null, e);
52726        closeArray();
52727      };
52728      if (element.hasRelatedArtifact()) {
52729        openArray("relatedArtifact");
52730        for (RelatedArtifact e : element.getRelatedArtifact()) 
52731          composeRelatedArtifact(null, e);
52732        closeArray();
52733      };
52734      if (element.hasLibrary()) {
52735        openArray("library");
52736        for (CanonicalType e : element.getLibrary()) 
52737          composeCanonicalCore(null, e, true);
52738        closeArray();
52739        if (anyHasExtras(element.getLibrary())) {
52740          openArray("_library");
52741          for (CanonicalType e : element.getLibrary()) 
52742            composeCanonicalExtras(null, e, true);
52743          closeArray();
52744        }
52745      };
52746      if (element.hasPopulation()) {
52747        composeReference("population", element.getPopulation());
52748      }
52749      if (element.hasExposure()) {
52750        composeReference("exposure", element.getExposure());
52751      }
52752      if (element.hasExposureAlternative()) {
52753        composeReference("exposureAlternative", element.getExposureAlternative());
52754      }
52755      if (element.hasOutcome()) {
52756        composeReference("outcome", element.getOutcome());
52757      }
52758  }
52759
52760  protected void composeResearchElementDefinition(String name, ResearchElementDefinition element) throws IOException {
52761    if (element != null) {
52762      prop("resourceType", name);
52763      composeResearchElementDefinitionInner(element);
52764    }
52765  }
52766
52767  protected void composeResearchElementDefinitionInner(ResearchElementDefinition element) throws IOException {
52768      composeDomainResourceElements(element);
52769      if (element.hasUrlElement()) {
52770        composeUriCore("url", element.getUrlElement(), false);
52771        composeUriExtras("url", element.getUrlElement(), false);
52772      }
52773      if (element.hasIdentifier()) {
52774        openArray("identifier");
52775        for (Identifier e : element.getIdentifier()) 
52776          composeIdentifier(null, e);
52777        closeArray();
52778      };
52779      if (element.hasVersionElement()) {
52780        composeStringCore("version", element.getVersionElement(), false);
52781        composeStringExtras("version", element.getVersionElement(), false);
52782      }
52783      if (element.hasNameElement()) {
52784        composeStringCore("name", element.getNameElement(), false);
52785        composeStringExtras("name", element.getNameElement(), false);
52786      }
52787      if (element.hasTitleElement()) {
52788        composeStringCore("title", element.getTitleElement(), false);
52789        composeStringExtras("title", element.getTitleElement(), false);
52790      }
52791      if (element.hasShortTitleElement()) {
52792        composeStringCore("shortTitle", element.getShortTitleElement(), false);
52793        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
52794      }
52795      if (element.hasSubtitleElement()) {
52796        composeStringCore("subtitle", element.getSubtitleElement(), false);
52797        composeStringExtras("subtitle", element.getSubtitleElement(), false);
52798      }
52799      if (element.hasStatusElement()) {
52800        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52801        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52802      }
52803      if (element.hasExperimentalElement()) {
52804        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52805        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52806      }
52807      if (element.hasSubject()) {
52808        composeType("subject", element.getSubject());
52809      }
52810      if (element.hasDateElement()) {
52811        composeDateTimeCore("date", element.getDateElement(), false);
52812        composeDateTimeExtras("date", element.getDateElement(), false);
52813      }
52814      if (element.hasPublisherElement()) {
52815        composeStringCore("publisher", element.getPublisherElement(), false);
52816        composeStringExtras("publisher", element.getPublisherElement(), false);
52817      }
52818      if (element.hasContact()) {
52819        openArray("contact");
52820        for (ContactDetail e : element.getContact()) 
52821          composeContactDetail(null, e);
52822        closeArray();
52823      };
52824      if (element.hasDescriptionElement()) {
52825        composeMarkdownCore("description", element.getDescriptionElement(), false);
52826        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52827      }
52828      if (element.hasComment()) {
52829        openArray("comment");
52830        for (StringType e : element.getComment()) 
52831          composeStringCore(null, e, true);
52832        closeArray();
52833        if (anyHasExtras(element.getComment())) {
52834          openArray("_comment");
52835          for (StringType e : element.getComment()) 
52836            composeStringExtras(null, e, true);
52837          closeArray();
52838        }
52839      };
52840      if (element.hasUseContext()) {
52841        openArray("useContext");
52842        for (UsageContext e : element.getUseContext()) 
52843          composeUsageContext(null, e);
52844        closeArray();
52845      };
52846      if (element.hasJurisdiction()) {
52847        openArray("jurisdiction");
52848        for (CodeableConcept e : element.getJurisdiction()) 
52849          composeCodeableConcept(null, e);
52850        closeArray();
52851      };
52852      if (element.hasPurposeElement()) {
52853        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52854        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52855      }
52856      if (element.hasUsageElement()) {
52857        composeStringCore("usage", element.getUsageElement(), false);
52858        composeStringExtras("usage", element.getUsageElement(), false);
52859      }
52860      if (element.hasCopyrightElement()) {
52861        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52862        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52863      }
52864      if (element.hasApprovalDateElement()) {
52865        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52866        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52867      }
52868      if (element.hasLastReviewDateElement()) {
52869        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52870        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52871      }
52872      if (element.hasEffectivePeriod()) {
52873        composePeriod("effectivePeriod", element.getEffectivePeriod());
52874      }
52875      if (element.hasTopic()) {
52876        openArray("topic");
52877        for (CodeableConcept e : element.getTopic()) 
52878          composeCodeableConcept(null, e);
52879        closeArray();
52880      };
52881      if (element.hasAuthor()) {
52882        openArray("author");
52883        for (ContactDetail e : element.getAuthor()) 
52884          composeContactDetail(null, e);
52885        closeArray();
52886      };
52887      if (element.hasEditor()) {
52888        openArray("editor");
52889        for (ContactDetail e : element.getEditor()) 
52890          composeContactDetail(null, e);
52891        closeArray();
52892      };
52893      if (element.hasReviewer()) {
52894        openArray("reviewer");
52895        for (ContactDetail e : element.getReviewer()) 
52896          composeContactDetail(null, e);
52897        closeArray();
52898      };
52899      if (element.hasEndorser()) {
52900        openArray("endorser");
52901        for (ContactDetail e : element.getEndorser()) 
52902          composeContactDetail(null, e);
52903        closeArray();
52904      };
52905      if (element.hasRelatedArtifact()) {
52906        openArray("relatedArtifact");
52907        for (RelatedArtifact e : element.getRelatedArtifact()) 
52908          composeRelatedArtifact(null, e);
52909        closeArray();
52910      };
52911      if (element.hasLibrary()) {
52912        openArray("library");
52913        for (CanonicalType e : element.getLibrary()) 
52914          composeCanonicalCore(null, e, true);
52915        closeArray();
52916        if (anyHasExtras(element.getLibrary())) {
52917          openArray("_library");
52918          for (CanonicalType e : element.getLibrary()) 
52919            composeCanonicalExtras(null, e, true);
52920          closeArray();
52921        }
52922      };
52923      if (element.hasTypeElement()) {
52924        composeEnumerationCore("type", element.getTypeElement(), new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
52925        composeEnumerationExtras("type", element.getTypeElement(), new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
52926      }
52927      if (element.hasVariableTypeElement()) {
52928        composeEnumerationCore("variableType", element.getVariableTypeElement(), new ResearchElementDefinition.VariableTypeEnumFactory(), false);
52929        composeEnumerationExtras("variableType", element.getVariableTypeElement(), new ResearchElementDefinition.VariableTypeEnumFactory(), false);
52930      }
52931      if (element.hasCharacteristic()) {
52932        openArray("characteristic");
52933        for (ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent e : element.getCharacteristic()) 
52934          composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(null, e);
52935        closeArray();
52936      };
52937  }
52938
52939  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(String name, ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
52940    if (element != null) {
52941      open(name);
52942      composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentInner(element);
52943      close();
52944    }
52945  }
52946
52947  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentInner(ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
52948      composeBackbone(element);
52949      if (element.hasDefinition()) {
52950        composeType("definition", element.getDefinition());
52951      }
52952      if (element.hasUsageContext()) {
52953        openArray("usageContext");
52954        for (UsageContext e : element.getUsageContext()) 
52955          composeUsageContext(null, e);
52956        closeArray();
52957      };
52958      if (element.hasExcludeElement()) {
52959        composeBooleanCore("exclude", element.getExcludeElement(), false);
52960        composeBooleanExtras("exclude", element.getExcludeElement(), false);
52961      }
52962      if (element.hasUnitOfMeasure()) {
52963        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
52964      }
52965      if (element.hasStudyEffectiveDescriptionElement()) {
52966        composeStringCore("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
52967        composeStringExtras("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
52968      }
52969      if (element.hasStudyEffective()) {
52970        composeType("studyEffective", element.getStudyEffective());
52971      }
52972      if (element.hasStudyEffectiveTimeFromStart()) {
52973        composeDuration("studyEffectiveTimeFromStart", element.getStudyEffectiveTimeFromStart());
52974      }
52975      if (element.hasStudyEffectiveGroupMeasureElement()) {
52976        composeEnumerationCore("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52977        composeEnumerationExtras("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52978      }
52979      if (element.hasParticipantEffectiveDescriptionElement()) {
52980        composeStringCore("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
52981        composeStringExtras("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
52982      }
52983      if (element.hasParticipantEffective()) {
52984        composeType("participantEffective", element.getParticipantEffective());
52985      }
52986      if (element.hasParticipantEffectiveTimeFromStart()) {
52987        composeDuration("participantEffectiveTimeFromStart", element.getParticipantEffectiveTimeFromStart());
52988      }
52989      if (element.hasParticipantEffectiveGroupMeasureElement()) {
52990        composeEnumerationCore("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52991        composeEnumerationExtras("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52992      }
52993  }
52994
52995  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
52996    if (element != null) {
52997      prop("resourceType", name);
52998      composeResearchStudyInner(element);
52999    }
53000  }
53001
53002  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
53003      composeDomainResourceElements(element);
53004      if (element.hasIdentifier()) {
53005        openArray("identifier");
53006        for (Identifier e : element.getIdentifier()) 
53007          composeIdentifier(null, e);
53008        closeArray();
53009      };
53010      if (element.hasTitleElement()) {
53011        composeStringCore("title", element.getTitleElement(), false);
53012        composeStringExtras("title", element.getTitleElement(), false);
53013      }
53014      if (element.hasProtocol()) {
53015        openArray("protocol");
53016        for (Reference e : element.getProtocol()) 
53017          composeReference(null, e);
53018        closeArray();
53019      };
53020      if (element.hasPartOf()) {
53021        openArray("partOf");
53022        for (Reference e : element.getPartOf()) 
53023          composeReference(null, e);
53024        closeArray();
53025      };
53026      if (element.hasStatusElement()) {
53027        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
53028        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
53029      }
53030      if (element.hasPrimaryPurposeType()) {
53031        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
53032      }
53033      if (element.hasPhase()) {
53034        composeCodeableConcept("phase", element.getPhase());
53035      }
53036      if (element.hasCategory()) {
53037        openArray("category");
53038        for (CodeableConcept e : element.getCategory()) 
53039          composeCodeableConcept(null, e);
53040        closeArray();
53041      };
53042      if (element.hasFocus()) {
53043        openArray("focus");
53044        for (CodeableConcept e : element.getFocus()) 
53045          composeCodeableConcept(null, e);
53046        closeArray();
53047      };
53048      if (element.hasCondition()) {
53049        openArray("condition");
53050        for (CodeableConcept e : element.getCondition()) 
53051          composeCodeableConcept(null, e);
53052        closeArray();
53053      };
53054      if (element.hasContact()) {
53055        openArray("contact");
53056        for (ContactDetail e : element.getContact()) 
53057          composeContactDetail(null, e);
53058        closeArray();
53059      };
53060      if (element.hasRelatedArtifact()) {
53061        openArray("relatedArtifact");
53062        for (RelatedArtifact e : element.getRelatedArtifact()) 
53063          composeRelatedArtifact(null, e);
53064        closeArray();
53065      };
53066      if (element.hasKeyword()) {
53067        openArray("keyword");
53068        for (CodeableConcept e : element.getKeyword()) 
53069          composeCodeableConcept(null, e);
53070        closeArray();
53071      };
53072      if (element.hasLocation()) {
53073        openArray("location");
53074        for (CodeableConcept e : element.getLocation()) 
53075          composeCodeableConcept(null, e);
53076        closeArray();
53077      };
53078      if (element.hasDescriptionElement()) {
53079        composeMarkdownCore("description", element.getDescriptionElement(), false);
53080        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53081      }
53082      if (element.hasEnrollment()) {
53083        openArray("enrollment");
53084        for (Reference e : element.getEnrollment()) 
53085          composeReference(null, e);
53086        closeArray();
53087      };
53088      if (element.hasPeriod()) {
53089        composePeriod("period", element.getPeriod());
53090      }
53091      if (element.hasSponsor()) {
53092        composeReference("sponsor", element.getSponsor());
53093      }
53094      if (element.hasPrincipalInvestigator()) {
53095        composeReference("principalInvestigator", element.getPrincipalInvestigator());
53096      }
53097      if (element.hasSite()) {
53098        openArray("site");
53099        for (Reference e : element.getSite()) 
53100          composeReference(null, e);
53101        closeArray();
53102      };
53103      if (element.hasReasonStopped()) {
53104        composeCodeableConcept("reasonStopped", element.getReasonStopped());
53105      }
53106      if (element.hasNote()) {
53107        openArray("note");
53108        for (Annotation e : element.getNote()) 
53109          composeAnnotation(null, e);
53110        closeArray();
53111      };
53112      if (element.hasArm()) {
53113        openArray("arm");
53114        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
53115          composeResearchStudyResearchStudyArmComponent(null, e);
53116        closeArray();
53117      };
53118      if (element.hasObjective()) {
53119        openArray("objective");
53120        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
53121          composeResearchStudyResearchStudyObjectiveComponent(null, e);
53122        closeArray();
53123      };
53124  }
53125
53126  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
53127    if (element != null) {
53128      open(name);
53129      composeResearchStudyResearchStudyArmComponentInner(element);
53130      close();
53131    }
53132  }
53133
53134  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
53135      composeBackbone(element);
53136      if (element.hasNameElement()) {
53137        composeStringCore("name", element.getNameElement(), false);
53138        composeStringExtras("name", element.getNameElement(), false);
53139      }
53140      if (element.hasType()) {
53141        composeCodeableConcept("type", element.getType());
53142      }
53143      if (element.hasDescriptionElement()) {
53144        composeStringCore("description", element.getDescriptionElement(), false);
53145        composeStringExtras("description", element.getDescriptionElement(), false);
53146      }
53147  }
53148
53149  protected void composeResearchStudyResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
53150    if (element != null) {
53151      open(name);
53152      composeResearchStudyResearchStudyObjectiveComponentInner(element);
53153      close();
53154    }
53155  }
53156
53157  protected void composeResearchStudyResearchStudyObjectiveComponentInner(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
53158      composeBackbone(element);
53159      if (element.hasNameElement()) {
53160        composeStringCore("name", element.getNameElement(), false);
53161        composeStringExtras("name", element.getNameElement(), false);
53162      }
53163      if (element.hasType()) {
53164        composeCodeableConcept("type", element.getType());
53165      }
53166  }
53167
53168  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
53169    if (element != null) {
53170      prop("resourceType", name);
53171      composeResearchSubjectInner(element);
53172    }
53173  }
53174
53175  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
53176      composeDomainResourceElements(element);
53177      if (element.hasIdentifier()) {
53178        openArray("identifier");
53179        for (Identifier e : element.getIdentifier()) 
53180          composeIdentifier(null, e);
53181        closeArray();
53182      };
53183      if (element.hasStatusElement()) {
53184        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
53185        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
53186      }
53187      if (element.hasPeriod()) {
53188        composePeriod("period", element.getPeriod());
53189      }
53190      if (element.hasStudy()) {
53191        composeReference("study", element.getStudy());
53192      }
53193      if (element.hasIndividual()) {
53194        composeReference("individual", element.getIndividual());
53195      }
53196      if (element.hasAssignedArmElement()) {
53197        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
53198        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
53199      }
53200      if (element.hasActualArmElement()) {
53201        composeStringCore("actualArm", element.getActualArmElement(), false);
53202        composeStringExtras("actualArm", element.getActualArmElement(), false);
53203      }
53204      if (element.hasConsent()) {
53205        composeReference("consent", element.getConsent());
53206      }
53207  }
53208
53209  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
53210    if (element != null) {
53211      prop("resourceType", name);
53212      composeRiskAssessmentInner(element);
53213    }
53214  }
53215
53216  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
53217      composeDomainResourceElements(element);
53218      if (element.hasIdentifier()) {
53219        openArray("identifier");
53220        for (Identifier e : element.getIdentifier()) 
53221          composeIdentifier(null, e);
53222        closeArray();
53223      };
53224      if (element.hasBasedOn()) {
53225        composeReference("basedOn", element.getBasedOn());
53226      }
53227      if (element.hasParent()) {
53228        composeReference("parent", element.getParent());
53229      }
53230      if (element.hasStatusElement()) {
53231        composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
53232        composeEnumerationExtras("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
53233      }
53234      if (element.hasMethod()) {
53235        composeCodeableConcept("method", element.getMethod());
53236      }
53237      if (element.hasCode()) {
53238        composeCodeableConcept("code", element.getCode());
53239      }
53240      if (element.hasSubject()) {
53241        composeReference("subject", element.getSubject());
53242      }
53243      if (element.hasEncounter()) {
53244        composeReference("encounter", element.getEncounter());
53245      }
53246      if (element.hasOccurrence()) {
53247        composeType("occurrence", element.getOccurrence());
53248      }
53249      if (element.hasCondition()) {
53250        composeReference("condition", element.getCondition());
53251      }
53252      if (element.hasPerformer()) {
53253        composeReference("performer", element.getPerformer());
53254      }
53255      if (element.hasReasonCode()) {
53256        openArray("reasonCode");
53257        for (CodeableConcept e : element.getReasonCode()) 
53258          composeCodeableConcept(null, e);
53259        closeArray();
53260      };
53261      if (element.hasReasonReference()) {
53262        openArray("reasonReference");
53263        for (Reference e : element.getReasonReference()) 
53264          composeReference(null, e);
53265        closeArray();
53266      };
53267      if (element.hasBasis()) {
53268        openArray("basis");
53269        for (Reference e : element.getBasis()) 
53270          composeReference(null, e);
53271        closeArray();
53272      };
53273      if (element.hasPrediction()) {
53274        openArray("prediction");
53275        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
53276          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
53277        closeArray();
53278      };
53279      if (element.hasMitigationElement()) {
53280        composeStringCore("mitigation", element.getMitigationElement(), false);
53281        composeStringExtras("mitigation", element.getMitigationElement(), false);
53282      }
53283      if (element.hasNote()) {
53284        openArray("note");
53285        for (Annotation e : element.getNote()) 
53286          composeAnnotation(null, e);
53287        closeArray();
53288      };
53289  }
53290
53291  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
53292    if (element != null) {
53293      open(name);
53294      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
53295      close();
53296    }
53297  }
53298
53299  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
53300      composeBackbone(element);
53301      if (element.hasOutcome()) {
53302        composeCodeableConcept("outcome", element.getOutcome());
53303      }
53304      if (element.hasProbability()) {
53305        composeType("probability", element.getProbability());
53306      }
53307      if (element.hasQualitativeRisk()) {
53308        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
53309      }
53310      if (element.hasRelativeRiskElement()) {
53311        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
53312        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
53313      }
53314      if (element.hasWhen()) {
53315        composeType("when", element.getWhen());
53316      }
53317      if (element.hasRationaleElement()) {
53318        composeStringCore("rationale", element.getRationaleElement(), false);
53319        composeStringExtras("rationale", element.getRationaleElement(), false);
53320      }
53321  }
53322
53323  protected void composeRiskEvidenceSynthesis(String name, RiskEvidenceSynthesis element) throws IOException {
53324    if (element != null) {
53325      prop("resourceType", name);
53326      composeRiskEvidenceSynthesisInner(element);
53327    }
53328  }
53329
53330  protected void composeRiskEvidenceSynthesisInner(RiskEvidenceSynthesis element) throws IOException {
53331      composeDomainResourceElements(element);
53332      if (element.hasUrlElement()) {
53333        composeUriCore("url", element.getUrlElement(), false);
53334        composeUriExtras("url", element.getUrlElement(), false);
53335      }
53336      if (element.hasIdentifier()) {
53337        openArray("identifier");
53338        for (Identifier e : element.getIdentifier()) 
53339          composeIdentifier(null, e);
53340        closeArray();
53341      };
53342      if (element.hasVersionElement()) {
53343        composeStringCore("version", element.getVersionElement(), false);
53344        composeStringExtras("version", element.getVersionElement(), false);
53345      }
53346      if (element.hasNameElement()) {
53347        composeStringCore("name", element.getNameElement(), false);
53348        composeStringExtras("name", element.getNameElement(), false);
53349      }
53350      if (element.hasTitleElement()) {
53351        composeStringCore("title", element.getTitleElement(), false);
53352        composeStringExtras("title", element.getTitleElement(), false);
53353      }
53354      if (element.hasStatusElement()) {
53355        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53356        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53357      }
53358      if (element.hasDateElement()) {
53359        composeDateTimeCore("date", element.getDateElement(), false);
53360        composeDateTimeExtras("date", element.getDateElement(), false);
53361      }
53362      if (element.hasPublisherElement()) {
53363        composeStringCore("publisher", element.getPublisherElement(), false);
53364        composeStringExtras("publisher", element.getPublisherElement(), false);
53365      }
53366      if (element.hasContact()) {
53367        openArray("contact");
53368        for (ContactDetail e : element.getContact()) 
53369          composeContactDetail(null, e);
53370        closeArray();
53371      };
53372      if (element.hasDescriptionElement()) {
53373        composeMarkdownCore("description", element.getDescriptionElement(), false);
53374        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53375      }
53376      if (element.hasNote()) {
53377        openArray("note");
53378        for (Annotation e : element.getNote()) 
53379          composeAnnotation(null, e);
53380        closeArray();
53381      };
53382      if (element.hasUseContext()) {
53383        openArray("useContext");
53384        for (UsageContext e : element.getUseContext()) 
53385          composeUsageContext(null, e);
53386        closeArray();
53387      };
53388      if (element.hasJurisdiction()) {
53389        openArray("jurisdiction");
53390        for (CodeableConcept e : element.getJurisdiction()) 
53391          composeCodeableConcept(null, e);
53392        closeArray();
53393      };
53394      if (element.hasCopyrightElement()) {
53395        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
53396        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
53397      }
53398      if (element.hasApprovalDateElement()) {
53399        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
53400        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
53401      }
53402      if (element.hasLastReviewDateElement()) {
53403        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
53404        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
53405      }
53406      if (element.hasEffectivePeriod()) {
53407        composePeriod("effectivePeriod", element.getEffectivePeriod());
53408      }
53409      if (element.hasTopic()) {
53410        openArray("topic");
53411        for (CodeableConcept e : element.getTopic()) 
53412          composeCodeableConcept(null, e);
53413        closeArray();
53414      };
53415      if (element.hasAuthor()) {
53416        openArray("author");
53417        for (ContactDetail e : element.getAuthor()) 
53418          composeContactDetail(null, e);
53419        closeArray();
53420      };
53421      if (element.hasEditor()) {
53422        openArray("editor");
53423        for (ContactDetail e : element.getEditor()) 
53424          composeContactDetail(null, e);
53425        closeArray();
53426      };
53427      if (element.hasReviewer()) {
53428        openArray("reviewer");
53429        for (ContactDetail e : element.getReviewer()) 
53430          composeContactDetail(null, e);
53431        closeArray();
53432      };
53433      if (element.hasEndorser()) {
53434        openArray("endorser");
53435        for (ContactDetail e : element.getEndorser()) 
53436          composeContactDetail(null, e);
53437        closeArray();
53438      };
53439      if (element.hasRelatedArtifact()) {
53440        openArray("relatedArtifact");
53441        for (RelatedArtifact e : element.getRelatedArtifact()) 
53442          composeRelatedArtifact(null, e);
53443        closeArray();
53444      };
53445      if (element.hasSynthesisType()) {
53446        composeCodeableConcept("synthesisType", element.getSynthesisType());
53447      }
53448      if (element.hasStudyType()) {
53449        composeCodeableConcept("studyType", element.getStudyType());
53450      }
53451      if (element.hasPopulation()) {
53452        composeReference("population", element.getPopulation());
53453      }
53454      if (element.hasExposure()) {
53455        composeReference("exposure", element.getExposure());
53456      }
53457      if (element.hasOutcome()) {
53458        composeReference("outcome", element.getOutcome());
53459      }
53460      if (element.hasSampleSize()) {
53461        composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
53462      }
53463      if (element.hasRiskEstimate()) {
53464        composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent("riskEstimate", element.getRiskEstimate());
53465      }
53466      if (element.hasCertainty()) {
53467        openArray("certainty");
53468        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent e : element.getCertainty()) 
53469          composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(null, e);
53470        closeArray();
53471      };
53472  }
53473
53474  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
53475    if (element != null) {
53476      open(name);
53477      composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentInner(element);
53478      close();
53479    }
53480  }
53481
53482  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
53483      composeBackbone(element);
53484      if (element.hasDescriptionElement()) {
53485        composeStringCore("description", element.getDescriptionElement(), false);
53486        composeStringExtras("description", element.getDescriptionElement(), false);
53487      }
53488      if (element.hasNumberOfStudiesElement()) {
53489        composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
53490        composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
53491      }
53492      if (element.hasNumberOfParticipantsElement()) {
53493        composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
53494        composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
53495      }
53496  }
53497
53498  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
53499    if (element != null) {
53500      open(name);
53501      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentInner(element);
53502      close();
53503    }
53504  }
53505
53506  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
53507      composeBackbone(element);
53508      if (element.hasDescriptionElement()) {
53509        composeStringCore("description", element.getDescriptionElement(), false);
53510        composeStringExtras("description", element.getDescriptionElement(), false);
53511      }
53512      if (element.hasType()) {
53513        composeCodeableConcept("type", element.getType());
53514      }
53515      if (element.hasValueElement()) {
53516        composeDecimalCore("value", element.getValueElement(), false);
53517        composeDecimalExtras("value", element.getValueElement(), false);
53518      }
53519      if (element.hasUnitOfMeasure()) {
53520        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
53521      }
53522      if (element.hasDenominatorCountElement()) {
53523        composeIntegerCore("denominatorCount", element.getDenominatorCountElement(), false);
53524        composeIntegerExtras("denominatorCount", element.getDenominatorCountElement(), false);
53525      }
53526      if (element.hasNumeratorCountElement()) {
53527        composeIntegerCore("numeratorCount", element.getNumeratorCountElement(), false);
53528        composeIntegerExtras("numeratorCount", element.getNumeratorCountElement(), false);
53529      }
53530      if (element.hasPrecisionEstimate()) {
53531        openArray("precisionEstimate");
53532        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent e : element.getPrecisionEstimate()) 
53533          composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(null, e);
53534        closeArray();
53535      };
53536  }
53537
53538  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
53539    if (element != null) {
53540      open(name);
53541      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentInner(element);
53542      close();
53543    }
53544  }
53545
53546  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
53547      composeBackbone(element);
53548      if (element.hasType()) {
53549        composeCodeableConcept("type", element.getType());
53550      }
53551      if (element.hasLevelElement()) {
53552        composeDecimalCore("level", element.getLevelElement(), false);
53553        composeDecimalExtras("level", element.getLevelElement(), false);
53554      }
53555      if (element.hasFromElement()) {
53556        composeDecimalCore("from", element.getFromElement(), false);
53557        composeDecimalExtras("from", element.getFromElement(), false);
53558      }
53559      if (element.hasToElement()) {
53560        composeDecimalCore("to", element.getToElement(), false);
53561        composeDecimalExtras("to", element.getToElement(), false);
53562      }
53563  }
53564
53565  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
53566    if (element != null) {
53567      open(name);
53568      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentInner(element);
53569      close();
53570    }
53571  }
53572
53573  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
53574      composeBackbone(element);
53575      if (element.hasRating()) {
53576        openArray("rating");
53577        for (CodeableConcept e : element.getRating()) 
53578          composeCodeableConcept(null, e);
53579        closeArray();
53580      };
53581      if (element.hasNote()) {
53582        openArray("note");
53583        for (Annotation e : element.getNote()) 
53584          composeAnnotation(null, e);
53585        closeArray();
53586      };
53587      if (element.hasCertaintySubcomponent()) {
53588        openArray("certaintySubcomponent");
53589        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
53590          composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(null, e);
53591        closeArray();
53592      };
53593  }
53594
53595  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
53596    if (element != null) {
53597      open(name);
53598      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(element);
53599      close();
53600    }
53601  }
53602
53603  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
53604      composeBackbone(element);
53605      if (element.hasType()) {
53606        composeCodeableConcept("type", element.getType());
53607      }
53608      if (element.hasRating()) {
53609        openArray("rating");
53610        for (CodeableConcept e : element.getRating()) 
53611          composeCodeableConcept(null, e);
53612        closeArray();
53613      };
53614      if (element.hasNote()) {
53615        openArray("note");
53616        for (Annotation e : element.getNote()) 
53617          composeAnnotation(null, e);
53618        closeArray();
53619      };
53620  }
53621
53622  protected void composeSchedule(String name, Schedule element) throws IOException {
53623    if (element != null) {
53624      prop("resourceType", name);
53625      composeScheduleInner(element);
53626    }
53627  }
53628
53629  protected void composeScheduleInner(Schedule element) throws IOException {
53630      composeDomainResourceElements(element);
53631      if (element.hasIdentifier()) {
53632        openArray("identifier");
53633        for (Identifier e : element.getIdentifier()) 
53634          composeIdentifier(null, e);
53635        closeArray();
53636      };
53637      if (element.hasActiveElement()) {
53638        composeBooleanCore("active", element.getActiveElement(), false);
53639        composeBooleanExtras("active", element.getActiveElement(), false);
53640      }
53641      if (element.hasServiceCategory()) {
53642        openArray("serviceCategory");
53643        for (CodeableConcept e : element.getServiceCategory()) 
53644          composeCodeableConcept(null, e);
53645        closeArray();
53646      };
53647      if (element.hasServiceType()) {
53648        openArray("serviceType");
53649        for (CodeableConcept e : element.getServiceType()) 
53650          composeCodeableConcept(null, e);
53651        closeArray();
53652      };
53653      if (element.hasSpecialty()) {
53654        openArray("specialty");
53655        for (CodeableConcept e : element.getSpecialty()) 
53656          composeCodeableConcept(null, e);
53657        closeArray();
53658      };
53659      if (element.hasActor()) {
53660        openArray("actor");
53661        for (Reference e : element.getActor()) 
53662          composeReference(null, e);
53663        closeArray();
53664      };
53665      if (element.hasPlanningHorizon()) {
53666        composePeriod("planningHorizon", element.getPlanningHorizon());
53667      }
53668      if (element.hasCommentElement()) {
53669        composeStringCore("comment", element.getCommentElement(), false);
53670        composeStringExtras("comment", element.getCommentElement(), false);
53671      }
53672  }
53673
53674  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
53675    if (element != null) {
53676      prop("resourceType", name);
53677      composeSearchParameterInner(element);
53678    }
53679  }
53680
53681  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
53682      composeDomainResourceElements(element);
53683      if (element.hasUrlElement()) {
53684        composeUriCore("url", element.getUrlElement(), false);
53685        composeUriExtras("url", element.getUrlElement(), false);
53686      }
53687      if (element.hasVersionElement()) {
53688        composeStringCore("version", element.getVersionElement(), false);
53689        composeStringExtras("version", element.getVersionElement(), false);
53690      }
53691      if (element.hasNameElement()) {
53692        composeStringCore("name", element.getNameElement(), false);
53693        composeStringExtras("name", element.getNameElement(), false);
53694      }
53695      if (element.hasDerivedFromElement()) {
53696        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
53697        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
53698      }
53699      if (element.hasStatusElement()) {
53700        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53701        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53702      }
53703      if (element.hasExperimentalElement()) {
53704        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53705        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53706      }
53707      if (element.hasDateElement()) {
53708        composeDateTimeCore("date", element.getDateElement(), false);
53709        composeDateTimeExtras("date", element.getDateElement(), false);
53710      }
53711      if (element.hasPublisherElement()) {
53712        composeStringCore("publisher", element.getPublisherElement(), false);
53713        composeStringExtras("publisher", element.getPublisherElement(), false);
53714      }
53715      if (element.hasContact()) {
53716        openArray("contact");
53717        for (ContactDetail e : element.getContact()) 
53718          composeContactDetail(null, e);
53719        closeArray();
53720      };
53721      if (element.hasDescriptionElement()) {
53722        composeMarkdownCore("description", element.getDescriptionElement(), false);
53723        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53724      }
53725      if (element.hasUseContext()) {
53726        openArray("useContext");
53727        for (UsageContext e : element.getUseContext()) 
53728          composeUsageContext(null, e);
53729        closeArray();
53730      };
53731      if (element.hasJurisdiction()) {
53732        openArray("jurisdiction");
53733        for (CodeableConcept e : element.getJurisdiction()) 
53734          composeCodeableConcept(null, e);
53735        closeArray();
53736      };
53737      if (element.hasPurposeElement()) {
53738        composeMarkdownCore("purpose", element.getPurposeElement(), false);
53739        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
53740      }
53741      if (element.hasCodeElement()) {
53742        composeCodeCore("code", element.getCodeElement(), false);
53743        composeCodeExtras("code", element.getCodeElement(), false);
53744      }
53745      if (element.hasBase()) {
53746        openArray("base");
53747        for (CodeType e : element.getBase()) 
53748          composeCodeCore(null, e, true);
53749        closeArray();
53750        if (anyHasExtras(element.getBase())) {
53751          openArray("_base");
53752          for (CodeType e : element.getBase()) 
53753            composeCodeExtras(null, e, true);
53754          closeArray();
53755        }
53756      };
53757      if (element.hasTypeElement()) {
53758        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
53759        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
53760      }
53761      if (element.hasExpressionElement()) {
53762        composeStringCore("expression", element.getExpressionElement(), false);
53763        composeStringExtras("expression", element.getExpressionElement(), false);
53764      }
53765      if (element.hasXpathElement()) {
53766        composeStringCore("xpath", element.getXpathElement(), false);
53767        composeStringExtras("xpath", element.getXpathElement(), false);
53768      }
53769      if (element.hasXpathUsageElement()) {
53770        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
53771        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
53772      }
53773      if (element.hasTarget()) {
53774        openArray("target");
53775        for (CodeType e : element.getTarget()) 
53776          composeCodeCore(null, e, true);
53777        closeArray();
53778        if (anyHasExtras(element.getTarget())) {
53779          openArray("_target");
53780          for (CodeType e : element.getTarget()) 
53781            composeCodeExtras(null, e, true);
53782          closeArray();
53783        }
53784      };
53785      if (element.hasMultipleOrElement()) {
53786        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
53787        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
53788      }
53789      if (element.hasMultipleAndElement()) {
53790        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
53791        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
53792      }
53793      if (element.hasComparator()) {
53794        openArray("comparator");
53795        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
53796          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
53797        closeArray();
53798        if (anyHasExtras(element.getComparator())) {
53799          openArray("_comparator");
53800          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
53801            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
53802          closeArray();
53803        }
53804      };
53805      if (element.hasModifier()) {
53806        openArray("modifier");
53807        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
53808          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
53809        closeArray();
53810        if (anyHasExtras(element.getModifier())) {
53811          openArray("_modifier");
53812          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
53813            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
53814          closeArray();
53815        }
53816      };
53817      if (element.hasChain()) {
53818        openArray("chain");
53819        for (StringType e : element.getChain()) 
53820          composeStringCore(null, e, true);
53821        closeArray();
53822        if (anyHasExtras(element.getChain())) {
53823          openArray("_chain");
53824          for (StringType e : element.getChain()) 
53825            composeStringExtras(null, e, true);
53826          closeArray();
53827        }
53828      };
53829      if (element.hasComponent()) {
53830        openArray("component");
53831        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
53832          composeSearchParameterSearchParameterComponentComponent(null, e);
53833        closeArray();
53834      };
53835  }
53836
53837  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
53838    if (element != null) {
53839      open(name);
53840      composeSearchParameterSearchParameterComponentComponentInner(element);
53841      close();
53842    }
53843  }
53844
53845  protected void composeSearchParameterSearchParameterComponentComponentInner(SearchParameter.SearchParameterComponentComponent element) throws IOException {
53846      composeBackbone(element);
53847      if (element.hasDefinitionElement()) {
53848        composeCanonicalCore("definition", element.getDefinitionElement(), false);
53849        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
53850      }
53851      if (element.hasExpressionElement()) {
53852        composeStringCore("expression", element.getExpressionElement(), false);
53853        composeStringExtras("expression", element.getExpressionElement(), false);
53854      }
53855  }
53856
53857  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
53858    if (element != null) {
53859      prop("resourceType", name);
53860      composeServiceRequestInner(element);
53861    }
53862  }
53863
53864  protected void composeServiceRequestInner(ServiceRequest element) throws IOException {
53865      composeDomainResourceElements(element);
53866      if (element.hasIdentifier()) {
53867        openArray("identifier");
53868        for (Identifier e : element.getIdentifier()) 
53869          composeIdentifier(null, e);
53870        closeArray();
53871      };
53872      if (element.hasInstantiatesCanonical()) {
53873        openArray("instantiatesCanonical");
53874        for (CanonicalType e : element.getInstantiatesCanonical()) 
53875          composeCanonicalCore(null, e, true);
53876        closeArray();
53877        if (anyHasExtras(element.getInstantiatesCanonical())) {
53878          openArray("_instantiatesCanonical");
53879          for (CanonicalType e : element.getInstantiatesCanonical()) 
53880            composeCanonicalExtras(null, e, true);
53881          closeArray();
53882        }
53883      };
53884      if (element.hasInstantiatesUri()) {
53885        openArray("instantiatesUri");
53886        for (UriType e : element.getInstantiatesUri()) 
53887          composeUriCore(null, e, true);
53888        closeArray();
53889        if (anyHasExtras(element.getInstantiatesUri())) {
53890          openArray("_instantiatesUri");
53891          for (UriType e : element.getInstantiatesUri()) 
53892            composeUriExtras(null, e, true);
53893          closeArray();
53894        }
53895      };
53896      if (element.hasBasedOn()) {
53897        openArray("basedOn");
53898        for (Reference e : element.getBasedOn()) 
53899          composeReference(null, e);
53900        closeArray();
53901      };
53902      if (element.hasReplaces()) {
53903        openArray("replaces");
53904        for (Reference e : element.getReplaces()) 
53905          composeReference(null, e);
53906        closeArray();
53907      };
53908      if (element.hasRequisition()) {
53909        composeIdentifier("requisition", element.getRequisition());
53910      }
53911      if (element.hasStatusElement()) {
53912        composeEnumerationCore("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
53913        composeEnumerationExtras("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
53914      }
53915      if (element.hasIntentElement()) {
53916        composeEnumerationCore("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
53917        composeEnumerationExtras("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
53918      }
53919      if (element.hasCategory()) {
53920        openArray("category");
53921        for (CodeableConcept e : element.getCategory()) 
53922          composeCodeableConcept(null, e);
53923        closeArray();
53924      };
53925      if (element.hasPriorityElement()) {
53926        composeEnumerationCore("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
53927        composeEnumerationExtras("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
53928      }
53929      if (element.hasDoNotPerformElement()) {
53930        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
53931        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
53932      }
53933      if (element.hasCode()) {
53934        composeCodeableConcept("code", element.getCode());
53935      }
53936      if (element.hasOrderDetail()) {
53937        openArray("orderDetail");
53938        for (CodeableConcept e : element.getOrderDetail()) 
53939          composeCodeableConcept(null, e);
53940        closeArray();
53941      };
53942      if (element.hasQuantity()) {
53943        composeType("quantity", element.getQuantity());
53944      }
53945      if (element.hasSubject()) {
53946        composeReference("subject", element.getSubject());
53947      }
53948      if (element.hasEncounter()) {
53949        composeReference("encounter", element.getEncounter());
53950      }
53951      if (element.hasOccurrence()) {
53952        composeType("occurrence", element.getOccurrence());
53953      }
53954      if (element.hasAsNeeded()) {
53955        composeType("asNeeded", element.getAsNeeded());
53956      }
53957      if (element.hasAuthoredOnElement()) {
53958        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
53959        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
53960      }
53961      if (element.hasRequester()) {
53962        composeReference("requester", element.getRequester());
53963      }
53964      if (element.hasPerformerType()) {
53965        composeCodeableConcept("performerType", element.getPerformerType());
53966      }
53967      if (element.hasPerformer()) {
53968        openArray("performer");
53969        for (Reference e : element.getPerformer()) 
53970          composeReference(null, e);
53971        closeArray();
53972      };
53973      if (element.hasLocationCode()) {
53974        openArray("locationCode");
53975        for (CodeableConcept e : element.getLocationCode()) 
53976          composeCodeableConcept(null, e);
53977        closeArray();
53978      };
53979      if (element.hasLocationReference()) {
53980        openArray("locationReference");
53981        for (Reference e : element.getLocationReference()) 
53982          composeReference(null, e);
53983        closeArray();
53984      };
53985      if (element.hasReasonCode()) {
53986        openArray("reasonCode");
53987        for (CodeableConcept e : element.getReasonCode()) 
53988          composeCodeableConcept(null, e);
53989        closeArray();
53990      };
53991      if (element.hasReasonReference()) {
53992        openArray("reasonReference");
53993        for (Reference e : element.getReasonReference()) 
53994          composeReference(null, e);
53995        closeArray();
53996      };
53997      if (element.hasInsurance()) {
53998        openArray("insurance");
53999        for (Reference e : element.getInsurance()) 
54000          composeReference(null, e);
54001        closeArray();
54002      };
54003      if (element.hasSupportingInfo()) {
54004        openArray("supportingInfo");
54005        for (Reference e : element.getSupportingInfo()) 
54006          composeReference(null, e);
54007        closeArray();
54008      };
54009      if (element.hasSpecimen()) {
54010        openArray("specimen");
54011        for (Reference e : element.getSpecimen()) 
54012          composeReference(null, e);
54013        closeArray();
54014      };
54015      if (element.hasBodySite()) {
54016        openArray("bodySite");
54017        for (CodeableConcept e : element.getBodySite()) 
54018          composeCodeableConcept(null, e);
54019        closeArray();
54020      };
54021      if (element.hasNote()) {
54022        openArray("note");
54023        for (Annotation e : element.getNote()) 
54024          composeAnnotation(null, e);
54025        closeArray();
54026      };
54027      if (element.hasPatientInstructionElement()) {
54028        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
54029        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
54030      }
54031      if (element.hasRelevantHistory()) {
54032        openArray("relevantHistory");
54033        for (Reference e : element.getRelevantHistory()) 
54034          composeReference(null, e);
54035        closeArray();
54036      };
54037  }
54038
54039  protected void composeSlot(String name, Slot element) throws IOException {
54040    if (element != null) {
54041      prop("resourceType", name);
54042      composeSlotInner(element);
54043    }
54044  }
54045
54046  protected void composeSlotInner(Slot element) throws IOException {
54047      composeDomainResourceElements(element);
54048      if (element.hasIdentifier()) {
54049        openArray("identifier");
54050        for (Identifier e : element.getIdentifier()) 
54051          composeIdentifier(null, e);
54052        closeArray();
54053      };
54054      if (element.hasServiceCategory()) {
54055        openArray("serviceCategory");
54056        for (CodeableConcept e : element.getServiceCategory()) 
54057          composeCodeableConcept(null, e);
54058        closeArray();
54059      };
54060      if (element.hasServiceType()) {
54061        openArray("serviceType");
54062        for (CodeableConcept e : element.getServiceType()) 
54063          composeCodeableConcept(null, e);
54064        closeArray();
54065      };
54066      if (element.hasSpecialty()) {
54067        openArray("specialty");
54068        for (CodeableConcept e : element.getSpecialty()) 
54069          composeCodeableConcept(null, e);
54070        closeArray();
54071      };
54072      if (element.hasAppointmentType()) {
54073        composeCodeableConcept("appointmentType", element.getAppointmentType());
54074      }
54075      if (element.hasSchedule()) {
54076        composeReference("schedule", element.getSchedule());
54077      }
54078      if (element.hasStatusElement()) {
54079        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
54080        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
54081      }
54082      if (element.hasStartElement()) {
54083        composeInstantCore("start", element.getStartElement(), false);
54084        composeInstantExtras("start", element.getStartElement(), false);
54085      }
54086      if (element.hasEndElement()) {
54087        composeInstantCore("end", element.getEndElement(), false);
54088        composeInstantExtras("end", element.getEndElement(), false);
54089      }
54090      if (element.hasOverbookedElement()) {
54091        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
54092        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
54093      }
54094      if (element.hasCommentElement()) {
54095        composeStringCore("comment", element.getCommentElement(), false);
54096        composeStringExtras("comment", element.getCommentElement(), false);
54097      }
54098  }
54099
54100  protected void composeSpecimen(String name, Specimen element) throws IOException {
54101    if (element != null) {
54102      prop("resourceType", name);
54103      composeSpecimenInner(element);
54104    }
54105  }
54106
54107  protected void composeSpecimenInner(Specimen element) throws IOException {
54108      composeDomainResourceElements(element);
54109      if (element.hasIdentifier()) {
54110        openArray("identifier");
54111        for (Identifier e : element.getIdentifier()) 
54112          composeIdentifier(null, e);
54113        closeArray();
54114      };
54115      if (element.hasAccessionIdentifier()) {
54116        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
54117      }
54118      if (element.hasStatusElement()) {
54119        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
54120        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
54121      }
54122      if (element.hasType()) {
54123        composeCodeableConcept("type", element.getType());
54124      }
54125      if (element.hasSubject()) {
54126        composeReference("subject", element.getSubject());
54127      }
54128      if (element.hasReceivedTimeElement()) {
54129        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
54130        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
54131      }
54132      if (element.hasParent()) {
54133        openArray("parent");
54134        for (Reference e : element.getParent()) 
54135          composeReference(null, e);
54136        closeArray();
54137      };
54138      if (element.hasRequest()) {
54139        openArray("request");
54140        for (Reference e : element.getRequest()) 
54141          composeReference(null, e);
54142        closeArray();
54143      };
54144      if (element.hasCollection()) {
54145        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
54146      }
54147      if (element.hasProcessing()) {
54148        openArray("processing");
54149        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
54150          composeSpecimenSpecimenProcessingComponent(null, e);
54151        closeArray();
54152      };
54153      if (element.hasContainer()) {
54154        openArray("container");
54155        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
54156          composeSpecimenSpecimenContainerComponent(null, e);
54157        closeArray();
54158      };
54159      if (element.hasCondition()) {
54160        openArray("condition");
54161        for (CodeableConcept e : element.getCondition()) 
54162          composeCodeableConcept(null, e);
54163        closeArray();
54164      };
54165      if (element.hasNote()) {
54166        openArray("note");
54167        for (Annotation e : element.getNote()) 
54168          composeAnnotation(null, e);
54169        closeArray();
54170      };
54171  }
54172
54173  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
54174    if (element != null) {
54175      open(name);
54176      composeSpecimenSpecimenCollectionComponentInner(element);
54177      close();
54178    }
54179  }
54180
54181  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
54182      composeBackbone(element);
54183      if (element.hasCollector()) {
54184        composeReference("collector", element.getCollector());
54185      }
54186      if (element.hasCollected()) {
54187        composeType("collected", element.getCollected());
54188      }
54189      if (element.hasDuration()) {
54190        composeDuration("duration", element.getDuration());
54191      }
54192      if (element.hasQuantity()) {
54193        composeQuantity("quantity", element.getQuantity());
54194      }
54195      if (element.hasMethod()) {
54196        composeCodeableConcept("method", element.getMethod());
54197      }
54198      if (element.hasBodySite()) {
54199        composeCodeableConcept("bodySite", element.getBodySite());
54200      }
54201      if (element.hasFastingStatus()) {
54202        composeType("fastingStatus", element.getFastingStatus());
54203      }
54204  }
54205
54206  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
54207    if (element != null) {
54208      open(name);
54209      composeSpecimenSpecimenProcessingComponentInner(element);
54210      close();
54211    }
54212  }
54213
54214  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element) throws IOException {
54215      composeBackbone(element);
54216      if (element.hasDescriptionElement()) {
54217        composeStringCore("description", element.getDescriptionElement(), false);
54218        composeStringExtras("description", element.getDescriptionElement(), false);
54219      }
54220      if (element.hasProcedure()) {
54221        composeCodeableConcept("procedure", element.getProcedure());
54222      }
54223      if (element.hasAdditive()) {
54224        openArray("additive");
54225        for (Reference e : element.getAdditive()) 
54226          composeReference(null, e);
54227        closeArray();
54228      };
54229      if (element.hasTime()) {
54230        composeType("time", element.getTime());
54231      }
54232  }
54233
54234  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
54235    if (element != null) {
54236      open(name);
54237      composeSpecimenSpecimenContainerComponentInner(element);
54238      close();
54239    }
54240  }
54241
54242  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
54243      composeBackbone(element);
54244      if (element.hasIdentifier()) {
54245        openArray("identifier");
54246        for (Identifier e : element.getIdentifier()) 
54247          composeIdentifier(null, e);
54248        closeArray();
54249      };
54250      if (element.hasDescriptionElement()) {
54251        composeStringCore("description", element.getDescriptionElement(), false);
54252        composeStringExtras("description", element.getDescriptionElement(), false);
54253      }
54254      if (element.hasType()) {
54255        composeCodeableConcept("type", element.getType());
54256      }
54257      if (element.hasCapacity()) {
54258        composeQuantity("capacity", element.getCapacity());
54259      }
54260      if (element.hasSpecimenQuantity()) {
54261        composeQuantity("specimenQuantity", element.getSpecimenQuantity());
54262      }
54263      if (element.hasAdditive()) {
54264        composeType("additive", element.getAdditive());
54265      }
54266  }
54267
54268  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
54269    if (element != null) {
54270      prop("resourceType", name);
54271      composeSpecimenDefinitionInner(element);
54272    }
54273  }
54274
54275  protected void composeSpecimenDefinitionInner(SpecimenDefinition element) throws IOException {
54276      composeDomainResourceElements(element);
54277      if (element.hasIdentifier()) {
54278        composeIdentifier("identifier", element.getIdentifier());
54279      }
54280      if (element.hasTypeCollected()) {
54281        composeCodeableConcept("typeCollected", element.getTypeCollected());
54282      }
54283      if (element.hasPatientPreparation()) {
54284        openArray("patientPreparation");
54285        for (CodeableConcept e : element.getPatientPreparation()) 
54286          composeCodeableConcept(null, e);
54287        closeArray();
54288      };
54289      if (element.hasTimeAspectElement()) {
54290        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
54291        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
54292      }
54293      if (element.hasCollection()) {
54294        openArray("collection");
54295        for (CodeableConcept e : element.getCollection()) 
54296          composeCodeableConcept(null, e);
54297        closeArray();
54298      };
54299      if (element.hasTypeTested()) {
54300        openArray("typeTested");
54301        for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested()) 
54302          composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(null, e);
54303        closeArray();
54304      };
54305  }
54306
54307  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
54308    if (element != null) {
54309      open(name);
54310      composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(element);
54311      close();
54312    }
54313  }
54314
54315  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
54316      composeBackbone(element);
54317      if (element.hasIsDerivedElement()) {
54318        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
54319        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
54320      }
54321      if (element.hasType()) {
54322        composeCodeableConcept("type", element.getType());
54323      }
54324      if (element.hasPreferenceElement()) {
54325        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
54326        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
54327      }
54328      if (element.hasContainer()) {
54329        composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
54330      }
54331      if (element.hasRequirementElement()) {
54332        composeStringCore("requirement", element.getRequirementElement(), false);
54333        composeStringExtras("requirement", element.getRequirementElement(), false);
54334      }
54335      if (element.hasRetentionTime()) {
54336        composeDuration("retentionTime", element.getRetentionTime());
54337      }
54338      if (element.hasRejectionCriterion()) {
54339        openArray("rejectionCriterion");
54340        for (CodeableConcept e : element.getRejectionCriterion()) 
54341          composeCodeableConcept(null, e);
54342        closeArray();
54343      };
54344      if (element.hasHandling()) {
54345        openArray("handling");
54346        for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
54347          composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(null, e);
54348        closeArray();
54349      };
54350  }
54351
54352  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
54353    if (element != null) {
54354      open(name);
54355      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(element);
54356      close();
54357    }
54358  }
54359
54360  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
54361      composeBackbone(element);
54362      if (element.hasMaterial()) {
54363        composeCodeableConcept("material", element.getMaterial());
54364      }
54365      if (element.hasType()) {
54366        composeCodeableConcept("type", element.getType());
54367      }
54368      if (element.hasCap()) {
54369        composeCodeableConcept("cap", element.getCap());
54370      }
54371      if (element.hasDescriptionElement()) {
54372        composeStringCore("description", element.getDescriptionElement(), false);
54373        composeStringExtras("description", element.getDescriptionElement(), false);
54374      }
54375      if (element.hasCapacity()) {
54376        composeQuantity("capacity", element.getCapacity());
54377      }
54378      if (element.hasMinimumVolume()) {
54379        composeType("minimumVolume", element.getMinimumVolume());
54380      }
54381      if (element.hasAdditive()) {
54382        openArray("additive");
54383        for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive()) 
54384          composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
54385        closeArray();
54386      };
54387      if (element.hasPreparationElement()) {
54388        composeStringCore("preparation", element.getPreparationElement(), false);
54389        composeStringExtras("preparation", element.getPreparationElement(), false);
54390      }
54391  }
54392
54393  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
54394    if (element != null) {
54395      open(name);
54396      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(element);
54397      close();
54398    }
54399  }
54400
54401  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
54402      composeBackbone(element);
54403      if (element.hasAdditive()) {
54404        composeType("additive", element.getAdditive());
54405      }
54406  }
54407
54408  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
54409    if (element != null) {
54410      open(name);
54411      composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(element);
54412      close();
54413    }
54414  }
54415
54416  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
54417      composeBackbone(element);
54418      if (element.hasTemperatureQualifier()) {
54419        composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
54420      }
54421      if (element.hasTemperatureRange()) {
54422        composeRange("temperatureRange", element.getTemperatureRange());
54423      }
54424      if (element.hasMaxDuration()) {
54425        composeDuration("maxDuration", element.getMaxDuration());
54426      }
54427      if (element.hasInstructionElement()) {
54428        composeStringCore("instruction", element.getInstructionElement(), false);
54429        composeStringExtras("instruction", element.getInstructionElement(), false);
54430      }
54431  }
54432
54433  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
54434    if (element != null) {
54435      prop("resourceType", name);
54436      composeStructureDefinitionInner(element);
54437    }
54438  }
54439
54440  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
54441      composeDomainResourceElements(element);
54442      if (element.hasUrlElement()) {
54443        composeUriCore("url", element.getUrlElement(), false);
54444        composeUriExtras("url", element.getUrlElement(), false);
54445      }
54446      if (element.hasIdentifier()) {
54447        openArray("identifier");
54448        for (Identifier e : element.getIdentifier()) 
54449          composeIdentifier(null, e);
54450        closeArray();
54451      };
54452      if (element.hasVersionElement()) {
54453        composeStringCore("version", element.getVersionElement(), false);
54454        composeStringExtras("version", element.getVersionElement(), false);
54455      }
54456      if (element.hasNameElement()) {
54457        composeStringCore("name", element.getNameElement(), false);
54458        composeStringExtras("name", element.getNameElement(), false);
54459      }
54460      if (element.hasTitleElement()) {
54461        composeStringCore("title", element.getTitleElement(), false);
54462        composeStringExtras("title", element.getTitleElement(), false);
54463      }
54464      if (element.hasStatusElement()) {
54465        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54466        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54467      }
54468      if (element.hasExperimentalElement()) {
54469        composeBooleanCore("experimental", element.getExperimentalElement(), false);
54470        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54471      }
54472      if (element.hasDateElement()) {
54473        composeDateTimeCore("date", element.getDateElement(), false);
54474        composeDateTimeExtras("date", element.getDateElement(), false);
54475      }
54476      if (element.hasPublisherElement()) {
54477        composeStringCore("publisher", element.getPublisherElement(), false);
54478        composeStringExtras("publisher", element.getPublisherElement(), false);
54479      }
54480      if (element.hasContact()) {
54481        openArray("contact");
54482        for (ContactDetail e : element.getContact()) 
54483          composeContactDetail(null, e);
54484        closeArray();
54485      };
54486      if (element.hasDescriptionElement()) {
54487        composeMarkdownCore("description", element.getDescriptionElement(), false);
54488        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54489      }
54490      if (element.hasUseContext()) {
54491        openArray("useContext");
54492        for (UsageContext e : element.getUseContext()) 
54493          composeUsageContext(null, e);
54494        closeArray();
54495      };
54496      if (element.hasJurisdiction()) {
54497        openArray("jurisdiction");
54498        for (CodeableConcept e : element.getJurisdiction()) 
54499          composeCodeableConcept(null, e);
54500        closeArray();
54501      };
54502      if (element.hasPurposeElement()) {
54503        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54504        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54505      }
54506      if (element.hasCopyrightElement()) {
54507        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
54508        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
54509      }
54510      if (element.hasKeyword()) {
54511        openArray("keyword");
54512        for (Coding e : element.getKeyword()) 
54513          composeCoding(null, e);
54514        closeArray();
54515      };
54516      if (element.hasFhirVersionElement()) {
54517        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
54518        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
54519      }
54520      if (element.hasMapping()) {
54521        openArray("mapping");
54522        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
54523          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
54524        closeArray();
54525      };
54526      if (element.hasKindElement()) {
54527        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
54528        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
54529      }
54530      if (element.hasAbstractElement()) {
54531        composeBooleanCore("abstract", element.getAbstractElement(), false);
54532        composeBooleanExtras("abstract", element.getAbstractElement(), false);
54533      }
54534      if (element.hasContext()) {
54535        openArray("context");
54536        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
54537          composeStructureDefinitionStructureDefinitionContextComponent(null, e);
54538        closeArray();
54539      };
54540      if (element.hasContextInvariant()) {
54541        openArray("contextInvariant");
54542        for (StringType e : element.getContextInvariant()) 
54543          composeStringCore(null, e, true);
54544        closeArray();
54545        if (anyHasExtras(element.getContextInvariant())) {
54546          openArray("_contextInvariant");
54547          for (StringType e : element.getContextInvariant()) 
54548            composeStringExtras(null, e, true);
54549          closeArray();
54550        }
54551      };
54552      if (element.hasTypeElement()) {
54553        composeUriCore("type", element.getTypeElement(), false);
54554        composeUriExtras("type", element.getTypeElement(), false);
54555      }
54556      if (element.hasBaseDefinitionElement()) {
54557        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
54558        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
54559      }
54560      if (element.hasDerivationElement()) {
54561        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
54562        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
54563      }
54564      if (element.hasSnapshot()) {
54565        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
54566      }
54567      if (element.hasDifferential()) {
54568        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
54569      }
54570  }
54571
54572  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
54573    if (element != null) {
54574      open(name);
54575      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
54576      close();
54577    }
54578  }
54579
54580  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
54581      composeBackbone(element);
54582      if (element.hasIdentityElement()) {
54583        composeIdCore("identity", element.getIdentityElement(), false);
54584        composeIdExtras("identity", element.getIdentityElement(), false);
54585      }
54586      if (element.hasUriElement()) {
54587        composeUriCore("uri", element.getUriElement(), false);
54588        composeUriExtras("uri", element.getUriElement(), false);
54589      }
54590      if (element.hasNameElement()) {
54591        composeStringCore("name", element.getNameElement(), false);
54592        composeStringExtras("name", element.getNameElement(), false);
54593      }
54594      if (element.hasCommentElement()) {
54595        composeStringCore("comment", element.getCommentElement(), false);
54596        composeStringExtras("comment", element.getCommentElement(), false);
54597      }
54598  }
54599
54600  protected void composeStructureDefinitionStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
54601    if (element != null) {
54602      open(name);
54603      composeStructureDefinitionStructureDefinitionContextComponentInner(element);
54604      close();
54605    }
54606  }
54607
54608  protected void composeStructureDefinitionStructureDefinitionContextComponentInner(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
54609      composeBackbone(element);
54610      if (element.hasTypeElement()) {
54611        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
54612        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
54613      }
54614      if (element.hasExpressionElement()) {
54615        composeStringCore("expression", element.getExpressionElement(), false);
54616        composeStringExtras("expression", element.getExpressionElement(), false);
54617      }
54618  }
54619
54620  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
54621    if (element != null) {
54622      open(name);
54623      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
54624      close();
54625    }
54626  }
54627
54628  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
54629      composeBackbone(element);
54630      if (element.hasElement()) {
54631        openArray("element");
54632        for (ElementDefinition e : element.getElement()) 
54633          composeElementDefinition(null, e);
54634        closeArray();
54635      };
54636  }
54637
54638  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
54639    if (element != null) {
54640      open(name);
54641      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
54642      close();
54643    }
54644  }
54645
54646  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
54647      composeBackbone(element);
54648      if (element.hasElement()) {
54649        openArray("element");
54650        for (ElementDefinition e : element.getElement()) 
54651          composeElementDefinition(null, e);
54652        closeArray();
54653      };
54654  }
54655
54656  protected void composeStructureMap(String name, StructureMap element) throws IOException {
54657    if (element != null) {
54658      prop("resourceType", name);
54659      composeStructureMapInner(element);
54660    }
54661  }
54662
54663  protected void composeStructureMapInner(StructureMap element) throws IOException {
54664      composeDomainResourceElements(element);
54665      if (element.hasUrlElement()) {
54666        composeUriCore("url", element.getUrlElement(), false);
54667        composeUriExtras("url", element.getUrlElement(), false);
54668      }
54669      if (element.hasIdentifier()) {
54670        openArray("identifier");
54671        for (Identifier e : element.getIdentifier()) 
54672          composeIdentifier(null, e);
54673        closeArray();
54674      };
54675      if (element.hasVersionElement()) {
54676        composeStringCore("version", element.getVersionElement(), false);
54677        composeStringExtras("version", element.getVersionElement(), false);
54678      }
54679      if (element.hasNameElement()) {
54680        composeStringCore("name", element.getNameElement(), false);
54681        composeStringExtras("name", element.getNameElement(), false);
54682      }
54683      if (element.hasTitleElement()) {
54684        composeStringCore("title", element.getTitleElement(), false);
54685        composeStringExtras("title", element.getTitleElement(), false);
54686      }
54687      if (element.hasStatusElement()) {
54688        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54689        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54690      }
54691      if (element.hasExperimentalElement()) {
54692        composeBooleanCore("experimental", element.getExperimentalElement(), false);
54693        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54694      }
54695      if (element.hasDateElement()) {
54696        composeDateTimeCore("date", element.getDateElement(), false);
54697        composeDateTimeExtras("date", element.getDateElement(), false);
54698      }
54699      if (element.hasPublisherElement()) {
54700        composeStringCore("publisher", element.getPublisherElement(), false);
54701        composeStringExtras("publisher", element.getPublisherElement(), false);
54702      }
54703      if (element.hasContact()) {
54704        openArray("contact");
54705        for (ContactDetail e : element.getContact()) 
54706          composeContactDetail(null, e);
54707        closeArray();
54708      };
54709      if (element.hasDescriptionElement()) {
54710        composeMarkdownCore("description", element.getDescriptionElement(), false);
54711        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54712      }
54713      if (element.hasUseContext()) {
54714        openArray("useContext");
54715        for (UsageContext e : element.getUseContext()) 
54716          composeUsageContext(null, e);
54717        closeArray();
54718      };
54719      if (element.hasJurisdiction()) {
54720        openArray("jurisdiction");
54721        for (CodeableConcept e : element.getJurisdiction()) 
54722          composeCodeableConcept(null, e);
54723        closeArray();
54724      };
54725      if (element.hasPurposeElement()) {
54726        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54727        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54728      }
54729      if (element.hasCopyrightElement()) {
54730        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
54731        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
54732      }
54733      if (element.hasStructure()) {
54734        openArray("structure");
54735        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
54736          composeStructureMapStructureMapStructureComponent(null, e);
54737        closeArray();
54738      };
54739      if (element.hasImport()) {
54740        openArray("import");
54741        for (CanonicalType e : element.getImport()) 
54742          composeCanonicalCore(null, e, true);
54743        closeArray();
54744        if (anyHasExtras(element.getImport())) {
54745          openArray("_import");
54746          for (CanonicalType e : element.getImport()) 
54747            composeCanonicalExtras(null, e, true);
54748          closeArray();
54749        }
54750      };
54751      if (element.hasGroup()) {
54752        openArray("group");
54753        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
54754          composeStructureMapStructureMapGroupComponent(null, e);
54755        closeArray();
54756      };
54757  }
54758
54759  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
54760    if (element != null) {
54761      open(name);
54762      composeStructureMapStructureMapStructureComponentInner(element);
54763      close();
54764    }
54765  }
54766
54767  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
54768      composeBackbone(element);
54769      if (element.hasUrlElement()) {
54770        composeCanonicalCore("url", element.getUrlElement(), false);
54771        composeCanonicalExtras("url", element.getUrlElement(), false);
54772      }
54773      if (element.hasModeElement()) {
54774        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
54775        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
54776      }
54777      if (element.hasAliasElement()) {
54778        composeStringCore("alias", element.getAliasElement(), false);
54779        composeStringExtras("alias", element.getAliasElement(), false);
54780      }
54781      if (element.hasDocumentationElement()) {
54782        composeStringCore("documentation", element.getDocumentationElement(), false);
54783        composeStringExtras("documentation", element.getDocumentationElement(), false);
54784      }
54785  }
54786
54787  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
54788    if (element != null) {
54789      open(name);
54790      composeStructureMapStructureMapGroupComponentInner(element);
54791      close();
54792    }
54793  }
54794
54795  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
54796      composeBackbone(element);
54797      if (element.hasNameElement()) {
54798        composeIdCore("name", element.getNameElement(), false);
54799        composeIdExtras("name", element.getNameElement(), false);
54800      }
54801      if (element.hasExtendsElement()) {
54802        composeIdCore("extends", element.getExtendsElement(), false);
54803        composeIdExtras("extends", element.getExtendsElement(), false);
54804      }
54805      if (element.hasTypeModeElement()) {
54806        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
54807        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
54808      }
54809      if (element.hasDocumentationElement()) {
54810        composeStringCore("documentation", element.getDocumentationElement(), false);
54811        composeStringExtras("documentation", element.getDocumentationElement(), false);
54812      }
54813      if (element.hasInput()) {
54814        openArray("input");
54815        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
54816          composeStructureMapStructureMapGroupInputComponent(null, e);
54817        closeArray();
54818      };
54819      if (element.hasRule()) {
54820        openArray("rule");
54821        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
54822          composeStructureMapStructureMapGroupRuleComponent(null, e);
54823        closeArray();
54824      };
54825  }
54826
54827  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
54828    if (element != null) {
54829      open(name);
54830      composeStructureMapStructureMapGroupInputComponentInner(element);
54831      close();
54832    }
54833  }
54834
54835  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
54836      composeBackbone(element);
54837      if (element.hasNameElement()) {
54838        composeIdCore("name", element.getNameElement(), false);
54839        composeIdExtras("name", element.getNameElement(), false);
54840      }
54841      if (element.hasTypeElement()) {
54842        composeStringCore("type", element.getTypeElement(), false);
54843        composeStringExtras("type", element.getTypeElement(), false);
54844      }
54845      if (element.hasModeElement()) {
54846        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
54847        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
54848      }
54849      if (element.hasDocumentationElement()) {
54850        composeStringCore("documentation", element.getDocumentationElement(), false);
54851        composeStringExtras("documentation", element.getDocumentationElement(), false);
54852      }
54853  }
54854
54855  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
54856    if (element != null) {
54857      open(name);
54858      composeStructureMapStructureMapGroupRuleComponentInner(element);
54859      close();
54860    }
54861  }
54862
54863  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
54864      composeBackbone(element);
54865      if (element.hasNameElement()) {
54866        composeIdCore("name", element.getNameElement(), false);
54867        composeIdExtras("name", element.getNameElement(), false);
54868      }
54869      if (element.hasSource()) {
54870        openArray("source");
54871        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
54872          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
54873        closeArray();
54874      };
54875      if (element.hasTarget()) {
54876        openArray("target");
54877        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
54878          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
54879        closeArray();
54880      };
54881      if (element.hasRule()) {
54882        openArray("rule");
54883        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
54884          composeStructureMapStructureMapGroupRuleComponent(null, e);
54885        closeArray();
54886      };
54887      if (element.hasDependent()) {
54888        openArray("dependent");
54889        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
54890          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
54891        closeArray();
54892      };
54893      if (element.hasDocumentationElement()) {
54894        composeStringCore("documentation", element.getDocumentationElement(), false);
54895        composeStringExtras("documentation", element.getDocumentationElement(), false);
54896      }
54897  }
54898
54899  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
54900    if (element != null) {
54901      open(name);
54902      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
54903      close();
54904    }
54905  }
54906
54907  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
54908      composeBackbone(element);
54909      if (element.hasContextElement()) {
54910        composeIdCore("context", element.getContextElement(), false);
54911        composeIdExtras("context", element.getContextElement(), false);
54912      }
54913      if (element.hasMinElement()) {
54914        composeIntegerCore("min", element.getMinElement(), false);
54915        composeIntegerExtras("min", element.getMinElement(), false);
54916      }
54917      if (element.hasMaxElement()) {
54918        composeStringCore("max", element.getMaxElement(), false);
54919        composeStringExtras("max", element.getMaxElement(), false);
54920      }
54921      if (element.hasTypeElement()) {
54922        composeStringCore("type", element.getTypeElement(), false);
54923        composeStringExtras("type", element.getTypeElement(), false);
54924      }
54925      if (element.hasDefaultValue()) {
54926        composeType("defaultValue", element.getDefaultValue());
54927      }
54928      if (element.hasElementElement()) {
54929        composeStringCore("element", element.getElementElement(), false);
54930        composeStringExtras("element", element.getElementElement(), false);
54931      }
54932      if (element.hasListModeElement()) {
54933        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
54934        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
54935      }
54936      if (element.hasVariableElement()) {
54937        composeIdCore("variable", element.getVariableElement(), false);
54938        composeIdExtras("variable", element.getVariableElement(), false);
54939      }
54940      if (element.hasConditionElement()) {
54941        composeStringCore("condition", element.getConditionElement(), false);
54942        composeStringExtras("condition", element.getConditionElement(), false);
54943      }
54944      if (element.hasCheckElement()) {
54945        composeStringCore("check", element.getCheckElement(), false);
54946        composeStringExtras("check", element.getCheckElement(), false);
54947      }
54948      if (element.hasLogMessageElement()) {
54949        composeStringCore("logMessage", element.getLogMessageElement(), false);
54950        composeStringExtras("logMessage", element.getLogMessageElement(), false);
54951      }
54952  }
54953
54954  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
54955    if (element != null) {
54956      open(name);
54957      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
54958      close();
54959    }
54960  }
54961
54962  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
54963      composeBackbone(element);
54964      if (element.hasContextElement()) {
54965        composeIdCore("context", element.getContextElement(), false);
54966        composeIdExtras("context", element.getContextElement(), false);
54967      }
54968      if (element.hasContextTypeElement()) {
54969        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
54970        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
54971      }
54972      if (element.hasElementElement()) {
54973        composeStringCore("element", element.getElementElement(), false);
54974        composeStringExtras("element", element.getElementElement(), false);
54975      }
54976      if (element.hasVariableElement()) {
54977        composeIdCore("variable", element.getVariableElement(), false);
54978        composeIdExtras("variable", element.getVariableElement(), false);
54979      }
54980      if (element.hasListMode()) {
54981        openArray("listMode");
54982        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
54983          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
54984        closeArray();
54985        if (anyHasExtras(element.getListMode())) {
54986          openArray("_listMode");
54987          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
54988            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
54989          closeArray();
54990        }
54991      };
54992      if (element.hasListRuleIdElement()) {
54993        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
54994        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
54995      }
54996      if (element.hasTransformElement()) {
54997        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
54998        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
54999      }
55000      if (element.hasParameter()) {
55001        openArray("parameter");
55002        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
55003          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
55004        closeArray();
55005      };
55006  }
55007
55008  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
55009    if (element != null) {
55010      open(name);
55011      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
55012      close();
55013    }
55014  }
55015
55016  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
55017      composeBackbone(element);
55018      if (element.hasValue()) {
55019        composeType("value", element.getValue());
55020      }
55021  }
55022
55023  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
55024    if (element != null) {
55025      open(name);
55026      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
55027      close();
55028    }
55029  }
55030
55031  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
55032      composeBackbone(element);
55033      if (element.hasNameElement()) {
55034        composeIdCore("name", element.getNameElement(), false);
55035        composeIdExtras("name", element.getNameElement(), false);
55036      }
55037      if (element.hasVariable()) {
55038        openArray("variable");
55039        for (StringType e : element.getVariable()) 
55040          composeStringCore(null, e, true);
55041        closeArray();
55042        if (anyHasExtras(element.getVariable())) {
55043          openArray("_variable");
55044          for (StringType e : element.getVariable()) 
55045            composeStringExtras(null, e, true);
55046          closeArray();
55047        }
55048      };
55049  }
55050
55051  protected void composeSubscription(String name, Subscription element) throws IOException {
55052    if (element != null) {
55053      prop("resourceType", name);
55054      composeSubscriptionInner(element);
55055    }
55056  }
55057
55058  protected void composeSubscriptionInner(Subscription element) throws IOException {
55059      composeDomainResourceElements(element);
55060      if (element.hasStatusElement()) {
55061        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
55062        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
55063      }
55064      if (element.hasContact()) {
55065        openArray("contact");
55066        for (ContactPoint e : element.getContact()) 
55067          composeContactPoint(null, e);
55068        closeArray();
55069      };
55070      if (element.hasEndElement()) {
55071        composeInstantCore("end", element.getEndElement(), false);
55072        composeInstantExtras("end", element.getEndElement(), false);
55073      }
55074      if (element.hasReasonElement()) {
55075        composeStringCore("reason", element.getReasonElement(), false);
55076        composeStringExtras("reason", element.getReasonElement(), false);
55077      }
55078      if (element.hasCriteriaElement()) {
55079        composeStringCore("criteria", element.getCriteriaElement(), false);
55080        composeStringExtras("criteria", element.getCriteriaElement(), false);
55081      }
55082      if (element.hasErrorElement()) {
55083        composeStringCore("error", element.getErrorElement(), false);
55084        composeStringExtras("error", element.getErrorElement(), false);
55085      }
55086      if (element.hasChannel()) {
55087        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
55088      }
55089  }
55090
55091  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
55092    if (element != null) {
55093      open(name);
55094      composeSubscriptionSubscriptionChannelComponentInner(element);
55095      close();
55096    }
55097  }
55098
55099  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
55100      composeBackbone(element);
55101      if (element.hasTypeElement()) {
55102        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
55103        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
55104      }
55105      if (element.hasEndpointElement()) {
55106        composeUrlCore("endpoint", element.getEndpointElement(), false);
55107        composeUrlExtras("endpoint", element.getEndpointElement(), false);
55108      }
55109      if (element.hasPayloadElement()) {
55110        composeCodeCore("payload", element.getPayloadElement(), false);
55111        composeCodeExtras("payload", element.getPayloadElement(), false);
55112      }
55113      if (element.hasHeader()) {
55114        openArray("header");
55115        for (StringType e : element.getHeader()) 
55116          composeStringCore(null, e, true);
55117        closeArray();
55118        if (anyHasExtras(element.getHeader())) {
55119          openArray("_header");
55120          for (StringType e : element.getHeader()) 
55121            composeStringExtras(null, e, true);
55122          closeArray();
55123        }
55124      };
55125  }
55126
55127  protected void composeSubstance(String name, Substance element) throws IOException {
55128    if (element != null) {
55129      prop("resourceType", name);
55130      composeSubstanceInner(element);
55131    }
55132  }
55133
55134  protected void composeSubstanceInner(Substance element) throws IOException {
55135      composeDomainResourceElements(element);
55136      if (element.hasIdentifier()) {
55137        openArray("identifier");
55138        for (Identifier e : element.getIdentifier()) 
55139          composeIdentifier(null, e);
55140        closeArray();
55141      };
55142      if (element.hasStatusElement()) {
55143        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
55144        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
55145      }
55146      if (element.hasCategory()) {
55147        openArray("category");
55148        for (CodeableConcept e : element.getCategory()) 
55149          composeCodeableConcept(null, e);
55150        closeArray();
55151      };
55152      if (element.hasCode()) {
55153        composeCodeableConcept("code", element.getCode());
55154      }
55155      if (element.hasDescriptionElement()) {
55156        composeStringCore("description", element.getDescriptionElement(), false);
55157        composeStringExtras("description", element.getDescriptionElement(), false);
55158      }
55159      if (element.hasInstance()) {
55160        openArray("instance");
55161        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
55162          composeSubstanceSubstanceInstanceComponent(null, e);
55163        closeArray();
55164      };
55165      if (element.hasIngredient()) {
55166        openArray("ingredient");
55167        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
55168          composeSubstanceSubstanceIngredientComponent(null, e);
55169        closeArray();
55170      };
55171  }
55172
55173  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
55174    if (element != null) {
55175      open(name);
55176      composeSubstanceSubstanceInstanceComponentInner(element);
55177      close();
55178    }
55179  }
55180
55181  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
55182      composeBackbone(element);
55183      if (element.hasIdentifier()) {
55184        composeIdentifier("identifier", element.getIdentifier());
55185      }
55186      if (element.hasExpiryElement()) {
55187        composeDateTimeCore("expiry", element.getExpiryElement(), false);
55188        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
55189      }
55190      if (element.hasQuantity()) {
55191        composeQuantity("quantity", element.getQuantity());
55192      }
55193  }
55194
55195  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
55196    if (element != null) {
55197      open(name);
55198      composeSubstanceSubstanceIngredientComponentInner(element);
55199      close();
55200    }
55201  }
55202
55203  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
55204      composeBackbone(element);
55205      if (element.hasQuantity()) {
55206        composeRatio("quantity", element.getQuantity());
55207      }
55208      if (element.hasSubstance()) {
55209        composeType("substance", element.getSubstance());
55210      }
55211  }
55212
55213  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
55214    if (element != null) {
55215      prop("resourceType", name);
55216      composeSubstanceNucleicAcidInner(element);
55217    }
55218  }
55219
55220  protected void composeSubstanceNucleicAcidInner(SubstanceNucleicAcid element) throws IOException {
55221      composeDomainResourceElements(element);
55222      if (element.hasSequenceType()) {
55223        composeCodeableConcept("sequenceType", element.getSequenceType());
55224      }
55225      if (element.hasNumberOfSubunitsElement()) {
55226        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
55227        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
55228      }
55229      if (element.hasAreaOfHybridisationElement()) {
55230        composeStringCore("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
55231        composeStringExtras("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
55232      }
55233      if (element.hasOligoNucleotideType()) {
55234        composeCodeableConcept("oligoNucleotideType", element.getOligoNucleotideType());
55235      }
55236      if (element.hasSubunit()) {
55237        openArray("subunit");
55238        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent e : element.getSubunit()) 
55239          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(null, e);
55240        closeArray();
55241      };
55242  }
55243
55244  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
55245    if (element != null) {
55246      open(name);
55247      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(element);
55248      close();
55249    }
55250  }
55251
55252  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
55253      composeBackbone(element);
55254      if (element.hasSubunitElement()) {
55255        composeIntegerCore("subunit", element.getSubunitElement(), false);
55256        composeIntegerExtras("subunit", element.getSubunitElement(), false);
55257      }
55258      if (element.hasSequenceElement()) {
55259        composeStringCore("sequence", element.getSequenceElement(), false);
55260        composeStringExtras("sequence", element.getSequenceElement(), false);
55261      }
55262      if (element.hasLengthElement()) {
55263        composeIntegerCore("length", element.getLengthElement(), false);
55264        composeIntegerExtras("length", element.getLengthElement(), false);
55265      }
55266      if (element.hasSequenceAttachment()) {
55267        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
55268      }
55269      if (element.hasFivePrime()) {
55270        composeCodeableConcept("fivePrime", element.getFivePrime());
55271      }
55272      if (element.hasThreePrime()) {
55273        composeCodeableConcept("threePrime", element.getThreePrime());
55274      }
55275      if (element.hasLinkage()) {
55276        openArray("linkage");
55277        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent e : element.getLinkage()) 
55278          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(null, e);
55279        closeArray();
55280      };
55281      if (element.hasSugar()) {
55282        openArray("sugar");
55283        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar()) 
55284          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(null, e);
55285        closeArray();
55286      };
55287  }
55288
55289  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
55290    if (element != null) {
55291      open(name);
55292      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(element);
55293      close();
55294    }
55295  }
55296
55297  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
55298      composeBackbone(element);
55299      if (element.hasConnectivityElement()) {
55300        composeStringCore("connectivity", element.getConnectivityElement(), false);
55301        composeStringExtras("connectivity", element.getConnectivityElement(), false);
55302      }
55303      if (element.hasIdentifier()) {
55304        composeIdentifier("identifier", element.getIdentifier());
55305      }
55306      if (element.hasNameElement()) {
55307        composeStringCore("name", element.getNameElement(), false);
55308        composeStringExtras("name", element.getNameElement(), false);
55309      }
55310      if (element.hasResidueSiteElement()) {
55311        composeStringCore("residueSite", element.getResidueSiteElement(), false);
55312        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
55313      }
55314  }
55315
55316  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
55317    if (element != null) {
55318      open(name);
55319      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(element);
55320      close();
55321    }
55322  }
55323
55324  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
55325      composeBackbone(element);
55326      if (element.hasIdentifier()) {
55327        composeIdentifier("identifier", element.getIdentifier());
55328      }
55329      if (element.hasNameElement()) {
55330        composeStringCore("name", element.getNameElement(), false);
55331        composeStringExtras("name", element.getNameElement(), false);
55332      }
55333      if (element.hasResidueSiteElement()) {
55334        composeStringCore("residueSite", element.getResidueSiteElement(), false);
55335        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
55336      }
55337  }
55338
55339  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
55340    if (element != null) {
55341      prop("resourceType", name);
55342      composeSubstancePolymerInner(element);
55343    }
55344  }
55345
55346  protected void composeSubstancePolymerInner(SubstancePolymer element) throws IOException {
55347      composeDomainResourceElements(element);
55348      if (element.hasClass_()) {
55349        composeCodeableConcept("class", element.getClass_());
55350      }
55351      if (element.hasGeometry()) {
55352        composeCodeableConcept("geometry", element.getGeometry());
55353      }
55354      if (element.hasCopolymerConnectivity()) {
55355        openArray("copolymerConnectivity");
55356        for (CodeableConcept e : element.getCopolymerConnectivity()) 
55357          composeCodeableConcept(null, e);
55358        closeArray();
55359      };
55360      if (element.hasModification()) {
55361        openArray("modification");
55362        for (StringType e : element.getModification()) 
55363          composeStringCore(null, e, true);
55364        closeArray();
55365        if (anyHasExtras(element.getModification())) {
55366          openArray("_modification");
55367          for (StringType e : element.getModification()) 
55368            composeStringExtras(null, e, true);
55369          closeArray();
55370        }
55371      };
55372      if (element.hasMonomerSet()) {
55373        openArray("monomerSet");
55374        for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
55375          composeSubstancePolymerSubstancePolymerMonomerSetComponent(null, e);
55376        closeArray();
55377      };
55378      if (element.hasRepeat()) {
55379        openArray("repeat");
55380        for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
55381          composeSubstancePolymerSubstancePolymerRepeatComponent(null, e);
55382        closeArray();
55383      };
55384  }
55385
55386  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
55387    if (element != null) {
55388      open(name);
55389      composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(element);
55390      close();
55391    }
55392  }
55393
55394  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
55395      composeBackbone(element);
55396      if (element.hasRatioType()) {
55397        composeCodeableConcept("ratioType", element.getRatioType());
55398      }
55399      if (element.hasStartingMaterial()) {
55400        openArray("startingMaterial");
55401        for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
55402          composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
55403        closeArray();
55404      };
55405  }
55406
55407  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
55408    if (element != null) {
55409      open(name);
55410      composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(element);
55411      close();
55412    }
55413  }
55414
55415  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
55416      composeBackbone(element);
55417      if (element.hasMaterial()) {
55418        composeCodeableConcept("material", element.getMaterial());
55419      }
55420      if (element.hasType()) {
55421        composeCodeableConcept("type", element.getType());
55422      }
55423      if (element.hasIsDefiningElement()) {
55424        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
55425        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
55426      }
55427      if (element.hasAmount()) {
55428        composeSubstanceAmount("amount", element.getAmount());
55429      }
55430  }
55431
55432  protected void composeSubstancePolymerSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
55433    if (element != null) {
55434      open(name);
55435      composeSubstancePolymerSubstancePolymerRepeatComponentInner(element);
55436      close();
55437    }
55438  }
55439
55440  protected void composeSubstancePolymerSubstancePolymerRepeatComponentInner(SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
55441      composeBackbone(element);
55442      if (element.hasNumberOfUnitsElement()) {
55443        composeIntegerCore("numberOfUnits", element.getNumberOfUnitsElement(), false);
55444        composeIntegerExtras("numberOfUnits", element.getNumberOfUnitsElement(), false);
55445      }
55446      if (element.hasAverageMolecularFormulaElement()) {
55447        composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
55448        composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
55449      }
55450      if (element.hasRepeatUnitAmountType()) {
55451        composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
55452      }
55453      if (element.hasRepeatUnit()) {
55454        openArray("repeatUnit");
55455        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit()) 
55456          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(null, e);
55457        closeArray();
55458      };
55459  }
55460
55461  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
55462    if (element != null) {
55463      open(name);
55464      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(element);
55465      close();
55466    }
55467  }
55468
55469  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
55470      composeBackbone(element);
55471      if (element.hasOrientationOfPolymerisation()) {
55472        composeCodeableConcept("orientationOfPolymerisation", element.getOrientationOfPolymerisation());
55473      }
55474      if (element.hasRepeatUnitElement()) {
55475        composeStringCore("repeatUnit", element.getRepeatUnitElement(), false);
55476        composeStringExtras("repeatUnit", element.getRepeatUnitElement(), false);
55477      }
55478      if (element.hasAmount()) {
55479        composeSubstanceAmount("amount", element.getAmount());
55480      }
55481      if (element.hasDegreeOfPolymerisation()) {
55482        openArray("degreeOfPolymerisation");
55483        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
55484          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
55485        closeArray();
55486      };
55487      if (element.hasStructuralRepresentation()) {
55488        openArray("structuralRepresentation");
55489        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
55490          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
55491        closeArray();
55492      };
55493  }
55494
55495  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
55496    if (element != null) {
55497      open(name);
55498      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(element);
55499      close();
55500    }
55501  }
55502
55503  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
55504      composeBackbone(element);
55505      if (element.hasDegree()) {
55506        composeCodeableConcept("degree", element.getDegree());
55507      }
55508      if (element.hasAmount()) {
55509        composeSubstanceAmount("amount", element.getAmount());
55510      }
55511  }
55512
55513  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
55514    if (element != null) {
55515      open(name);
55516      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(element);
55517      close();
55518    }
55519  }
55520
55521  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
55522      composeBackbone(element);
55523      if (element.hasType()) {
55524        composeCodeableConcept("type", element.getType());
55525      }
55526      if (element.hasRepresentationElement()) {
55527        composeStringCore("representation", element.getRepresentationElement(), false);
55528        composeStringExtras("representation", element.getRepresentationElement(), false);
55529      }
55530      if (element.hasAttachment()) {
55531        composeAttachment("attachment", element.getAttachment());
55532      }
55533  }
55534
55535  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
55536    if (element != null) {
55537      prop("resourceType", name);
55538      composeSubstanceProteinInner(element);
55539    }
55540  }
55541
55542  protected void composeSubstanceProteinInner(SubstanceProtein element) throws IOException {
55543      composeDomainResourceElements(element);
55544      if (element.hasSequenceType()) {
55545        composeCodeableConcept("sequenceType", element.getSequenceType());
55546      }
55547      if (element.hasNumberOfSubunitsElement()) {
55548        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
55549        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
55550      }
55551      if (element.hasDisulfideLinkage()) {
55552        openArray("disulfideLinkage");
55553        for (StringType e : element.getDisulfideLinkage()) 
55554          composeStringCore(null, e, true);
55555        closeArray();
55556        if (anyHasExtras(element.getDisulfideLinkage())) {
55557          openArray("_disulfideLinkage");
55558          for (StringType e : element.getDisulfideLinkage()) 
55559            composeStringExtras(null, e, true);
55560          closeArray();
55561        }
55562      };
55563      if (element.hasSubunit()) {
55564        openArray("subunit");
55565        for (SubstanceProtein.SubstanceProteinSubunitComponent e : element.getSubunit()) 
55566          composeSubstanceProteinSubstanceProteinSubunitComponent(null, e);
55567        closeArray();
55568      };
55569  }
55570
55571  protected void composeSubstanceProteinSubstanceProteinSubunitComponent(String name, SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
55572    if (element != null) {
55573      open(name);
55574      composeSubstanceProteinSubstanceProteinSubunitComponentInner(element);
55575      close();
55576    }
55577  }
55578
55579  protected void composeSubstanceProteinSubstanceProteinSubunitComponentInner(SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
55580      composeBackbone(element);
55581      if (element.hasSubunitElement()) {
55582        composeIntegerCore("subunit", element.getSubunitElement(), false);
55583        composeIntegerExtras("subunit", element.getSubunitElement(), false);
55584      }
55585      if (element.hasSequenceElement()) {
55586        composeStringCore("sequence", element.getSequenceElement(), false);
55587        composeStringExtras("sequence", element.getSequenceElement(), false);
55588      }
55589      if (element.hasLengthElement()) {
55590        composeIntegerCore("length", element.getLengthElement(), false);
55591        composeIntegerExtras("length", element.getLengthElement(), false);
55592      }
55593      if (element.hasSequenceAttachment()) {
55594        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
55595      }
55596      if (element.hasNTerminalModificationId()) {
55597        composeIdentifier("nTerminalModificationId", element.getNTerminalModificationId());
55598      }
55599      if (element.hasNTerminalModificationElement()) {
55600        composeStringCore("nTerminalModification", element.getNTerminalModificationElement(), false);
55601        composeStringExtras("nTerminalModification", element.getNTerminalModificationElement(), false);
55602      }
55603      if (element.hasCTerminalModificationId()) {
55604        composeIdentifier("cTerminalModificationId", element.getCTerminalModificationId());
55605      }
55606      if (element.hasCTerminalModificationElement()) {
55607        composeStringCore("cTerminalModification", element.getCTerminalModificationElement(), false);
55608        composeStringExtras("cTerminalModification", element.getCTerminalModificationElement(), false);
55609      }
55610  }
55611
55612  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element) throws IOException {
55613    if (element != null) {
55614      prop("resourceType", name);
55615      composeSubstanceReferenceInformationInner(element);
55616    }
55617  }
55618
55619  protected void composeSubstanceReferenceInformationInner(SubstanceReferenceInformation element) throws IOException {
55620      composeDomainResourceElements(element);
55621      if (element.hasCommentElement()) {
55622        composeStringCore("comment", element.getCommentElement(), false);
55623        composeStringExtras("comment", element.getCommentElement(), false);
55624      }
55625      if (element.hasGene()) {
55626        openArray("gene");
55627        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene()) 
55628          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(null, e);
55629        closeArray();
55630      };
55631      if (element.hasGeneElement()) {
55632        openArray("geneElement");
55633        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
55634          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(null, e);
55635        closeArray();
55636      };
55637      if (element.hasClassification()) {
55638        openArray("classification");
55639        for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element.getClassification()) 
55640          composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(null, e);
55641        closeArray();
55642      };
55643      if (element.hasTarget()) {
55644        openArray("target");
55645        for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
55646          composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(null, e);
55647        closeArray();
55648      };
55649  }
55650
55651  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
55652    if (element != null) {
55653      open(name);
55654      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(element);
55655      close();
55656    }
55657  }
55658
55659  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
55660      composeBackbone(element);
55661      if (element.hasGeneSequenceOrigin()) {
55662        composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
55663      }
55664      if (element.hasGene()) {
55665        composeCodeableConcept("gene", element.getGene());
55666      }
55667      if (element.hasSource()) {
55668        openArray("source");
55669        for (Reference e : element.getSource()) 
55670          composeReference(null, e);
55671        closeArray();
55672      };
55673  }
55674
55675  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
55676    if (element != null) {
55677      open(name);
55678      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(element);
55679      close();
55680    }
55681  }
55682
55683  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
55684      composeBackbone(element);
55685      if (element.hasType()) {
55686        composeCodeableConcept("type", element.getType());
55687      }
55688      if (element.hasElement()) {
55689        composeIdentifier("element", element.getElement());
55690      }
55691      if (element.hasSource()) {
55692        openArray("source");
55693        for (Reference e : element.getSource()) 
55694          composeReference(null, e);
55695        closeArray();
55696      };
55697  }
55698
55699  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
55700    if (element != null) {
55701      open(name);
55702      composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(element);
55703      close();
55704    }
55705  }
55706
55707  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
55708      composeBackbone(element);
55709      if (element.hasDomain()) {
55710        composeCodeableConcept("domain", element.getDomain());
55711      }
55712      if (element.hasClassification()) {
55713        composeCodeableConcept("classification", element.getClassification());
55714      }
55715      if (element.hasSubtype()) {
55716        openArray("subtype");
55717        for (CodeableConcept e : element.getSubtype()) 
55718          composeCodeableConcept(null, e);
55719        closeArray();
55720      };
55721      if (element.hasSource()) {
55722        openArray("source");
55723        for (Reference e : element.getSource()) 
55724          composeReference(null, e);
55725        closeArray();
55726      };
55727  }
55728
55729  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
55730    if (element != null) {
55731      open(name);
55732      composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(element);
55733      close();
55734    }
55735  }
55736
55737  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
55738      composeBackbone(element);
55739      if (element.hasTarget()) {
55740        composeIdentifier("target", element.getTarget());
55741      }
55742      if (element.hasType()) {
55743        composeCodeableConcept("type", element.getType());
55744      }
55745      if (element.hasInteraction()) {
55746        composeCodeableConcept("interaction", element.getInteraction());
55747      }
55748      if (element.hasOrganism()) {
55749        composeCodeableConcept("organism", element.getOrganism());
55750      }
55751      if (element.hasOrganismType()) {
55752        composeCodeableConcept("organismType", element.getOrganismType());
55753      }
55754      if (element.hasAmount()) {
55755        composeType("amount", element.getAmount());
55756      }
55757      if (element.hasAmountType()) {
55758        composeCodeableConcept("amountType", element.getAmountType());
55759      }
55760      if (element.hasSource()) {
55761        openArray("source");
55762        for (Reference e : element.getSource()) 
55763          composeReference(null, e);
55764        closeArray();
55765      };
55766  }
55767
55768  protected void composeSubstanceSourceMaterial(String name, SubstanceSourceMaterial element) throws IOException {
55769    if (element != null) {
55770      prop("resourceType", name);
55771      composeSubstanceSourceMaterialInner(element);
55772    }
55773  }
55774
55775  protected void composeSubstanceSourceMaterialInner(SubstanceSourceMaterial element) throws IOException {
55776      composeDomainResourceElements(element);
55777      if (element.hasSourceMaterialClass()) {
55778        composeCodeableConcept("sourceMaterialClass", element.getSourceMaterialClass());
55779      }
55780      if (element.hasSourceMaterialType()) {
55781        composeCodeableConcept("sourceMaterialType", element.getSourceMaterialType());
55782      }
55783      if (element.hasSourceMaterialState()) {
55784        composeCodeableConcept("sourceMaterialState", element.getSourceMaterialState());
55785      }
55786      if (element.hasOrganismId()) {
55787        composeIdentifier("organismId", element.getOrganismId());
55788      }
55789      if (element.hasOrganismNameElement()) {
55790        composeStringCore("organismName", element.getOrganismNameElement(), false);
55791        composeStringExtras("organismName", element.getOrganismNameElement(), false);
55792      }
55793      if (element.hasParentSubstanceId()) {
55794        openArray("parentSubstanceId");
55795        for (Identifier e : element.getParentSubstanceId()) 
55796          composeIdentifier(null, e);
55797        closeArray();
55798      };
55799      if (element.hasParentSubstanceName()) {
55800        openArray("parentSubstanceName");
55801        for (StringType e : element.getParentSubstanceName()) 
55802          composeStringCore(null, e, true);
55803        closeArray();
55804        if (anyHasExtras(element.getParentSubstanceName())) {
55805          openArray("_parentSubstanceName");
55806          for (StringType e : element.getParentSubstanceName()) 
55807            composeStringExtras(null, e, true);
55808          closeArray();
55809        }
55810      };
55811      if (element.hasCountryOfOrigin()) {
55812        openArray("countryOfOrigin");
55813        for (CodeableConcept e : element.getCountryOfOrigin()) 
55814          composeCodeableConcept(null, e);
55815        closeArray();
55816      };
55817      if (element.hasGeographicalLocation()) {
55818        openArray("geographicalLocation");
55819        for (StringType e : element.getGeographicalLocation()) 
55820          composeStringCore(null, e, true);
55821        closeArray();
55822        if (anyHasExtras(element.getGeographicalLocation())) {
55823          openArray("_geographicalLocation");
55824          for (StringType e : element.getGeographicalLocation()) 
55825            composeStringExtras(null, e, true);
55826          closeArray();
55827        }
55828      };
55829      if (element.hasDevelopmentStage()) {
55830        composeCodeableConcept("developmentStage", element.getDevelopmentStage());
55831      }
55832      if (element.hasFractionDescription()) {
55833        openArray("fractionDescription");
55834        for (SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent e : element.getFractionDescription()) 
55835          composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(null, e);
55836        closeArray();
55837      };
55838      if (element.hasOrganism()) {
55839        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
55840      }
55841      if (element.hasPartDescription()) {
55842        openArray("partDescription");
55843        for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription()) 
55844          composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(null, e);
55845        closeArray();
55846      };
55847  }
55848
55849  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
55850    if (element != null) {
55851      open(name);
55852      composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(element);
55853      close();
55854    }
55855  }
55856
55857  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
55858      composeBackbone(element);
55859      if (element.hasFractionElement()) {
55860        composeStringCore("fraction", element.getFractionElement(), false);
55861        composeStringExtras("fraction", element.getFractionElement(), false);
55862      }
55863      if (element.hasMaterialType()) {
55864        composeCodeableConcept("materialType", element.getMaterialType());
55865      }
55866  }
55867
55868  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
55869    if (element != null) {
55870      open(name);
55871      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(element);
55872      close();
55873    }
55874  }
55875
55876  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
55877      composeBackbone(element);
55878      if (element.hasFamily()) {
55879        composeCodeableConcept("family", element.getFamily());
55880      }
55881      if (element.hasGenus()) {
55882        composeCodeableConcept("genus", element.getGenus());
55883      }
55884      if (element.hasSpecies()) {
55885        composeCodeableConcept("species", element.getSpecies());
55886      }
55887      if (element.hasIntraspecificType()) {
55888        composeCodeableConcept("intraspecificType", element.getIntraspecificType());
55889      }
55890      if (element.hasIntraspecificDescriptionElement()) {
55891        composeStringCore("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
55892        composeStringExtras("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
55893      }
55894      if (element.hasAuthor()) {
55895        openArray("author");
55896        for (SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent e : element.getAuthor()) 
55897          composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(null, e);
55898        closeArray();
55899      };
55900      if (element.hasHybrid()) {
55901        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
55902      }
55903      if (element.hasOrganismGeneral()) {
55904        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral", element.getOrganismGeneral());
55905      }
55906  }
55907
55908  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
55909    if (element != null) {
55910      open(name);
55911      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(element);
55912      close();
55913    }
55914  }
55915
55916  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
55917      composeBackbone(element);
55918      if (element.hasAuthorType()) {
55919        composeCodeableConcept("authorType", element.getAuthorType());
55920      }
55921      if (element.hasAuthorDescriptionElement()) {
55922        composeStringCore("authorDescription", element.getAuthorDescriptionElement(), false);
55923        composeStringExtras("authorDescription", element.getAuthorDescriptionElement(), false);
55924      }
55925  }
55926
55927  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
55928    if (element != null) {
55929      open(name);
55930      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(element);
55931      close();
55932    }
55933  }
55934
55935  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
55936      composeBackbone(element);
55937      if (element.hasMaternalOrganismIdElement()) {
55938        composeStringCore("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
55939        composeStringExtras("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
55940      }
55941      if (element.hasMaternalOrganismNameElement()) {
55942        composeStringCore("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
55943        composeStringExtras("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
55944      }
55945      if (element.hasPaternalOrganismIdElement()) {
55946        composeStringCore("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
55947        composeStringExtras("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
55948      }
55949      if (element.hasPaternalOrganismNameElement()) {
55950        composeStringCore("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
55951        composeStringExtras("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
55952      }
55953      if (element.hasHybridType()) {
55954        composeCodeableConcept("hybridType", element.getHybridType());
55955      }
55956  }
55957
55958  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
55959    if (element != null) {
55960      open(name);
55961      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(element);
55962      close();
55963    }
55964  }
55965
55966  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
55967      composeBackbone(element);
55968      if (element.hasKingdom()) {
55969        composeCodeableConcept("kingdom", element.getKingdom());
55970      }
55971      if (element.hasPhylum()) {
55972        composeCodeableConcept("phylum", element.getPhylum());
55973      }
55974      if (element.hasClass_()) {
55975        composeCodeableConcept("class", element.getClass_());
55976      }
55977      if (element.hasOrder()) {
55978        composeCodeableConcept("order", element.getOrder());
55979      }
55980  }
55981
55982  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
55983    if (element != null) {
55984      open(name);
55985      composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(element);
55986      close();
55987    }
55988  }
55989
55990  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
55991      composeBackbone(element);
55992      if (element.hasPart()) {
55993        composeCodeableConcept("part", element.getPart());
55994      }
55995      if (element.hasPartLocation()) {
55996        composeCodeableConcept("partLocation", element.getPartLocation());
55997      }
55998  }
55999
56000  protected void composeSubstanceSpecification(String name, SubstanceSpecification element) throws IOException {
56001    if (element != null) {
56002      prop("resourceType", name);
56003      composeSubstanceSpecificationInner(element);
56004    }
56005  }
56006
56007  protected void composeSubstanceSpecificationInner(SubstanceSpecification element) throws IOException {
56008      composeDomainResourceElements(element);
56009      if (element.hasIdentifier()) {
56010        composeIdentifier("identifier", element.getIdentifier());
56011      }
56012      if (element.hasType()) {
56013        composeCodeableConcept("type", element.getType());
56014      }
56015      if (element.hasStatus()) {
56016        composeCodeableConcept("status", element.getStatus());
56017      }
56018      if (element.hasDomain()) {
56019        composeCodeableConcept("domain", element.getDomain());
56020      }
56021      if (element.hasDescriptionElement()) {
56022        composeStringCore("description", element.getDescriptionElement(), false);
56023        composeStringExtras("description", element.getDescriptionElement(), false);
56024      }
56025      if (element.hasSource()) {
56026        openArray("source");
56027        for (Reference e : element.getSource()) 
56028          composeReference(null, e);
56029        closeArray();
56030      };
56031      if (element.hasCommentElement()) {
56032        composeStringCore("comment", element.getCommentElement(), false);
56033        composeStringExtras("comment", element.getCommentElement(), false);
56034      }
56035      if (element.hasMoiety()) {
56036        openArray("moiety");
56037        for (SubstanceSpecification.SubstanceSpecificationMoietyComponent e : element.getMoiety()) 
56038          composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(null, e);
56039        closeArray();
56040      };
56041      if (element.hasProperty()) {
56042        openArray("property");
56043        for (SubstanceSpecification.SubstanceSpecificationPropertyComponent e : element.getProperty()) 
56044          composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(null, e);
56045        closeArray();
56046      };
56047      if (element.hasReferenceInformation()) {
56048        composeReference("referenceInformation", element.getReferenceInformation());
56049      }
56050      if (element.hasStructure()) {
56051        composeSubstanceSpecificationSubstanceSpecificationStructureComponent("structure", element.getStructure());
56052      }
56053      if (element.hasCode()) {
56054        openArray("code");
56055        for (SubstanceSpecification.SubstanceSpecificationCodeComponent e : element.getCode()) 
56056          composeSubstanceSpecificationSubstanceSpecificationCodeComponent(null, e);
56057        closeArray();
56058      };
56059      if (element.hasName()) {
56060        openArray("name");
56061        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getName()) 
56062          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
56063        closeArray();
56064      };
56065      if (element.hasMolecularWeight()) {
56066        openArray("molecularWeight");
56067        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent e : element.getMolecularWeight()) 
56068          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(null, e);
56069        closeArray();
56070      };
56071      if (element.hasRelationship()) {
56072        openArray("relationship");
56073        for (SubstanceSpecification.SubstanceSpecificationRelationshipComponent e : element.getRelationship()) 
56074          composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(null, e);
56075        closeArray();
56076      };
56077      if (element.hasNucleicAcid()) {
56078        composeReference("nucleicAcid", element.getNucleicAcid());
56079      }
56080      if (element.hasPolymer()) {
56081        composeReference("polymer", element.getPolymer());
56082      }
56083      if (element.hasProtein()) {
56084        composeReference("protein", element.getProtein());
56085      }
56086      if (element.hasSourceMaterial()) {
56087        composeReference("sourceMaterial", element.getSourceMaterial());
56088      }
56089  }
56090
56091  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(String name, SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
56092    if (element != null) {
56093      open(name);
56094      composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(element);
56095      close();
56096    }
56097  }
56098
56099  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
56100      composeBackbone(element);
56101      if (element.hasRole()) {
56102        composeCodeableConcept("role", element.getRole());
56103      }
56104      if (element.hasIdentifier()) {
56105        composeIdentifier("identifier", element.getIdentifier());
56106      }
56107      if (element.hasNameElement()) {
56108        composeStringCore("name", element.getNameElement(), false);
56109        composeStringExtras("name", element.getNameElement(), false);
56110      }
56111      if (element.hasStereochemistry()) {
56112        composeCodeableConcept("stereochemistry", element.getStereochemistry());
56113      }
56114      if (element.hasOpticalActivity()) {
56115        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
56116      }
56117      if (element.hasMolecularFormulaElement()) {
56118        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
56119        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
56120      }
56121      if (element.hasAmount()) {
56122        composeType("amount", element.getAmount());
56123      }
56124  }
56125
56126  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(String name, SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
56127    if (element != null) {
56128      open(name);
56129      composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(element);
56130      close();
56131    }
56132  }
56133
56134  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
56135      composeBackbone(element);
56136      if (element.hasCategory()) {
56137        composeCodeableConcept("category", element.getCategory());
56138      }
56139      if (element.hasCode()) {
56140        composeCodeableConcept("code", element.getCode());
56141      }
56142      if (element.hasParametersElement()) {
56143        composeStringCore("parameters", element.getParametersElement(), false);
56144        composeStringExtras("parameters", element.getParametersElement(), false);
56145      }
56146      if (element.hasDefiningSubstance()) {
56147        composeType("definingSubstance", element.getDefiningSubstance());
56148      }
56149      if (element.hasAmount()) {
56150        composeType("amount", element.getAmount());
56151      }
56152  }
56153
56154  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
56155    if (element != null) {
56156      open(name);
56157      composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(element);
56158      close();
56159    }
56160  }
56161
56162  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
56163      composeBackbone(element);
56164      if (element.hasStereochemistry()) {
56165        composeCodeableConcept("stereochemistry", element.getStereochemistry());
56166      }
56167      if (element.hasOpticalActivity()) {
56168        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
56169      }
56170      if (element.hasMolecularFormulaElement()) {
56171        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
56172        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
56173      }
56174      if (element.hasMolecularFormulaByMoietyElement()) {
56175        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
56176        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
56177      }
56178      if (element.hasIsotope()) {
56179        openArray("isotope");
56180        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent e : element.getIsotope()) 
56181          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(null, e);
56182        closeArray();
56183      };
56184      if (element.hasMolecularWeight()) {
56185        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
56186      }
56187      if (element.hasSource()) {
56188        openArray("source");
56189        for (Reference e : element.getSource()) 
56190          composeReference(null, e);
56191        closeArray();
56192      };
56193      if (element.hasRepresentation()) {
56194        openArray("representation");
56195        for (SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent e : element.getRepresentation()) 
56196          composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(null, e);
56197        closeArray();
56198      };
56199  }
56200
56201  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
56202    if (element != null) {
56203      open(name);
56204      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(element);
56205      close();
56206    }
56207  }
56208
56209  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
56210      composeBackbone(element);
56211      if (element.hasIdentifier()) {
56212        composeIdentifier("identifier", element.getIdentifier());
56213      }
56214      if (element.hasName()) {
56215        composeCodeableConcept("name", element.getName());
56216      }
56217      if (element.hasSubstitution()) {
56218        composeCodeableConcept("substitution", element.getSubstitution());
56219      }
56220      if (element.hasHalfLife()) {
56221        composeQuantity("halfLife", element.getHalfLife());
56222      }
56223      if (element.hasMolecularWeight()) {
56224        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
56225      }
56226  }
56227
56228  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
56229    if (element != null) {
56230      open(name);
56231      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(element);
56232      close();
56233    }
56234  }
56235
56236  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
56237      composeBackbone(element);
56238      if (element.hasMethod()) {
56239        composeCodeableConcept("method", element.getMethod());
56240      }
56241      if (element.hasType()) {
56242        composeCodeableConcept("type", element.getType());
56243      }
56244      if (element.hasAmount()) {
56245        composeQuantity("amount", element.getAmount());
56246      }
56247  }
56248
56249  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
56250    if (element != null) {
56251      open(name);
56252      composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentInner(element);
56253      close();
56254    }
56255  }
56256
56257  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentInner(SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
56258      composeBackbone(element);
56259      if (element.hasType()) {
56260        composeCodeableConcept("type", element.getType());
56261      }
56262      if (element.hasRepresentationElement()) {
56263        composeStringCore("representation", element.getRepresentationElement(), false);
56264        composeStringExtras("representation", element.getRepresentationElement(), false);
56265      }
56266      if (element.hasAttachment()) {
56267        composeAttachment("attachment", element.getAttachment());
56268      }
56269  }
56270
56271  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponent(String name, SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
56272    if (element != null) {
56273      open(name);
56274      composeSubstanceSpecificationSubstanceSpecificationCodeComponentInner(element);
56275      close();
56276    }
56277  }
56278
56279  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponentInner(SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
56280      composeBackbone(element);
56281      if (element.hasCode()) {
56282        composeCodeableConcept("code", element.getCode());
56283      }
56284      if (element.hasStatus()) {
56285        composeCodeableConcept("status", element.getStatus());
56286      }
56287      if (element.hasStatusDateElement()) {
56288        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
56289        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
56290      }
56291      if (element.hasCommentElement()) {
56292        composeStringCore("comment", element.getCommentElement(), false);
56293        composeStringExtras("comment", element.getCommentElement(), false);
56294      }
56295      if (element.hasSource()) {
56296        openArray("source");
56297        for (Reference e : element.getSource()) 
56298          composeReference(null, e);
56299        closeArray();
56300      };
56301  }
56302
56303  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponent(String name, SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
56304    if (element != null) {
56305      open(name);
56306      composeSubstanceSpecificationSubstanceSpecificationNameComponentInner(element);
56307      close();
56308    }
56309  }
56310
56311  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponentInner(SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
56312      composeBackbone(element);
56313      if (element.hasNameElement()) {
56314        composeStringCore("name", element.getNameElement(), false);
56315        composeStringExtras("name", element.getNameElement(), false);
56316      }
56317      if (element.hasType()) {
56318        composeCodeableConcept("type", element.getType());
56319      }
56320      if (element.hasStatus()) {
56321        composeCodeableConcept("status", element.getStatus());
56322      }
56323      if (element.hasPreferredElement()) {
56324        composeBooleanCore("preferred", element.getPreferredElement(), false);
56325        composeBooleanExtras("preferred", element.getPreferredElement(), false);
56326      }
56327      if (element.hasLanguage()) {
56328        openArray("language");
56329        for (CodeableConcept e : element.getLanguage()) 
56330          composeCodeableConcept(null, e);
56331        closeArray();
56332      };
56333      if (element.hasDomain()) {
56334        openArray("domain");
56335        for (CodeableConcept e : element.getDomain()) 
56336          composeCodeableConcept(null, e);
56337        closeArray();
56338      };
56339      if (element.hasJurisdiction()) {
56340        openArray("jurisdiction");
56341        for (CodeableConcept e : element.getJurisdiction()) 
56342          composeCodeableConcept(null, e);
56343        closeArray();
56344      };
56345      if (element.hasSynonym()) {
56346        openArray("synonym");
56347        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getSynonym()) 
56348          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
56349        closeArray();
56350      };
56351      if (element.hasTranslation()) {
56352        openArray("translation");
56353        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getTranslation()) 
56354          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
56355        closeArray();
56356      };
56357      if (element.hasOfficial()) {
56358        openArray("official");
56359        for (SubstanceSpecification.SubstanceSpecificationNameOfficialComponent e : element.getOfficial()) 
56360          composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(null, e);
56361        closeArray();
56362      };
56363      if (element.hasSource()) {
56364        openArray("source");
56365        for (Reference e : element.getSource()) 
56366          composeReference(null, e);
56367        closeArray();
56368      };
56369  }
56370
56371  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(String name, SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
56372    if (element != null) {
56373      open(name);
56374      composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentInner(element);
56375      close();
56376    }
56377  }
56378
56379  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentInner(SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
56380      composeBackbone(element);
56381      if (element.hasAuthority()) {
56382        composeCodeableConcept("authority", element.getAuthority());
56383      }
56384      if (element.hasStatus()) {
56385        composeCodeableConcept("status", element.getStatus());
56386      }
56387      if (element.hasDateElement()) {
56388        composeDateTimeCore("date", element.getDateElement(), false);
56389        composeDateTimeExtras("date", element.getDateElement(), false);
56390      }
56391  }
56392
56393  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(String name, SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
56394    if (element != null) {
56395      open(name);
56396      composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentInner(element);
56397      close();
56398    }
56399  }
56400
56401  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentInner(SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
56402      composeBackbone(element);
56403      if (element.hasSubstance()) {
56404        composeType("substance", element.getSubstance());
56405      }
56406      if (element.hasRelationship()) {
56407        composeCodeableConcept("relationship", element.getRelationship());
56408      }
56409      if (element.hasIsDefiningElement()) {
56410        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
56411        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
56412      }
56413      if (element.hasAmount()) {
56414        composeType("amount", element.getAmount());
56415      }
56416      if (element.hasAmountRatioLowLimit()) {
56417        composeRatio("amountRatioLowLimit", element.getAmountRatioLowLimit());
56418      }
56419      if (element.hasAmountType()) {
56420        composeCodeableConcept("amountType", element.getAmountType());
56421      }
56422      if (element.hasSource()) {
56423        openArray("source");
56424        for (Reference e : element.getSource()) 
56425          composeReference(null, e);
56426        closeArray();
56427      };
56428  }
56429
56430  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
56431    if (element != null) {
56432      prop("resourceType", name);
56433      composeSupplyDeliveryInner(element);
56434    }
56435  }
56436
56437  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
56438      composeDomainResourceElements(element);
56439      if (element.hasIdentifier()) {
56440        openArray("identifier");
56441        for (Identifier e : element.getIdentifier()) 
56442          composeIdentifier(null, e);
56443        closeArray();
56444      };
56445      if (element.hasBasedOn()) {
56446        openArray("basedOn");
56447        for (Reference e : element.getBasedOn()) 
56448          composeReference(null, e);
56449        closeArray();
56450      };
56451      if (element.hasPartOf()) {
56452        openArray("partOf");
56453        for (Reference e : element.getPartOf()) 
56454          composeReference(null, e);
56455        closeArray();
56456      };
56457      if (element.hasStatusElement()) {
56458        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
56459        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
56460      }
56461      if (element.hasPatient()) {
56462        composeReference("patient", element.getPatient());
56463      }
56464      if (element.hasType()) {
56465        composeCodeableConcept("type", element.getType());
56466      }
56467      if (element.hasSuppliedItem()) {
56468        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
56469      }
56470      if (element.hasOccurrence()) {
56471        composeType("occurrence", element.getOccurrence());
56472      }
56473      if (element.hasSupplier()) {
56474        composeReference("supplier", element.getSupplier());
56475      }
56476      if (element.hasDestination()) {
56477        composeReference("destination", element.getDestination());
56478      }
56479      if (element.hasReceiver()) {
56480        openArray("receiver");
56481        for (Reference e : element.getReceiver()) 
56482          composeReference(null, e);
56483        closeArray();
56484      };
56485  }
56486
56487  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
56488    if (element != null) {
56489      open(name);
56490      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
56491      close();
56492    }
56493  }
56494
56495  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
56496      composeBackbone(element);
56497      if (element.hasQuantity()) {
56498        composeQuantity("quantity", element.getQuantity());
56499      }
56500      if (element.hasItem()) {
56501        composeType("item", element.getItem());
56502      }
56503  }
56504
56505  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
56506    if (element != null) {
56507      prop("resourceType", name);
56508      composeSupplyRequestInner(element);
56509    }
56510  }
56511
56512  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
56513      composeDomainResourceElements(element);
56514      if (element.hasIdentifier()) {
56515        openArray("identifier");
56516        for (Identifier e : element.getIdentifier()) 
56517          composeIdentifier(null, e);
56518        closeArray();
56519      };
56520      if (element.hasStatusElement()) {
56521        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
56522        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
56523      }
56524      if (element.hasCategory()) {
56525        composeCodeableConcept("category", element.getCategory());
56526      }
56527      if (element.hasPriorityElement()) {
56528        composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
56529        composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
56530      }
56531      if (element.hasItem()) {
56532        composeType("item", element.getItem());
56533      }
56534      if (element.hasQuantity()) {
56535        composeQuantity("quantity", element.getQuantity());
56536      }
56537      if (element.hasParameter()) {
56538        openArray("parameter");
56539        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
56540          composeSupplyRequestSupplyRequestParameterComponent(null, e);
56541        closeArray();
56542      };
56543      if (element.hasOccurrence()) {
56544        composeType("occurrence", element.getOccurrence());
56545      }
56546      if (element.hasAuthoredOnElement()) {
56547        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
56548        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
56549      }
56550      if (element.hasRequester()) {
56551        composeReference("requester", element.getRequester());
56552      }
56553      if (element.hasSupplier()) {
56554        openArray("supplier");
56555        for (Reference e : element.getSupplier()) 
56556          composeReference(null, e);
56557        closeArray();
56558      };
56559      if (element.hasReasonCode()) {
56560        openArray("reasonCode");
56561        for (CodeableConcept e : element.getReasonCode()) 
56562          composeCodeableConcept(null, e);
56563        closeArray();
56564      };
56565      if (element.hasReasonReference()) {
56566        openArray("reasonReference");
56567        for (Reference e : element.getReasonReference()) 
56568          composeReference(null, e);
56569        closeArray();
56570      };
56571      if (element.hasDeliverFrom()) {
56572        composeReference("deliverFrom", element.getDeliverFrom());
56573      }
56574      if (element.hasDeliverTo()) {
56575        composeReference("deliverTo", element.getDeliverTo());
56576      }
56577  }
56578
56579  protected void composeSupplyRequestSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
56580    if (element != null) {
56581      open(name);
56582      composeSupplyRequestSupplyRequestParameterComponentInner(element);
56583      close();
56584    }
56585  }
56586
56587  protected void composeSupplyRequestSupplyRequestParameterComponentInner(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
56588      composeBackbone(element);
56589      if (element.hasCode()) {
56590        composeCodeableConcept("code", element.getCode());
56591      }
56592      if (element.hasValue()) {
56593        composeType("value", element.getValue());
56594      }
56595  }
56596
56597  protected void composeTask(String name, Task element) throws IOException {
56598    if (element != null) {
56599      prop("resourceType", name);
56600      composeTaskInner(element);
56601    }
56602  }
56603
56604  protected void composeTaskInner(Task element) throws IOException {
56605      composeDomainResourceElements(element);
56606      if (element.hasIdentifier()) {
56607        openArray("identifier");
56608        for (Identifier e : element.getIdentifier()) 
56609          composeIdentifier(null, e);
56610        closeArray();
56611      };
56612      if (element.hasInstantiatesCanonicalElement()) {
56613        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
56614        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
56615      }
56616      if (element.hasInstantiatesUriElement()) {
56617        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
56618        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
56619      }
56620      if (element.hasBasedOn()) {
56621        openArray("basedOn");
56622        for (Reference e : element.getBasedOn()) 
56623          composeReference(null, e);
56624        closeArray();
56625      };
56626      if (element.hasGroupIdentifier()) {
56627        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
56628      }
56629      if (element.hasPartOf()) {
56630        openArray("partOf");
56631        for (Reference e : element.getPartOf()) 
56632          composeReference(null, e);
56633        closeArray();
56634      };
56635      if (element.hasStatusElement()) {
56636        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
56637        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
56638      }
56639      if (element.hasStatusReason()) {
56640        composeCodeableConcept("statusReason", element.getStatusReason());
56641      }
56642      if (element.hasBusinessStatus()) {
56643        composeCodeableConcept("businessStatus", element.getBusinessStatus());
56644      }
56645      if (element.hasIntentElement()) {
56646        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
56647        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
56648      }
56649      if (element.hasPriorityElement()) {
56650        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
56651        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
56652      }
56653      if (element.hasCode()) {
56654        composeCodeableConcept("code", element.getCode());
56655      }
56656      if (element.hasDescriptionElement()) {
56657        composeStringCore("description", element.getDescriptionElement(), false);
56658        composeStringExtras("description", element.getDescriptionElement(), false);
56659      }
56660      if (element.hasFocus()) {
56661        composeReference("focus", element.getFocus());
56662      }
56663      if (element.hasFor()) {
56664        composeReference("for", element.getFor());
56665      }
56666      if (element.hasEncounter()) {
56667        composeReference("encounter", element.getEncounter());
56668      }
56669      if (element.hasExecutionPeriod()) {
56670        composePeriod("executionPeriod", element.getExecutionPeriod());
56671      }
56672      if (element.hasAuthoredOnElement()) {
56673        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
56674        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
56675      }
56676      if (element.hasLastModifiedElement()) {
56677        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
56678        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
56679      }
56680      if (element.hasRequester()) {
56681        composeReference("requester", element.getRequester());
56682      }
56683      if (element.hasPerformerType()) {
56684        openArray("performerType");
56685        for (CodeableConcept e : element.getPerformerType()) 
56686          composeCodeableConcept(null, e);
56687        closeArray();
56688      };
56689      if (element.hasOwner()) {
56690        composeReference("owner", element.getOwner());
56691      }
56692      if (element.hasLocation()) {
56693        composeReference("location", element.getLocation());
56694      }
56695      if (element.hasReasonCode()) {
56696        composeCodeableConcept("reasonCode", element.getReasonCode());
56697      }
56698      if (element.hasReasonReference()) {
56699        composeReference("reasonReference", element.getReasonReference());
56700      }
56701      if (element.hasInsurance()) {
56702        openArray("insurance");
56703        for (Reference e : element.getInsurance()) 
56704          composeReference(null, e);
56705        closeArray();
56706      };
56707      if (element.hasNote()) {
56708        openArray("note");
56709        for (Annotation e : element.getNote()) 
56710          composeAnnotation(null, e);
56711        closeArray();
56712      };
56713      if (element.hasRelevantHistory()) {
56714        openArray("relevantHistory");
56715        for (Reference e : element.getRelevantHistory()) 
56716          composeReference(null, e);
56717        closeArray();
56718      };
56719      if (element.hasRestriction()) {
56720        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
56721      }
56722      if (element.hasInput()) {
56723        openArray("input");
56724        for (Task.ParameterComponent e : element.getInput()) 
56725          composeTaskParameterComponent(null, e);
56726        closeArray();
56727      };
56728      if (element.hasOutput()) {
56729        openArray("output");
56730        for (Task.TaskOutputComponent e : element.getOutput()) 
56731          composeTaskTaskOutputComponent(null, e);
56732        closeArray();
56733      };
56734  }
56735
56736  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
56737    if (element != null) {
56738      open(name);
56739      composeTaskTaskRestrictionComponentInner(element);
56740      close();
56741    }
56742  }
56743
56744  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
56745      composeBackbone(element);
56746      if (element.hasRepetitionsElement()) {
56747        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
56748        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
56749      }
56750      if (element.hasPeriod()) {
56751        composePeriod("period", element.getPeriod());
56752      }
56753      if (element.hasRecipient()) {
56754        openArray("recipient");
56755        for (Reference e : element.getRecipient()) 
56756          composeReference(null, e);
56757        closeArray();
56758      };
56759  }
56760
56761  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
56762    if (element != null) {
56763      open(name);
56764      composeTaskParameterComponentInner(element);
56765      close();
56766    }
56767  }
56768
56769  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
56770      composeBackbone(element);
56771      if (element.hasType()) {
56772        composeCodeableConcept("type", element.getType());
56773      }
56774      if (element.hasValue()) {
56775        composeType("value", element.getValue());
56776      }
56777  }
56778
56779  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
56780    if (element != null) {
56781      open(name);
56782      composeTaskTaskOutputComponentInner(element);
56783      close();
56784    }
56785  }
56786
56787  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
56788      composeBackbone(element);
56789      if (element.hasType()) {
56790        composeCodeableConcept("type", element.getType());
56791      }
56792      if (element.hasValue()) {
56793        composeType("value", element.getValue());
56794      }
56795  }
56796
56797  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
56798    if (element != null) {
56799      prop("resourceType", name);
56800      composeTerminologyCapabilitiesInner(element);
56801    }
56802  }
56803
56804  protected void composeTerminologyCapabilitiesInner(TerminologyCapabilities element) throws IOException {
56805      composeDomainResourceElements(element);
56806      if (element.hasUrlElement()) {
56807        composeUriCore("url", element.getUrlElement(), false);
56808        composeUriExtras("url", element.getUrlElement(), false);
56809      }
56810      if (element.hasVersionElement()) {
56811        composeStringCore("version", element.getVersionElement(), false);
56812        composeStringExtras("version", element.getVersionElement(), false);
56813      }
56814      if (element.hasNameElement()) {
56815        composeStringCore("name", element.getNameElement(), false);
56816        composeStringExtras("name", element.getNameElement(), false);
56817      }
56818      if (element.hasTitleElement()) {
56819        composeStringCore("title", element.getTitleElement(), false);
56820        composeStringExtras("title", element.getTitleElement(), false);
56821      }
56822      if (element.hasStatusElement()) {
56823        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56824        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56825      }
56826      if (element.hasExperimentalElement()) {
56827        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56828        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56829      }
56830      if (element.hasDateElement()) {
56831        composeDateTimeCore("date", element.getDateElement(), false);
56832        composeDateTimeExtras("date", element.getDateElement(), false);
56833      }
56834      if (element.hasPublisherElement()) {
56835        composeStringCore("publisher", element.getPublisherElement(), false);
56836        composeStringExtras("publisher", element.getPublisherElement(), false);
56837      }
56838      if (element.hasContact()) {
56839        openArray("contact");
56840        for (ContactDetail e : element.getContact()) 
56841          composeContactDetail(null, e);
56842        closeArray();
56843      };
56844      if (element.hasDescriptionElement()) {
56845        composeMarkdownCore("description", element.getDescriptionElement(), false);
56846        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56847      }
56848      if (element.hasUseContext()) {
56849        openArray("useContext");
56850        for (UsageContext e : element.getUseContext()) 
56851          composeUsageContext(null, e);
56852        closeArray();
56853      };
56854      if (element.hasJurisdiction()) {
56855        openArray("jurisdiction");
56856        for (CodeableConcept e : element.getJurisdiction()) 
56857          composeCodeableConcept(null, e);
56858        closeArray();
56859      };
56860      if (element.hasPurposeElement()) {
56861        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56862        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56863      }
56864      if (element.hasCopyrightElement()) {
56865        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56866        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56867      }
56868      if (element.hasKindElement()) {
56869        composeEnumerationCore("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
56870        composeEnumerationExtras("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
56871      }
56872      if (element.hasSoftware()) {
56873        composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
56874      }
56875      if (element.hasImplementation()) {
56876        composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
56877      }
56878      if (element.hasLockedDateElement()) {
56879        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
56880        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
56881      }
56882      if (element.hasCodeSystem()) {
56883        openArray("codeSystem");
56884        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
56885          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(null, e);
56886        closeArray();
56887      };
56888      if (element.hasExpansion()) {
56889        composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
56890      }
56891      if (element.hasCodeSearchElement()) {
56892        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
56893        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
56894      }
56895      if (element.hasValidateCode()) {
56896        composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
56897      }
56898      if (element.hasTranslation()) {
56899        composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
56900      }
56901      if (element.hasClosure()) {
56902        composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
56903      }
56904  }
56905
56906  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
56907    if (element != null) {
56908      open(name);
56909      composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(element);
56910      close();
56911    }
56912  }
56913
56914  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
56915      composeBackbone(element);
56916      if (element.hasNameElement()) {
56917        composeStringCore("name", element.getNameElement(), false);
56918        composeStringExtras("name", element.getNameElement(), false);
56919      }
56920      if (element.hasVersionElement()) {
56921        composeStringCore("version", element.getVersionElement(), false);
56922        composeStringExtras("version", element.getVersionElement(), false);
56923      }
56924  }
56925
56926  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
56927    if (element != null) {
56928      open(name);
56929      composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(element);
56930      close();
56931    }
56932  }
56933
56934  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
56935      composeBackbone(element);
56936      if (element.hasDescriptionElement()) {
56937        composeStringCore("description", element.getDescriptionElement(), false);
56938        composeStringExtras("description", element.getDescriptionElement(), false);
56939      }
56940      if (element.hasUrlElement()) {
56941        composeUrlCore("url", element.getUrlElement(), false);
56942        composeUrlExtras("url", element.getUrlElement(), false);
56943      }
56944  }
56945
56946  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
56947    if (element != null) {
56948      open(name);
56949      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(element);
56950      close();
56951    }
56952  }
56953
56954  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
56955      composeBackbone(element);
56956      if (element.hasUriElement()) {
56957        composeCanonicalCore("uri", element.getUriElement(), false);
56958        composeCanonicalExtras("uri", element.getUriElement(), false);
56959      }
56960      if (element.hasVersion()) {
56961        openArray("version");
56962        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
56963          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
56964        closeArray();
56965      };
56966      if (element.hasSubsumptionElement()) {
56967        composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
56968        composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
56969      }
56970  }
56971
56972  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
56973    if (element != null) {
56974      open(name);
56975      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(element);
56976      close();
56977    }
56978  }
56979
56980  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
56981      composeBackbone(element);
56982      if (element.hasCodeElement()) {
56983        composeStringCore("code", element.getCodeElement(), false);
56984        composeStringExtras("code", element.getCodeElement(), false);
56985      }
56986      if (element.hasIsDefaultElement()) {
56987        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
56988        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
56989      }
56990      if (element.hasCompositionalElement()) {
56991        composeBooleanCore("compositional", element.getCompositionalElement(), false);
56992        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
56993      }
56994      if (element.hasLanguage()) {
56995        openArray("language");
56996        for (CodeType e : element.getLanguage()) 
56997          composeCodeCore(null, e, true);
56998        closeArray();
56999        if (anyHasExtras(element.getLanguage())) {
57000          openArray("_language");
57001          for (CodeType e : element.getLanguage()) 
57002            composeCodeExtras(null, e, true);
57003          closeArray();
57004        }
57005      };
57006      if (element.hasFilter()) {
57007        openArray("filter");
57008        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
57009          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
57010        closeArray();
57011      };
57012      if (element.hasProperty()) {
57013        openArray("property");
57014        for (CodeType e : element.getProperty()) 
57015          composeCodeCore(null, e, true);
57016        closeArray();
57017        if (anyHasExtras(element.getProperty())) {
57018          openArray("_property");
57019          for (CodeType e : element.getProperty()) 
57020            composeCodeExtras(null, e, true);
57021          closeArray();
57022        }
57023      };
57024  }
57025
57026  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
57027    if (element != null) {
57028      open(name);
57029      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(element);
57030      close();
57031    }
57032  }
57033
57034  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
57035      composeBackbone(element);
57036      if (element.hasCodeElement()) {
57037        composeCodeCore("code", element.getCodeElement(), false);
57038        composeCodeExtras("code", element.getCodeElement(), false);
57039      }
57040      if (element.hasOp()) {
57041        openArray("op");
57042        for (CodeType e : element.getOp()) 
57043          composeCodeCore(null, e, true);
57044        closeArray();
57045        if (anyHasExtras(element.getOp())) {
57046          openArray("_op");
57047          for (CodeType e : element.getOp()) 
57048            composeCodeExtras(null, e, true);
57049          closeArray();
57050        }
57051      };
57052  }
57053
57054  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
57055    if (element != null) {
57056      open(name);
57057      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(element);
57058      close();
57059    }
57060  }
57061
57062  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
57063      composeBackbone(element);
57064      if (element.hasHierarchicalElement()) {
57065        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
57066        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
57067      }
57068      if (element.hasPagingElement()) {
57069        composeBooleanCore("paging", element.getPagingElement(), false);
57070        composeBooleanExtras("paging", element.getPagingElement(), false);
57071      }
57072      if (element.hasIncompleteElement()) {
57073        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
57074        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
57075      }
57076      if (element.hasParameter()) {
57077        openArray("parameter");
57078        for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter()) 
57079          composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(null, e);
57080        closeArray();
57081      };
57082      if (element.hasTextFilterElement()) {
57083        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
57084        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
57085      }
57086  }
57087
57088  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
57089    if (element != null) {
57090      open(name);
57091      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(element);
57092      close();
57093    }
57094  }
57095
57096  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
57097      composeBackbone(element);
57098      if (element.hasNameElement()) {
57099        composeCodeCore("name", element.getNameElement(), false);
57100        composeCodeExtras("name", element.getNameElement(), false);
57101      }
57102      if (element.hasDocumentationElement()) {
57103        composeStringCore("documentation", element.getDocumentationElement(), false);
57104        composeStringExtras("documentation", element.getDocumentationElement(), false);
57105      }
57106  }
57107
57108  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
57109    if (element != null) {
57110      open(name);
57111      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(element);
57112      close();
57113    }
57114  }
57115
57116  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
57117      composeBackbone(element);
57118      if (element.hasTranslationsElement()) {
57119        composeBooleanCore("translations", element.getTranslationsElement(), false);
57120        composeBooleanExtras("translations", element.getTranslationsElement(), false);
57121      }
57122  }
57123
57124  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
57125    if (element != null) {
57126      open(name);
57127      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(element);
57128      close();
57129    }
57130  }
57131
57132  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
57133      composeBackbone(element);
57134      if (element.hasNeedsMapElement()) {
57135        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
57136        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
57137      }
57138  }
57139
57140  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
57141    if (element != null) {
57142      open(name);
57143      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(element);
57144      close();
57145    }
57146  }
57147
57148  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
57149      composeBackbone(element);
57150      if (element.hasTranslationElement()) {
57151        composeBooleanCore("translation", element.getTranslationElement(), false);
57152        composeBooleanExtras("translation", element.getTranslationElement(), false);
57153      }
57154  }
57155
57156  protected void composeTestReport(String name, TestReport element) throws IOException {
57157    if (element != null) {
57158      prop("resourceType", name);
57159      composeTestReportInner(element);
57160    }
57161  }
57162
57163  protected void composeTestReportInner(TestReport element) throws IOException {
57164      composeDomainResourceElements(element);
57165      if (element.hasIdentifier()) {
57166        composeIdentifier("identifier", element.getIdentifier());
57167      }
57168      if (element.hasNameElement()) {
57169        composeStringCore("name", element.getNameElement(), false);
57170        composeStringExtras("name", element.getNameElement(), false);
57171      }
57172      if (element.hasStatusElement()) {
57173        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
57174        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
57175      }
57176      if (element.hasTestScript()) {
57177        composeReference("testScript", element.getTestScript());
57178      }
57179      if (element.hasResultElement()) {
57180        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
57181        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
57182      }
57183      if (element.hasScoreElement()) {
57184        composeDecimalCore("score", element.getScoreElement(), false);
57185        composeDecimalExtras("score", element.getScoreElement(), false);
57186      }
57187      if (element.hasTesterElement()) {
57188        composeStringCore("tester", element.getTesterElement(), false);
57189        composeStringExtras("tester", element.getTesterElement(), false);
57190      }
57191      if (element.hasIssuedElement()) {
57192        composeDateTimeCore("issued", element.getIssuedElement(), false);
57193        composeDateTimeExtras("issued", element.getIssuedElement(), false);
57194      }
57195      if (element.hasParticipant()) {
57196        openArray("participant");
57197        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
57198          composeTestReportTestReportParticipantComponent(null, e);
57199        closeArray();
57200      };
57201      if (element.hasSetup()) {
57202        composeTestReportTestReportSetupComponent("setup", element.getSetup());
57203      }
57204      if (element.hasTest()) {
57205        openArray("test");
57206        for (TestReport.TestReportTestComponent e : element.getTest()) 
57207          composeTestReportTestReportTestComponent(null, e);
57208        closeArray();
57209      };
57210      if (element.hasTeardown()) {
57211        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
57212      }
57213  }
57214
57215  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
57216    if (element != null) {
57217      open(name);
57218      composeTestReportTestReportParticipantComponentInner(element);
57219      close();
57220    }
57221  }
57222
57223  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element) throws IOException {
57224      composeBackbone(element);
57225      if (element.hasTypeElement()) {
57226        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
57227        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
57228      }
57229      if (element.hasUriElement()) {
57230        composeUriCore("uri", element.getUriElement(), false);
57231        composeUriExtras("uri", element.getUriElement(), false);
57232      }
57233      if (element.hasDisplayElement()) {
57234        composeStringCore("display", element.getDisplayElement(), false);
57235        composeStringExtras("display", element.getDisplayElement(), false);
57236      }
57237  }
57238
57239  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
57240    if (element != null) {
57241      open(name);
57242      composeTestReportTestReportSetupComponentInner(element);
57243      close();
57244    }
57245  }
57246
57247  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element) throws IOException {
57248      composeBackbone(element);
57249      if (element.hasAction()) {
57250        openArray("action");
57251        for (TestReport.SetupActionComponent e : element.getAction()) 
57252          composeTestReportSetupActionComponent(null, e);
57253        closeArray();
57254      };
57255  }
57256
57257  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
57258    if (element != null) {
57259      open(name);
57260      composeTestReportSetupActionComponentInner(element);
57261      close();
57262    }
57263  }
57264
57265  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element) throws IOException {
57266      composeBackbone(element);
57267      if (element.hasOperation()) {
57268        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
57269      }
57270      if (element.hasAssert()) {
57271        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
57272      }
57273  }
57274
57275  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
57276    if (element != null) {
57277      open(name);
57278      composeTestReportSetupActionOperationComponentInner(element);
57279      close();
57280    }
57281  }
57282
57283  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element) throws IOException {
57284      composeBackbone(element);
57285      if (element.hasResultElement()) {
57286        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
57287        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
57288      }
57289      if (element.hasMessageElement()) {
57290        composeMarkdownCore("message", element.getMessageElement(), false);
57291        composeMarkdownExtras("message", element.getMessageElement(), false);
57292      }
57293      if (element.hasDetailElement()) {
57294        composeUriCore("detail", element.getDetailElement(), false);
57295        composeUriExtras("detail", element.getDetailElement(), false);
57296      }
57297  }
57298
57299  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
57300    if (element != null) {
57301      open(name);
57302      composeTestReportSetupActionAssertComponentInner(element);
57303      close();
57304    }
57305  }
57306
57307  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element) throws IOException {
57308      composeBackbone(element);
57309      if (element.hasResultElement()) {
57310        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
57311        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
57312      }
57313      if (element.hasMessageElement()) {
57314        composeMarkdownCore("message", element.getMessageElement(), false);
57315        composeMarkdownExtras("message", element.getMessageElement(), false);
57316      }
57317      if (element.hasDetailElement()) {
57318        composeStringCore("detail", element.getDetailElement(), false);
57319        composeStringExtras("detail", element.getDetailElement(), false);
57320      }
57321  }
57322
57323  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
57324    if (element != null) {
57325      open(name);
57326      composeTestReportTestReportTestComponentInner(element);
57327      close();
57328    }
57329  }
57330
57331  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element) throws IOException {
57332      composeBackbone(element);
57333      if (element.hasNameElement()) {
57334        composeStringCore("name", element.getNameElement(), false);
57335        composeStringExtras("name", element.getNameElement(), false);
57336      }
57337      if (element.hasDescriptionElement()) {
57338        composeStringCore("description", element.getDescriptionElement(), false);
57339        composeStringExtras("description", element.getDescriptionElement(), false);
57340      }
57341      if (element.hasAction()) {
57342        openArray("action");
57343        for (TestReport.TestActionComponent e : element.getAction()) 
57344          composeTestReportTestActionComponent(null, e);
57345        closeArray();
57346      };
57347  }
57348
57349  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
57350    if (element != null) {
57351      open(name);
57352      composeTestReportTestActionComponentInner(element);
57353      close();
57354    }
57355  }
57356
57357  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
57358      composeBackbone(element);
57359      if (element.hasOperation()) {
57360        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
57361      }
57362      if (element.hasAssert()) {
57363        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
57364      }
57365  }
57366
57367  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
57368    if (element != null) {
57369      open(name);
57370      composeTestReportTestReportTeardownComponentInner(element);
57371      close();
57372    }
57373  }
57374
57375  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element) throws IOException {
57376      composeBackbone(element);
57377      if (element.hasAction()) {
57378        openArray("action");
57379        for (TestReport.TeardownActionComponent e : element.getAction()) 
57380          composeTestReportTeardownActionComponent(null, e);
57381        closeArray();
57382      };
57383  }
57384
57385  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
57386    if (element != null) {
57387      open(name);
57388      composeTestReportTeardownActionComponentInner(element);
57389      close();
57390    }
57391  }
57392
57393  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element) throws IOException {
57394      composeBackbone(element);
57395      if (element.hasOperation()) {
57396        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
57397      }
57398  }
57399
57400  protected void composeTestScript(String name, TestScript element) throws IOException {
57401    if (element != null) {
57402      prop("resourceType", name);
57403      composeTestScriptInner(element);
57404    }
57405  }
57406
57407  protected void composeTestScriptInner(TestScript element) throws IOException {
57408      composeDomainResourceElements(element);
57409      if (element.hasUrlElement()) {
57410        composeUriCore("url", element.getUrlElement(), false);
57411        composeUriExtras("url", element.getUrlElement(), false);
57412      }
57413      if (element.hasIdentifier()) {
57414        composeIdentifier("identifier", element.getIdentifier());
57415      }
57416      if (element.hasVersionElement()) {
57417        composeStringCore("version", element.getVersionElement(), false);
57418        composeStringExtras("version", element.getVersionElement(), false);
57419      }
57420      if (element.hasNameElement()) {
57421        composeStringCore("name", element.getNameElement(), false);
57422        composeStringExtras("name", element.getNameElement(), false);
57423      }
57424      if (element.hasTitleElement()) {
57425        composeStringCore("title", element.getTitleElement(), false);
57426        composeStringExtras("title", element.getTitleElement(), false);
57427      }
57428      if (element.hasStatusElement()) {
57429        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57430        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57431      }
57432      if (element.hasExperimentalElement()) {
57433        composeBooleanCore("experimental", element.getExperimentalElement(), false);
57434        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
57435      }
57436      if (element.hasDateElement()) {
57437        composeDateTimeCore("date", element.getDateElement(), false);
57438        composeDateTimeExtras("date", element.getDateElement(), false);
57439      }
57440      if (element.hasPublisherElement()) {
57441        composeStringCore("publisher", element.getPublisherElement(), false);
57442        composeStringExtras("publisher", element.getPublisherElement(), false);
57443      }
57444      if (element.hasContact()) {
57445        openArray("contact");
57446        for (ContactDetail e : element.getContact()) 
57447          composeContactDetail(null, e);
57448        closeArray();
57449      };
57450      if (element.hasDescriptionElement()) {
57451        composeMarkdownCore("description", element.getDescriptionElement(), false);
57452        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57453      }
57454      if (element.hasUseContext()) {
57455        openArray("useContext");
57456        for (UsageContext e : element.getUseContext()) 
57457          composeUsageContext(null, e);
57458        closeArray();
57459      };
57460      if (element.hasJurisdiction()) {
57461        openArray("jurisdiction");
57462        for (CodeableConcept e : element.getJurisdiction()) 
57463          composeCodeableConcept(null, e);
57464        closeArray();
57465      };
57466      if (element.hasPurposeElement()) {
57467        composeMarkdownCore("purpose", element.getPurposeElement(), false);
57468        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
57469      }
57470      if (element.hasCopyrightElement()) {
57471        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
57472        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
57473      }
57474      if (element.hasOrigin()) {
57475        openArray("origin");
57476        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
57477          composeTestScriptTestScriptOriginComponent(null, e);
57478        closeArray();
57479      };
57480      if (element.hasDestination()) {
57481        openArray("destination");
57482        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
57483          composeTestScriptTestScriptDestinationComponent(null, e);
57484        closeArray();
57485      };
57486      if (element.hasMetadata()) {
57487        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
57488      }
57489      if (element.hasFixture()) {
57490        openArray("fixture");
57491        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
57492          composeTestScriptTestScriptFixtureComponent(null, e);
57493        closeArray();
57494      };
57495      if (element.hasProfile()) {
57496        openArray("profile");
57497        for (Reference e : element.getProfile()) 
57498          composeReference(null, e);
57499        closeArray();
57500      };
57501      if (element.hasVariable()) {
57502        openArray("variable");
57503        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
57504          composeTestScriptTestScriptVariableComponent(null, e);
57505        closeArray();
57506      };
57507      if (element.hasSetup()) {
57508        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
57509      }
57510      if (element.hasTest()) {
57511        openArray("test");
57512        for (TestScript.TestScriptTestComponent e : element.getTest()) 
57513          composeTestScriptTestScriptTestComponent(null, e);
57514        closeArray();
57515      };
57516      if (element.hasTeardown()) {
57517        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
57518      }
57519  }
57520
57521  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
57522    if (element != null) {
57523      open(name);
57524      composeTestScriptTestScriptOriginComponentInner(element);
57525      close();
57526    }
57527  }
57528
57529  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
57530      composeBackbone(element);
57531      if (element.hasIndexElement()) {
57532        composeIntegerCore("index", element.getIndexElement(), false);
57533        composeIntegerExtras("index", element.getIndexElement(), false);
57534      }
57535      if (element.hasProfile()) {
57536        composeCoding("profile", element.getProfile());
57537      }
57538  }
57539
57540  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
57541    if (element != null) {
57542      open(name);
57543      composeTestScriptTestScriptDestinationComponentInner(element);
57544      close();
57545    }
57546  }
57547
57548  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
57549      composeBackbone(element);
57550      if (element.hasIndexElement()) {
57551        composeIntegerCore("index", element.getIndexElement(), false);
57552        composeIntegerExtras("index", element.getIndexElement(), false);
57553      }
57554      if (element.hasProfile()) {
57555        composeCoding("profile", element.getProfile());
57556      }
57557  }
57558
57559  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
57560    if (element != null) {
57561      open(name);
57562      composeTestScriptTestScriptMetadataComponentInner(element);
57563      close();
57564    }
57565  }
57566
57567  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
57568      composeBackbone(element);
57569      if (element.hasLink()) {
57570        openArray("link");
57571        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
57572          composeTestScriptTestScriptMetadataLinkComponent(null, e);
57573        closeArray();
57574      };
57575      if (element.hasCapability()) {
57576        openArray("capability");
57577        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
57578          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
57579        closeArray();
57580      };
57581  }
57582
57583  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
57584    if (element != null) {
57585      open(name);
57586      composeTestScriptTestScriptMetadataLinkComponentInner(element);
57587      close();
57588    }
57589  }
57590
57591  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
57592      composeBackbone(element);
57593      if (element.hasUrlElement()) {
57594        composeUriCore("url", element.getUrlElement(), false);
57595        composeUriExtras("url", element.getUrlElement(), false);
57596      }
57597      if (element.hasDescriptionElement()) {
57598        composeStringCore("description", element.getDescriptionElement(), false);
57599        composeStringExtras("description", element.getDescriptionElement(), false);
57600      }
57601  }
57602
57603  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
57604    if (element != null) {
57605      open(name);
57606      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
57607      close();
57608    }
57609  }
57610
57611  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
57612      composeBackbone(element);
57613      if (element.hasRequiredElement()) {
57614        composeBooleanCore("required", element.getRequiredElement(), false);
57615        composeBooleanExtras("required", element.getRequiredElement(), false);
57616      }
57617      if (element.hasValidatedElement()) {
57618        composeBooleanCore("validated", element.getValidatedElement(), false);
57619        composeBooleanExtras("validated", element.getValidatedElement(), false);
57620      }
57621      if (element.hasDescriptionElement()) {
57622        composeStringCore("description", element.getDescriptionElement(), false);
57623        composeStringExtras("description", element.getDescriptionElement(), false);
57624      }
57625      if (element.hasOrigin()) {
57626        openArray("origin");
57627        for (IntegerType e : element.getOrigin()) 
57628          composeIntegerCore(null, e, true);
57629        closeArray();
57630        if (anyHasExtras(element.getOrigin())) {
57631          openArray("_origin");
57632          for (IntegerType e : element.getOrigin()) 
57633            composeIntegerExtras(null, e, true);
57634          closeArray();
57635        }
57636      };
57637      if (element.hasDestinationElement()) {
57638        composeIntegerCore("destination", element.getDestinationElement(), false);
57639        composeIntegerExtras("destination", element.getDestinationElement(), false);
57640      }
57641      if (element.hasLink()) {
57642        openArray("link");
57643        for (UriType e : element.getLink()) 
57644          composeUriCore(null, e, true);
57645        closeArray();
57646        if (anyHasExtras(element.getLink())) {
57647          openArray("_link");
57648          for (UriType e : element.getLink()) 
57649            composeUriExtras(null, e, true);
57650          closeArray();
57651        }
57652      };
57653      if (element.hasCapabilitiesElement()) {
57654        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
57655        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
57656      }
57657  }
57658
57659  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
57660    if (element != null) {
57661      open(name);
57662      composeTestScriptTestScriptFixtureComponentInner(element);
57663      close();
57664    }
57665  }
57666
57667  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
57668      composeBackbone(element);
57669      if (element.hasAutocreateElement()) {
57670        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
57671        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
57672      }
57673      if (element.hasAutodeleteElement()) {
57674        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
57675        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
57676      }
57677      if (element.hasResource()) {
57678        composeReference("resource", element.getResource());
57679      }
57680  }
57681
57682  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
57683    if (element != null) {
57684      open(name);
57685      composeTestScriptTestScriptVariableComponentInner(element);
57686      close();
57687    }
57688  }
57689
57690  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
57691      composeBackbone(element);
57692      if (element.hasNameElement()) {
57693        composeStringCore("name", element.getNameElement(), false);
57694        composeStringExtras("name", element.getNameElement(), false);
57695      }
57696      if (element.hasDefaultValueElement()) {
57697        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
57698        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
57699      }
57700      if (element.hasDescriptionElement()) {
57701        composeStringCore("description", element.getDescriptionElement(), false);
57702        composeStringExtras("description", element.getDescriptionElement(), false);
57703      }
57704      if (element.hasExpressionElement()) {
57705        composeStringCore("expression", element.getExpressionElement(), false);
57706        composeStringExtras("expression", element.getExpressionElement(), false);
57707      }
57708      if (element.hasHeaderFieldElement()) {
57709        composeStringCore("headerField", element.getHeaderFieldElement(), false);
57710        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
57711      }
57712      if (element.hasHintElement()) {
57713        composeStringCore("hint", element.getHintElement(), false);
57714        composeStringExtras("hint", element.getHintElement(), false);
57715      }
57716      if (element.hasPathElement()) {
57717        composeStringCore("path", element.getPathElement(), false);
57718        composeStringExtras("path", element.getPathElement(), false);
57719      }
57720      if (element.hasSourceIdElement()) {
57721        composeIdCore("sourceId", element.getSourceIdElement(), false);
57722        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57723      }
57724  }
57725
57726  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
57727    if (element != null) {
57728      open(name);
57729      composeTestScriptTestScriptSetupComponentInner(element);
57730      close();
57731    }
57732  }
57733
57734  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
57735      composeBackbone(element);
57736      if (element.hasAction()) {
57737        openArray("action");
57738        for (TestScript.SetupActionComponent e : element.getAction()) 
57739          composeTestScriptSetupActionComponent(null, e);
57740        closeArray();
57741      };
57742  }
57743
57744  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
57745    if (element != null) {
57746      open(name);
57747      composeTestScriptSetupActionComponentInner(element);
57748      close();
57749    }
57750  }
57751
57752  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
57753      composeBackbone(element);
57754      if (element.hasOperation()) {
57755        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
57756      }
57757      if (element.hasAssert()) {
57758        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
57759      }
57760  }
57761
57762  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
57763    if (element != null) {
57764      open(name);
57765      composeTestScriptSetupActionOperationComponentInner(element);
57766      close();
57767    }
57768  }
57769
57770  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
57771      composeBackbone(element);
57772      if (element.hasType()) {
57773        composeCoding("type", element.getType());
57774      }
57775      if (element.hasResourceElement()) {
57776        composeCodeCore("resource", element.getResourceElement(), false);
57777        composeCodeExtras("resource", element.getResourceElement(), false);
57778      }
57779      if (element.hasLabelElement()) {
57780        composeStringCore("label", element.getLabelElement(), false);
57781        composeStringExtras("label", element.getLabelElement(), false);
57782      }
57783      if (element.hasDescriptionElement()) {
57784        composeStringCore("description", element.getDescriptionElement(), false);
57785        composeStringExtras("description", element.getDescriptionElement(), false);
57786      }
57787      if (element.hasAcceptElement()) {
57788        composeCodeCore("accept", element.getAcceptElement(), false);
57789        composeCodeExtras("accept", element.getAcceptElement(), false);
57790      }
57791      if (element.hasContentTypeElement()) {
57792        composeCodeCore("contentType", element.getContentTypeElement(), false);
57793        composeCodeExtras("contentType", element.getContentTypeElement(), false);
57794      }
57795      if (element.hasDestinationElement()) {
57796        composeIntegerCore("destination", element.getDestinationElement(), false);
57797        composeIntegerExtras("destination", element.getDestinationElement(), false);
57798      }
57799      if (element.hasEncodeRequestUrlElement()) {
57800        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
57801        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
57802      }
57803      if (element.hasMethodElement()) {
57804        composeEnumerationCore("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57805        composeEnumerationExtras("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57806      }
57807      if (element.hasOriginElement()) {
57808        composeIntegerCore("origin", element.getOriginElement(), false);
57809        composeIntegerExtras("origin", element.getOriginElement(), false);
57810      }
57811      if (element.hasParamsElement()) {
57812        composeStringCore("params", element.getParamsElement(), false);
57813        composeStringExtras("params", element.getParamsElement(), false);
57814      }
57815      if (element.hasRequestHeader()) {
57816        openArray("requestHeader");
57817        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
57818          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
57819        closeArray();
57820      };
57821      if (element.hasRequestIdElement()) {
57822        composeIdCore("requestId", element.getRequestIdElement(), false);
57823        composeIdExtras("requestId", element.getRequestIdElement(), false);
57824      }
57825      if (element.hasResponseIdElement()) {
57826        composeIdCore("responseId", element.getResponseIdElement(), false);
57827        composeIdExtras("responseId", element.getResponseIdElement(), false);
57828      }
57829      if (element.hasSourceIdElement()) {
57830        composeIdCore("sourceId", element.getSourceIdElement(), false);
57831        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57832      }
57833      if (element.hasTargetIdElement()) {
57834        composeIdCore("targetId", element.getTargetIdElement(), false);
57835        composeIdExtras("targetId", element.getTargetIdElement(), false);
57836      }
57837      if (element.hasUrlElement()) {
57838        composeStringCore("url", element.getUrlElement(), false);
57839        composeStringExtras("url", element.getUrlElement(), false);
57840      }
57841  }
57842
57843  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
57844    if (element != null) {
57845      open(name);
57846      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
57847      close();
57848    }
57849  }
57850
57851  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
57852      composeBackbone(element);
57853      if (element.hasFieldElement()) {
57854        composeStringCore("field", element.getFieldElement(), false);
57855        composeStringExtras("field", element.getFieldElement(), false);
57856      }
57857      if (element.hasValueElement()) {
57858        composeStringCore("value", element.getValueElement(), false);
57859        composeStringExtras("value", element.getValueElement(), false);
57860      }
57861  }
57862
57863  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
57864    if (element != null) {
57865      open(name);
57866      composeTestScriptSetupActionAssertComponentInner(element);
57867      close();
57868    }
57869  }
57870
57871  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
57872      composeBackbone(element);
57873      if (element.hasLabelElement()) {
57874        composeStringCore("label", element.getLabelElement(), false);
57875        composeStringExtras("label", element.getLabelElement(), false);
57876      }
57877      if (element.hasDescriptionElement()) {
57878        composeStringCore("description", element.getDescriptionElement(), false);
57879        composeStringExtras("description", element.getDescriptionElement(), false);
57880      }
57881      if (element.hasDirectionElement()) {
57882        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
57883        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
57884      }
57885      if (element.hasCompareToSourceIdElement()) {
57886        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
57887        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
57888      }
57889      if (element.hasCompareToSourceExpressionElement()) {
57890        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
57891        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
57892      }
57893      if (element.hasCompareToSourcePathElement()) {
57894        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
57895        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
57896      }
57897      if (element.hasContentTypeElement()) {
57898        composeCodeCore("contentType", element.getContentTypeElement(), false);
57899        composeCodeExtras("contentType", element.getContentTypeElement(), false);
57900      }
57901      if (element.hasExpressionElement()) {
57902        composeStringCore("expression", element.getExpressionElement(), false);
57903        composeStringExtras("expression", element.getExpressionElement(), false);
57904      }
57905      if (element.hasHeaderFieldElement()) {
57906        composeStringCore("headerField", element.getHeaderFieldElement(), false);
57907        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
57908      }
57909      if (element.hasMinimumIdElement()) {
57910        composeStringCore("minimumId", element.getMinimumIdElement(), false);
57911        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
57912      }
57913      if (element.hasNavigationLinksElement()) {
57914        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
57915        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
57916      }
57917      if (element.hasOperatorElement()) {
57918        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
57919        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
57920      }
57921      if (element.hasPathElement()) {
57922        composeStringCore("path", element.getPathElement(), false);
57923        composeStringExtras("path", element.getPathElement(), false);
57924      }
57925      if (element.hasRequestMethodElement()) {
57926        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57927        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57928      }
57929      if (element.hasRequestURLElement()) {
57930        composeStringCore("requestURL", element.getRequestURLElement(), false);
57931        composeStringExtras("requestURL", element.getRequestURLElement(), false);
57932      }
57933      if (element.hasResourceElement()) {
57934        composeCodeCore("resource", element.getResourceElement(), false);
57935        composeCodeExtras("resource", element.getResourceElement(), false);
57936      }
57937      if (element.hasResponseElement()) {
57938        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
57939        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
57940      }
57941      if (element.hasResponseCodeElement()) {
57942        composeStringCore("responseCode", element.getResponseCodeElement(), false);
57943        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
57944      }
57945      if (element.hasSourceIdElement()) {
57946        composeIdCore("sourceId", element.getSourceIdElement(), false);
57947        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57948      }
57949      if (element.hasValidateProfileIdElement()) {
57950        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
57951        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
57952      }
57953      if (element.hasValueElement()) {
57954        composeStringCore("value", element.getValueElement(), false);
57955        composeStringExtras("value", element.getValueElement(), false);
57956      }
57957      if (element.hasWarningOnlyElement()) {
57958        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
57959        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
57960      }
57961  }
57962
57963  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
57964    if (element != null) {
57965      open(name);
57966      composeTestScriptTestScriptTestComponentInner(element);
57967      close();
57968    }
57969  }
57970
57971  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
57972      composeBackbone(element);
57973      if (element.hasNameElement()) {
57974        composeStringCore("name", element.getNameElement(), false);
57975        composeStringExtras("name", element.getNameElement(), false);
57976      }
57977      if (element.hasDescriptionElement()) {
57978        composeStringCore("description", element.getDescriptionElement(), false);
57979        composeStringExtras("description", element.getDescriptionElement(), false);
57980      }
57981      if (element.hasAction()) {
57982        openArray("action");
57983        for (TestScript.TestActionComponent e : element.getAction()) 
57984          composeTestScriptTestActionComponent(null, e);
57985        closeArray();
57986      };
57987  }
57988
57989  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
57990    if (element != null) {
57991      open(name);
57992      composeTestScriptTestActionComponentInner(element);
57993      close();
57994    }
57995  }
57996
57997  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
57998      composeBackbone(element);
57999      if (element.hasOperation()) {
58000        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
58001      }
58002      if (element.hasAssert()) {
58003        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
58004      }
58005  }
58006
58007  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
58008    if (element != null) {
58009      open(name);
58010      composeTestScriptTestScriptTeardownComponentInner(element);
58011      close();
58012    }
58013  }
58014
58015  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
58016      composeBackbone(element);
58017      if (element.hasAction()) {
58018        openArray("action");
58019        for (TestScript.TeardownActionComponent e : element.getAction()) 
58020          composeTestScriptTeardownActionComponent(null, e);
58021        closeArray();
58022      };
58023  }
58024
58025  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
58026    if (element != null) {
58027      open(name);
58028      composeTestScriptTeardownActionComponentInner(element);
58029      close();
58030    }
58031  }
58032
58033  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
58034      composeBackbone(element);
58035      if (element.hasOperation()) {
58036        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
58037      }
58038  }
58039
58040  protected void composeValueSet(String name, ValueSet element) throws IOException {
58041    if (element != null) {
58042      prop("resourceType", name);
58043      composeValueSetInner(element);
58044    }
58045  }
58046
58047  protected void composeValueSetInner(ValueSet element) throws IOException {
58048      composeDomainResourceElements(element);
58049      if (element.hasUrlElement()) {
58050        composeUriCore("url", element.getUrlElement(), false);
58051        composeUriExtras("url", element.getUrlElement(), false);
58052      }
58053      if (element.hasIdentifier()) {
58054        openArray("identifier");
58055        for (Identifier e : element.getIdentifier()) 
58056          composeIdentifier(null, e);
58057        closeArray();
58058      };
58059      if (element.hasVersionElement()) {
58060        composeStringCore("version", element.getVersionElement(), false);
58061        composeStringExtras("version", element.getVersionElement(), false);
58062      }
58063      if (element.hasNameElement()) {
58064        composeStringCore("name", element.getNameElement(), false);
58065        composeStringExtras("name", element.getNameElement(), false);
58066      }
58067      if (element.hasTitleElement()) {
58068        composeStringCore("title", element.getTitleElement(), false);
58069        composeStringExtras("title", element.getTitleElement(), false);
58070      }
58071      if (element.hasStatusElement()) {
58072        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58073        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
58074      }
58075      if (element.hasExperimentalElement()) {
58076        composeBooleanCore("experimental", element.getExperimentalElement(), false);
58077        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
58078      }
58079      if (element.hasDateElement()) {
58080        composeDateTimeCore("date", element.getDateElement(), false);
58081        composeDateTimeExtras("date", element.getDateElement(), false);
58082      }
58083      if (element.hasPublisherElement()) {
58084        composeStringCore("publisher", element.getPublisherElement(), false);
58085        composeStringExtras("publisher", element.getPublisherElement(), false);
58086      }
58087      if (element.hasContact()) {
58088        openArray("contact");
58089        for (ContactDetail e : element.getContact()) 
58090          composeContactDetail(null, e);
58091        closeArray();
58092      };
58093      if (element.hasDescriptionElement()) {
58094        composeMarkdownCore("description", element.getDescriptionElement(), false);
58095        composeMarkdownExtras("description", element.getDescriptionElement(), false);
58096      }
58097      if (element.hasUseContext()) {
58098        openArray("useContext");
58099        for (UsageContext e : element.getUseContext()) 
58100          composeUsageContext(null, e);
58101        closeArray();
58102      };
58103      if (element.hasJurisdiction()) {
58104        openArray("jurisdiction");
58105        for (CodeableConcept e : element.getJurisdiction()) 
58106          composeCodeableConcept(null, e);
58107        closeArray();
58108      };
58109      if (element.hasImmutableElement()) {
58110        composeBooleanCore("immutable", element.getImmutableElement(), false);
58111        composeBooleanExtras("immutable", element.getImmutableElement(), false);
58112      }
58113      if (element.hasPurposeElement()) {
58114        composeMarkdownCore("purpose", element.getPurposeElement(), false);
58115        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
58116      }
58117      if (element.hasCopyrightElement()) {
58118        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
58119        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
58120      }
58121      if (element.hasCompose()) {
58122        composeValueSetValueSetComposeComponent("compose", element.getCompose());
58123      }
58124      if (element.hasExpansion()) {
58125        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
58126      }
58127  }
58128
58129  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
58130    if (element != null) {
58131      open(name);
58132      composeValueSetValueSetComposeComponentInner(element);
58133      close();
58134    }
58135  }
58136
58137  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
58138      composeBackbone(element);
58139      if (element.hasLockedDateElement()) {
58140        composeDateCore("lockedDate", element.getLockedDateElement(), false);
58141        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
58142      }
58143      if (element.hasInactiveElement()) {
58144        composeBooleanCore("inactive", element.getInactiveElement(), false);
58145        composeBooleanExtras("inactive", element.getInactiveElement(), false);
58146      }
58147      if (element.hasInclude()) {
58148        openArray("include");
58149        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
58150          composeValueSetConceptSetComponent(null, e);
58151        closeArray();
58152      };
58153      if (element.hasExclude()) {
58154        openArray("exclude");
58155        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
58156          composeValueSetConceptSetComponent(null, e);
58157        closeArray();
58158      };
58159  }
58160
58161  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
58162    if (element != null) {
58163      open(name);
58164      composeValueSetConceptSetComponentInner(element);
58165      close();
58166    }
58167  }
58168
58169  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
58170      composeBackbone(element);
58171      if (element.hasSystemElement()) {
58172        composeUriCore("system", element.getSystemElement(), false);
58173        composeUriExtras("system", element.getSystemElement(), false);
58174      }
58175      if (element.hasVersionElement()) {
58176        composeStringCore("version", element.getVersionElement(), false);
58177        composeStringExtras("version", element.getVersionElement(), false);
58178      }
58179      if (element.hasConcept()) {
58180        openArray("concept");
58181        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
58182          composeValueSetConceptReferenceComponent(null, e);
58183        closeArray();
58184      };
58185      if (element.hasFilter()) {
58186        openArray("filter");
58187        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
58188          composeValueSetConceptSetFilterComponent(null, e);
58189        closeArray();
58190      };
58191      if (element.hasValueSet()) {
58192        openArray("valueSet");
58193        for (CanonicalType e : element.getValueSet()) 
58194          composeCanonicalCore(null, e, true);
58195        closeArray();
58196        if (anyHasExtras(element.getValueSet())) {
58197          openArray("_valueSet");
58198          for (CanonicalType e : element.getValueSet()) 
58199            composeCanonicalExtras(null, e, true);
58200          closeArray();
58201        }
58202      };
58203  }
58204
58205  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
58206    if (element != null) {
58207      open(name);
58208      composeValueSetConceptReferenceComponentInner(element);
58209      close();
58210    }
58211  }
58212
58213  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
58214      composeBackbone(element);
58215      if (element.hasCodeElement()) {
58216        composeCodeCore("code", element.getCodeElement(), false);
58217        composeCodeExtras("code", element.getCodeElement(), false);
58218      }
58219      if (element.hasDisplayElement()) {
58220        composeStringCore("display", element.getDisplayElement(), false);
58221        composeStringExtras("display", element.getDisplayElement(), false);
58222      }
58223      if (element.hasDesignation()) {
58224        openArray("designation");
58225        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
58226          composeValueSetConceptReferenceDesignationComponent(null, e);
58227        closeArray();
58228      };
58229  }
58230
58231  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
58232    if (element != null) {
58233      open(name);
58234      composeValueSetConceptReferenceDesignationComponentInner(element);
58235      close();
58236    }
58237  }
58238
58239  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
58240      composeBackbone(element);
58241      if (element.hasLanguageElement()) {
58242        composeCodeCore("language", element.getLanguageElement(), false);
58243        composeCodeExtras("language", element.getLanguageElement(), false);
58244      }
58245      if (element.hasUse()) {
58246        composeCoding("use", element.getUse());
58247      }
58248      if (element.hasValueElement()) {
58249        composeStringCore("value", element.getValueElement(), false);
58250        composeStringExtras("value", element.getValueElement(), false);
58251      }
58252  }
58253
58254  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
58255    if (element != null) {
58256      open(name);
58257      composeValueSetConceptSetFilterComponentInner(element);
58258      close();
58259    }
58260  }
58261
58262  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
58263      composeBackbone(element);
58264      if (element.hasPropertyElement()) {
58265        composeCodeCore("property", element.getPropertyElement(), false);
58266        composeCodeExtras("property", element.getPropertyElement(), false);
58267      }
58268      if (element.hasOpElement()) {
58269        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
58270        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
58271      }
58272      if (element.hasValueElement()) {
58273        composeStringCore("value", element.getValueElement(), false);
58274        composeStringExtras("value", element.getValueElement(), false);
58275      }
58276  }
58277
58278  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
58279    if (element != null) {
58280      open(name);
58281      composeValueSetValueSetExpansionComponentInner(element);
58282      close();
58283    }
58284  }
58285
58286  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
58287      composeBackbone(element);
58288      if (element.hasIdentifierElement()) {
58289        composeUriCore("identifier", element.getIdentifierElement(), false);
58290        composeUriExtras("identifier", element.getIdentifierElement(), false);
58291      }
58292      if (element.hasTimestampElement()) {
58293        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
58294        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
58295      }
58296      if (element.hasTotalElement()) {
58297        composeIntegerCore("total", element.getTotalElement(), false);
58298        composeIntegerExtras("total", element.getTotalElement(), false);
58299      }
58300      if (element.hasOffsetElement()) {
58301        composeIntegerCore("offset", element.getOffsetElement(), false);
58302        composeIntegerExtras("offset", element.getOffsetElement(), false);
58303      }
58304      if (element.hasParameter()) {
58305        openArray("parameter");
58306        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
58307          composeValueSetValueSetExpansionParameterComponent(null, e);
58308        closeArray();
58309      };
58310      if (element.hasContains()) {
58311        openArray("contains");
58312        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
58313          composeValueSetValueSetExpansionContainsComponent(null, e);
58314        closeArray();
58315      };
58316  }
58317
58318  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
58319    if (element != null) {
58320      open(name);
58321      composeValueSetValueSetExpansionParameterComponentInner(element);
58322      close();
58323    }
58324  }
58325
58326  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
58327      composeBackbone(element);
58328      if (element.hasNameElement()) {
58329        composeStringCore("name", element.getNameElement(), false);
58330        composeStringExtras("name", element.getNameElement(), false);
58331      }
58332      if (element.hasValue()) {
58333        composeType("value", element.getValue());
58334      }
58335  }
58336
58337  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
58338    if (element != null) {
58339      open(name);
58340      composeValueSetValueSetExpansionContainsComponentInner(element);
58341      close();
58342    }
58343  }
58344
58345  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
58346      composeBackbone(element);
58347      if (element.hasSystemElement()) {
58348        composeUriCore("system", element.getSystemElement(), false);
58349        composeUriExtras("system", element.getSystemElement(), false);
58350      }
58351      if (element.hasAbstractElement()) {
58352        composeBooleanCore("abstract", element.getAbstractElement(), false);
58353        composeBooleanExtras("abstract", element.getAbstractElement(), false);
58354      }
58355      if (element.hasInactiveElement()) {
58356        composeBooleanCore("inactive", element.getInactiveElement(), false);
58357        composeBooleanExtras("inactive", element.getInactiveElement(), false);
58358      }
58359      if (element.hasVersionElement()) {
58360        composeStringCore("version", element.getVersionElement(), false);
58361        composeStringExtras("version", element.getVersionElement(), false);
58362      }
58363      if (element.hasCodeElement()) {
58364        composeCodeCore("code", element.getCodeElement(), false);
58365        composeCodeExtras("code", element.getCodeElement(), false);
58366      }
58367      if (element.hasDisplayElement()) {
58368        composeStringCore("display", element.getDisplayElement(), false);
58369        composeStringExtras("display", element.getDisplayElement(), false);
58370      }
58371      if (element.hasDesignation()) {
58372        openArray("designation");
58373        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
58374          composeValueSetConceptReferenceDesignationComponent(null, e);
58375        closeArray();
58376      };
58377      if (element.hasContains()) {
58378        openArray("contains");
58379        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
58380          composeValueSetValueSetExpansionContainsComponent(null, e);
58381        closeArray();
58382      };
58383  }
58384
58385  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
58386    if (element != null) {
58387      prop("resourceType", name);
58388      composeVerificationResultInner(element);
58389    }
58390  }
58391
58392  protected void composeVerificationResultInner(VerificationResult element) throws IOException {
58393      composeDomainResourceElements(element);
58394      if (element.hasTarget()) {
58395        openArray("target");
58396        for (Reference e : element.getTarget()) 
58397          composeReference(null, e);
58398        closeArray();
58399      };
58400      if (element.hasTargetLocation()) {
58401        openArray("targetLocation");
58402        for (StringType e : element.getTargetLocation()) 
58403          composeStringCore(null, e, true);
58404        closeArray();
58405        if (anyHasExtras(element.getTargetLocation())) {
58406          openArray("_targetLocation");
58407          for (StringType e : element.getTargetLocation()) 
58408            composeStringExtras(null, e, true);
58409          closeArray();
58410        }
58411      };
58412      if (element.hasNeed()) {
58413        composeCodeableConcept("need", element.getNeed());
58414      }
58415      if (element.hasStatusElement()) {
58416        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
58417        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
58418      }
58419      if (element.hasStatusDateElement()) {
58420        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
58421        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
58422      }
58423      if (element.hasValidationType()) {
58424        composeCodeableConcept("validationType", element.getValidationType());
58425      }
58426      if (element.hasValidationProcess()) {
58427        openArray("validationProcess");
58428        for (CodeableConcept e : element.getValidationProcess()) 
58429          composeCodeableConcept(null, e);
58430        closeArray();
58431      };
58432      if (element.hasFrequency()) {
58433        composeTiming("frequency", element.getFrequency());
58434      }
58435      if (element.hasLastPerformedElement()) {
58436        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
58437        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
58438      }
58439      if (element.hasNextScheduledElement()) {
58440        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
58441        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
58442      }
58443      if (element.hasFailureAction()) {
58444        composeCodeableConcept("failureAction", element.getFailureAction());
58445      }
58446      if (element.hasPrimarySource()) {
58447        openArray("primarySource");
58448        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
58449          composeVerificationResultVerificationResultPrimarySourceComponent(null, e);
58450        closeArray();
58451      };
58452      if (element.hasAttestation()) {
58453        composeVerificationResultVerificationResultAttestationComponent("attestation", element.getAttestation());
58454      }
58455      if (element.hasValidator()) {
58456        openArray("validator");
58457        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
58458          composeVerificationResultVerificationResultValidatorComponent(null, e);
58459        closeArray();
58460      };
58461  }
58462
58463  protected void composeVerificationResultVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
58464    if (element != null) {
58465      open(name);
58466      composeVerificationResultVerificationResultPrimarySourceComponentInner(element);
58467      close();
58468    }
58469  }
58470
58471  protected void composeVerificationResultVerificationResultPrimarySourceComponentInner(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
58472      composeBackbone(element);
58473      if (element.hasWho()) {
58474        composeReference("who", element.getWho());
58475      }
58476      if (element.hasType()) {
58477        openArray("type");
58478        for (CodeableConcept e : element.getType()) 
58479          composeCodeableConcept(null, e);
58480        closeArray();
58481      };
58482      if (element.hasCommunicationMethod()) {
58483        openArray("communicationMethod");
58484        for (CodeableConcept e : element.getCommunicationMethod()) 
58485          composeCodeableConcept(null, e);
58486        closeArray();
58487      };
58488      if (element.hasValidationStatus()) {
58489        composeCodeableConcept("validationStatus", element.getValidationStatus());
58490      }
58491      if (element.hasValidationDateElement()) {
58492        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
58493        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
58494      }
58495      if (element.hasCanPushUpdates()) {
58496        composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
58497      }
58498      if (element.hasPushTypeAvailable()) {
58499        openArray("pushTypeAvailable");
58500        for (CodeableConcept e : element.getPushTypeAvailable()) 
58501          composeCodeableConcept(null, e);
58502        closeArray();
58503      };
58504  }
58505
58506  protected void composeVerificationResultVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
58507    if (element != null) {
58508      open(name);
58509      composeVerificationResultVerificationResultAttestationComponentInner(element);
58510      close();
58511    }
58512  }
58513
58514  protected void composeVerificationResultVerificationResultAttestationComponentInner(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
58515      composeBackbone(element);
58516      if (element.hasWho()) {
58517        composeReference("who", element.getWho());
58518      }
58519      if (element.hasOnBehalfOf()) {
58520        composeReference("onBehalfOf", element.getOnBehalfOf());
58521      }
58522      if (element.hasCommunicationMethod()) {
58523        composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
58524      }
58525      if (element.hasDateElement()) {
58526        composeDateCore("date", element.getDateElement(), false);
58527        composeDateExtras("date", element.getDateElement(), false);
58528      }
58529      if (element.hasSourceIdentityCertificateElement()) {
58530        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
58531        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
58532      }
58533      if (element.hasProxyIdentityCertificateElement()) {
58534        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
58535        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
58536      }
58537      if (element.hasProxySignature()) {
58538        composeSignature("proxySignature", element.getProxySignature());
58539      }
58540      if (element.hasSourceSignature()) {
58541        composeSignature("sourceSignature", element.getSourceSignature());
58542      }
58543  }
58544
58545  protected void composeVerificationResultVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
58546    if (element != null) {
58547      open(name);
58548      composeVerificationResultVerificationResultValidatorComponentInner(element);
58549      close();
58550    }
58551  }
58552
58553  protected void composeVerificationResultVerificationResultValidatorComponentInner(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
58554      composeBackbone(element);
58555      if (element.hasOrganization()) {
58556        composeReference("organization", element.getOrganization());
58557      }
58558      if (element.hasIdentityCertificateElement()) {
58559        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
58560        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
58561      }
58562      if (element.hasAttestationSignature()) {
58563        composeSignature("attestationSignature", element.getAttestationSignature());
58564      }
58565  }
58566
58567  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
58568    if (element != null) {
58569      prop("resourceType", name);
58570      composeVisionPrescriptionInner(element);
58571    }
58572  }
58573
58574  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
58575      composeDomainResourceElements(element);
58576      if (element.hasIdentifier()) {
58577        openArray("identifier");
58578        for (Identifier e : element.getIdentifier()) 
58579          composeIdentifier(null, e);
58580        closeArray();
58581      };
58582      if (element.hasStatusElement()) {
58583        composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
58584        composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
58585      }
58586      if (element.hasCreatedElement()) {
58587        composeDateTimeCore("created", element.getCreatedElement(), false);
58588        composeDateTimeExtras("created", element.getCreatedElement(), false);
58589      }
58590      if (element.hasPatient()) {
58591        composeReference("patient", element.getPatient());
58592      }
58593      if (element.hasEncounter()) {
58594        composeReference("encounter", element.getEncounter());
58595      }
58596      if (element.hasDateWrittenElement()) {
58597        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
58598        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
58599      }
58600      if (element.hasPrescriber()) {
58601        composeReference("prescriber", element.getPrescriber());
58602      }
58603      if (element.hasLensSpecification()) {
58604        openArray("lensSpecification");
58605        for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification()) 
58606          composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(null, e);
58607        closeArray();
58608      };
58609  }
58610
58611  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(String name, VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
58612    if (element != null) {
58613      open(name);
58614      composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(element);
58615      close();
58616    }
58617  }
58618
58619  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
58620      composeBackbone(element);
58621      if (element.hasProduct()) {
58622        composeCodeableConcept("product", element.getProduct());
58623      }
58624      if (element.hasEyeElement()) {
58625        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
58626        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
58627      }
58628      if (element.hasSphereElement()) {
58629        composeDecimalCore("sphere", element.getSphereElement(), false);
58630        composeDecimalExtras("sphere", element.getSphereElement(), false);
58631      }
58632      if (element.hasCylinderElement()) {
58633        composeDecimalCore("cylinder", element.getCylinderElement(), false);
58634        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
58635      }
58636      if (element.hasAxisElement()) {
58637        composeIntegerCore("axis", element.getAxisElement(), false);
58638        composeIntegerExtras("axis", element.getAxisElement(), false);
58639      }
58640      if (element.hasPrism()) {
58641        openArray("prism");
58642        for (VisionPrescription.PrismComponent e : element.getPrism()) 
58643          composeVisionPrescriptionPrismComponent(null, e);
58644        closeArray();
58645      };
58646      if (element.hasAddElement()) {
58647        composeDecimalCore("add", element.getAddElement(), false);
58648        composeDecimalExtras("add", element.getAddElement(), false);
58649      }
58650      if (element.hasPowerElement()) {
58651        composeDecimalCore("power", element.getPowerElement(), false);
58652        composeDecimalExtras("power", element.getPowerElement(), false);
58653      }
58654      if (element.hasBackCurveElement()) {
58655        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
58656        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
58657      }
58658      if (element.hasDiameterElement()) {
58659        composeDecimalCore("diameter", element.getDiameterElement(), false);
58660        composeDecimalExtras("diameter", element.getDiameterElement(), false);
58661      }
58662      if (element.hasDuration()) {
58663        composeQuantity("duration", element.getDuration());
58664      }
58665      if (element.hasColorElement()) {
58666        composeStringCore("color", element.getColorElement(), false);
58667        composeStringExtras("color", element.getColorElement(), false);
58668      }
58669      if (element.hasBrandElement()) {
58670        composeStringCore("brand", element.getBrandElement(), false);
58671        composeStringExtras("brand", element.getBrandElement(), false);
58672      }
58673      if (element.hasNote()) {
58674        openArray("note");
58675        for (Annotation e : element.getNote()) 
58676          composeAnnotation(null, e);
58677        closeArray();
58678      };
58679  }
58680
58681  protected void composeVisionPrescriptionPrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
58682    if (element != null) {
58683      open(name);
58684      composeVisionPrescriptionPrismComponentInner(element);
58685      close();
58686    }
58687  }
58688
58689  protected void composeVisionPrescriptionPrismComponentInner(VisionPrescription.PrismComponent element) throws IOException {
58690      composeBackbone(element);
58691      if (element.hasAmountElement()) {
58692        composeDecimalCore("amount", element.getAmountElement(), false);
58693        composeDecimalExtras("amount", element.getAmountElement(), false);
58694      }
58695      if (element.hasBaseElement()) {
58696        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
58697        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
58698      }
58699  }
58700
58701  @Override
58702  protected void composeResource(Resource resource) throws IOException {
58703    if (resource instanceof Parameters)
58704      composeParameters("Parameters", (Parameters)resource);
58705    else if (resource instanceof Account)
58706      composeAccount("Account", (Account)resource);
58707    else if (resource instanceof ActivityDefinition)
58708      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
58709    else if (resource instanceof AdverseEvent)
58710      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
58711    else if (resource instanceof AllergyIntolerance)
58712      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
58713    else if (resource instanceof Appointment)
58714      composeAppointment("Appointment", (Appointment)resource);
58715    else if (resource instanceof AppointmentResponse)
58716      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
58717    else if (resource instanceof AuditEvent)
58718      composeAuditEvent("AuditEvent", (AuditEvent)resource);
58719    else if (resource instanceof Basic)
58720      composeBasic("Basic", (Basic)resource);
58721    else if (resource instanceof Binary)
58722      composeBinary("Binary", (Binary)resource);
58723    else if (resource instanceof BiologicallyDerivedProduct)
58724      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
58725    else if (resource instanceof BodyStructure)
58726      composeBodyStructure("BodyStructure", (BodyStructure)resource);
58727    else if (resource instanceof Bundle)
58728      composeBundle("Bundle", (Bundle)resource);
58729    else if (resource instanceof CapabilityStatement)
58730      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
58731    else if (resource instanceof CarePlan)
58732      composeCarePlan("CarePlan", (CarePlan)resource);
58733    else if (resource instanceof CareTeam)
58734      composeCareTeam("CareTeam", (CareTeam)resource);
58735    else if (resource instanceof CatalogEntry)
58736      composeCatalogEntry("CatalogEntry", (CatalogEntry)resource);
58737    else if (resource instanceof ChargeItem)
58738      composeChargeItem("ChargeItem", (ChargeItem)resource);
58739    else if (resource instanceof ChargeItemDefinition)
58740      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition)resource);
58741    else if (resource instanceof Claim)
58742      composeClaim("Claim", (Claim)resource);
58743    else if (resource instanceof ClaimResponse)
58744      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
58745    else if (resource instanceof ClinicalImpression)
58746      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
58747    else if (resource instanceof CodeSystem)
58748      composeCodeSystem("CodeSystem", (CodeSystem)resource);
58749    else if (resource instanceof Communication)
58750      composeCommunication("Communication", (Communication)resource);
58751    else if (resource instanceof CommunicationRequest)
58752      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
58753    else if (resource instanceof CompartmentDefinition)
58754      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
58755    else if (resource instanceof Composition)
58756      composeComposition("Composition", (Composition)resource);
58757    else if (resource instanceof ConceptMap)
58758      composeConceptMap("ConceptMap", (ConceptMap)resource);
58759    else if (resource instanceof Condition)
58760      composeCondition("Condition", (Condition)resource);
58761    else if (resource instanceof Consent)
58762      composeConsent("Consent", (Consent)resource);
58763    else if (resource instanceof Contract)
58764      composeContract("Contract", (Contract)resource);
58765    else if (resource instanceof Coverage)
58766      composeCoverage("Coverage", (Coverage)resource);
58767    else if (resource instanceof CoverageEligibilityRequest)
58768      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest)resource);
58769    else if (resource instanceof CoverageEligibilityResponse)
58770      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse)resource);
58771    else if (resource instanceof DetectedIssue)
58772      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
58773    else if (resource instanceof Device)
58774      composeDevice("Device", (Device)resource);
58775    else if (resource instanceof DeviceDefinition)
58776      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition)resource);
58777    else if (resource instanceof DeviceMetric)
58778      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
58779    else if (resource instanceof DeviceRequest)
58780      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
58781    else if (resource instanceof DeviceUseStatement)
58782      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
58783    else if (resource instanceof DiagnosticReport)
58784      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
58785    else if (resource instanceof DocumentManifest)
58786      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
58787    else if (resource instanceof DocumentReference)
58788      composeDocumentReference("DocumentReference", (DocumentReference)resource);
58789    else if (resource instanceof EffectEvidenceSynthesis)
58790      composeEffectEvidenceSynthesis("EffectEvidenceSynthesis", (EffectEvidenceSynthesis)resource);
58791    else if (resource instanceof Encounter)
58792      composeEncounter("Encounter", (Encounter)resource);
58793    else if (resource instanceof Endpoint)
58794      composeEndpoint("Endpoint", (Endpoint)resource);
58795    else if (resource instanceof EnrollmentRequest)
58796      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
58797    else if (resource instanceof EnrollmentResponse)
58798      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
58799    else if (resource instanceof EpisodeOfCare)
58800      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
58801    else if (resource instanceof EventDefinition)
58802      composeEventDefinition("EventDefinition", (EventDefinition)resource);
58803    else if (resource instanceof Evidence)
58804      composeEvidence("Evidence", (Evidence)resource);
58805    else if (resource instanceof EvidenceVariable)
58806      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable)resource);
58807    else if (resource instanceof ExampleScenario)
58808      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
58809    else if (resource instanceof ExplanationOfBenefit)
58810      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
58811    else if (resource instanceof FamilyMemberHistory)
58812      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
58813    else if (resource instanceof Flag)
58814      composeFlag("Flag", (Flag)resource);
58815    else if (resource instanceof Goal)
58816      composeGoal("Goal", (Goal)resource);
58817    else if (resource instanceof GraphDefinition)
58818      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
58819    else if (resource instanceof Group)
58820      composeGroup("Group", (Group)resource);
58821    else if (resource instanceof GuidanceResponse)
58822      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
58823    else if (resource instanceof HealthcareService)
58824      composeHealthcareService("HealthcareService", (HealthcareService)resource);
58825    else if (resource instanceof ImagingStudy)
58826      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
58827    else if (resource instanceof Immunization)
58828      composeImmunization("Immunization", (Immunization)resource);
58829    else if (resource instanceof ImmunizationEvaluation)
58830      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
58831    else if (resource instanceof ImmunizationRecommendation)
58832      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
58833    else if (resource instanceof ImplementationGuide)
58834      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
58835    else if (resource instanceof InsurancePlan)
58836      composeInsurancePlan("InsurancePlan", (InsurancePlan)resource);
58837    else if (resource instanceof Invoice)
58838      composeInvoice("Invoice", (Invoice)resource);
58839    else if (resource instanceof Library)
58840      composeLibrary("Library", (Library)resource);
58841    else if (resource instanceof Linkage)
58842      composeLinkage("Linkage", (Linkage)resource);
58843    else if (resource instanceof ListResource)
58844      composeListResource("List", (ListResource)resource);
58845    else if (resource instanceof Location)
58846      composeLocation("Location", (Location)resource);
58847    else if (resource instanceof Measure)
58848      composeMeasure("Measure", (Measure)resource);
58849    else if (resource instanceof MeasureReport)
58850      composeMeasureReport("MeasureReport", (MeasureReport)resource);
58851    else if (resource instanceof Media)
58852      composeMedia("Media", (Media)resource);
58853    else if (resource instanceof Medication)
58854      composeMedication("Medication", (Medication)resource);
58855    else if (resource instanceof MedicationAdministration)
58856      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
58857    else if (resource instanceof MedicationDispense)
58858      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
58859    else if (resource instanceof MedicationKnowledge)
58860      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
58861    else if (resource instanceof MedicationRequest)
58862      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
58863    else if (resource instanceof MedicationStatement)
58864      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
58865    else if (resource instanceof MedicinalProduct)
58866      composeMedicinalProduct("MedicinalProduct", (MedicinalProduct)resource);
58867    else if (resource instanceof MedicinalProductAuthorization)
58868      composeMedicinalProductAuthorization("MedicinalProductAuthorization", (MedicinalProductAuthorization)resource);
58869    else if (resource instanceof MedicinalProductContraindication)
58870      composeMedicinalProductContraindication("MedicinalProductContraindication", (MedicinalProductContraindication)resource);
58871    else if (resource instanceof MedicinalProductIndication)
58872      composeMedicinalProductIndication("MedicinalProductIndication", (MedicinalProductIndication)resource);
58873    else if (resource instanceof MedicinalProductIngredient)
58874      composeMedicinalProductIngredient("MedicinalProductIngredient", (MedicinalProductIngredient)resource);
58875    else if (resource instanceof MedicinalProductInteraction)
58876      composeMedicinalProductInteraction("MedicinalProductInteraction", (MedicinalProductInteraction)resource);
58877    else if (resource instanceof MedicinalProductManufactured)
58878      composeMedicinalProductManufactured("MedicinalProductManufactured", (MedicinalProductManufactured)resource);
58879    else if (resource instanceof MedicinalProductPackaged)
58880      composeMedicinalProductPackaged("MedicinalProductPackaged", (MedicinalProductPackaged)resource);
58881    else if (resource instanceof MedicinalProductPharmaceutical)
58882      composeMedicinalProductPharmaceutical("MedicinalProductPharmaceutical", (MedicinalProductPharmaceutical)resource);
58883    else if (resource instanceof MedicinalProductUndesirableEffect)
58884      composeMedicinalProductUndesirableEffect("MedicinalProductUndesirableEffect", (MedicinalProductUndesirableEffect)resource);
58885    else if (resource instanceof MessageDefinition)
58886      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
58887    else if (resource instanceof MessageHeader)
58888      composeMessageHeader("MessageHeader", (MessageHeader)resource);
58889    else if (resource instanceof MolecularSequence)
58890      composeMolecularSequence("MolecularSequence", (MolecularSequence)resource);
58891    else if (resource instanceof NamingSystem)
58892      composeNamingSystem("NamingSystem", (NamingSystem)resource);
58893    else if (resource instanceof NutritionOrder)
58894      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
58895    else if (resource instanceof Observation)
58896      composeObservation("Observation", (Observation)resource);
58897    else if (resource instanceof ObservationDefinition)
58898      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
58899    else if (resource instanceof OperationDefinition)
58900      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
58901    else if (resource instanceof OperationOutcome)
58902      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
58903    else if (resource instanceof Organization)
58904      composeOrganization("Organization", (Organization)resource);
58905    else if (resource instanceof OrganizationAffiliation)
58906      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation)resource);
58907    else if (resource instanceof Patient)
58908      composePatient("Patient", (Patient)resource);
58909    else if (resource instanceof PaymentNotice)
58910      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
58911    else if (resource instanceof PaymentReconciliation)
58912      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
58913    else if (resource instanceof Person)
58914      composePerson("Person", (Person)resource);
58915    else if (resource instanceof PlanDefinition)
58916      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
58917    else if (resource instanceof Practitioner)
58918      composePractitioner("Practitioner", (Practitioner)resource);
58919    else if (resource instanceof PractitionerRole)
58920      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
58921    else if (resource instanceof Procedure)
58922      composeProcedure("Procedure", (Procedure)resource);
58923    else if (resource instanceof Provenance)
58924      composeProvenance("Provenance", (Provenance)resource);
58925    else if (resource instanceof Questionnaire)
58926      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
58927    else if (resource instanceof QuestionnaireResponse)
58928      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
58929    else if (resource instanceof RelatedPerson)
58930      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
58931    else if (resource instanceof RequestGroup)
58932      composeRequestGroup("RequestGroup", (RequestGroup)resource);
58933    else if (resource instanceof ResearchDefinition)
58934      composeResearchDefinition("ResearchDefinition", (ResearchDefinition)resource);
58935    else if (resource instanceof ResearchElementDefinition)
58936      composeResearchElementDefinition("ResearchElementDefinition", (ResearchElementDefinition)resource);
58937    else if (resource instanceof ResearchStudy)
58938      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
58939    else if (resource instanceof ResearchSubject)
58940      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
58941    else if (resource instanceof RiskAssessment)
58942      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
58943    else if (resource instanceof RiskEvidenceSynthesis)
58944      composeRiskEvidenceSynthesis("RiskEvidenceSynthesis", (RiskEvidenceSynthesis)resource);
58945    else if (resource instanceof Schedule)
58946      composeSchedule("Schedule", (Schedule)resource);
58947    else if (resource instanceof SearchParameter)
58948      composeSearchParameter("SearchParameter", (SearchParameter)resource);
58949    else if (resource instanceof ServiceRequest)
58950      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
58951    else if (resource instanceof Slot)
58952      composeSlot("Slot", (Slot)resource);
58953    else if (resource instanceof Specimen)
58954      composeSpecimen("Specimen", (Specimen)resource);
58955    else if (resource instanceof SpecimenDefinition)
58956      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
58957    else if (resource instanceof StructureDefinition)
58958      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
58959    else if (resource instanceof StructureMap)
58960      composeStructureMap("StructureMap", (StructureMap)resource);
58961    else if (resource instanceof Subscription)
58962      composeSubscription("Subscription", (Subscription)resource);
58963    else if (resource instanceof Substance)
58964      composeSubstance("Substance", (Substance)resource);
58965    else if (resource instanceof SubstanceNucleicAcid)
58966      composeSubstanceNucleicAcid("SubstanceNucleicAcid", (SubstanceNucleicAcid)resource);
58967    else if (resource instanceof SubstancePolymer)
58968      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer)resource);
58969    else if (resource instanceof SubstanceProtein)
58970      composeSubstanceProtein("SubstanceProtein", (SubstanceProtein)resource);
58971    else if (resource instanceof SubstanceReferenceInformation)
58972      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation)resource);
58973    else if (resource instanceof SubstanceSourceMaterial)
58974      composeSubstanceSourceMaterial("SubstanceSourceMaterial", (SubstanceSourceMaterial)resource);
58975    else if (resource instanceof SubstanceSpecification)
58976      composeSubstanceSpecification("SubstanceSpecification", (SubstanceSpecification)resource);
58977    else if (resource instanceof SupplyDelivery)
58978      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
58979    else if (resource instanceof SupplyRequest)
58980      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
58981    else if (resource instanceof Task)
58982      composeTask("Task", (Task)resource);
58983    else if (resource instanceof TerminologyCapabilities)
58984      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
58985    else if (resource instanceof TestReport)
58986      composeTestReport("TestReport", (TestReport)resource);
58987    else if (resource instanceof TestScript)
58988      composeTestScript("TestScript", (TestScript)resource);
58989    else if (resource instanceof ValueSet)
58990      composeValueSet("ValueSet", (ValueSet)resource);
58991    else if (resource instanceof VerificationResult)
58992      composeVerificationResult("VerificationResult", (VerificationResult)resource);
58993    else if (resource instanceof VisionPrescription)
58994      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
58995    else if (resource instanceof Binary)
58996      composeBinary("Binary", (Binary)resource);
58997    else
58998      throw new Error("Unhandled resource type "+resource.getClass().getName());
58999  }
59000
59001  protected void composeNamedReference(String name, Resource resource) throws IOException {
59002    if (resource instanceof Parameters)
59003      composeParameters(name, (Parameters)resource);
59004    else if (resource instanceof Account)
59005      composeAccount(name, (Account)resource);
59006    else if (resource instanceof ActivityDefinition)
59007      composeActivityDefinition(name, (ActivityDefinition)resource);
59008    else if (resource instanceof AdverseEvent)
59009      composeAdverseEvent(name, (AdverseEvent)resource);
59010    else if (resource instanceof AllergyIntolerance)
59011      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
59012    else if (resource instanceof Appointment)
59013      composeAppointment(name, (Appointment)resource);
59014    else if (resource instanceof AppointmentResponse)
59015      composeAppointmentResponse(name, (AppointmentResponse)resource);
59016    else if (resource instanceof AuditEvent)
59017      composeAuditEvent(name, (AuditEvent)resource);
59018    else if (resource instanceof Basic)
59019      composeBasic(name, (Basic)resource);
59020    else if (resource instanceof Binary)
59021      composeBinary(name, (Binary)resource);
59022    else if (resource instanceof BiologicallyDerivedProduct)
59023      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
59024    else if (resource instanceof BodyStructure)
59025      composeBodyStructure(name, (BodyStructure)resource);
59026    else if (resource instanceof Bundle)
59027      composeBundle(name, (Bundle)resource);
59028    else if (resource instanceof CapabilityStatement)
59029      composeCapabilityStatement(name, (CapabilityStatement)resource);
59030    else if (resource instanceof CarePlan)
59031      composeCarePlan(name, (CarePlan)resource);
59032    else if (resource instanceof CareTeam)
59033      composeCareTeam(name, (CareTeam)resource);
59034    else if (resource instanceof CatalogEntry)
59035      composeCatalogEntry(name, (CatalogEntry)resource);
59036    else if (resource instanceof ChargeItem)
59037      composeChargeItem(name, (ChargeItem)resource);
59038    else if (resource instanceof ChargeItemDefinition)
59039      composeChargeItemDefinition(name, (ChargeItemDefinition)resource);
59040    else if (resource instanceof Claim)
59041      composeClaim(name, (Claim)resource);
59042    else if (resource instanceof ClaimResponse)
59043      composeClaimResponse(name, (ClaimResponse)resource);
59044    else if (resource instanceof ClinicalImpression)
59045      composeClinicalImpression(name, (ClinicalImpression)resource);
59046    else if (resource instanceof CodeSystem)
59047      composeCodeSystem(name, (CodeSystem)resource);
59048    else if (resource instanceof Communication)
59049      composeCommunication(name, (Communication)resource);
59050    else if (resource instanceof CommunicationRequest)
59051      composeCommunicationRequest(name, (CommunicationRequest)resource);
59052    else if (resource instanceof CompartmentDefinition)
59053      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
59054    else if (resource instanceof Composition)
59055      composeComposition(name, (Composition)resource);
59056    else if (resource instanceof ConceptMap)
59057      composeConceptMap(name, (ConceptMap)resource);
59058    else if (resource instanceof Condition)
59059      composeCondition(name, (Condition)resource);
59060    else if (resource instanceof Consent)
59061      composeConsent(name, (Consent)resource);
59062    else if (resource instanceof Contract)
59063      composeContract(name, (Contract)resource);
59064    else if (resource instanceof Coverage)
59065      composeCoverage(name, (Coverage)resource);
59066    else if (resource instanceof CoverageEligibilityRequest)
59067      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest)resource);
59068    else if (resource instanceof CoverageEligibilityResponse)
59069      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse)resource);
59070    else if (resource instanceof DetectedIssue)
59071      composeDetectedIssue(name, (DetectedIssue)resource);
59072    else if (resource instanceof Device)
59073      composeDevice(name, (Device)resource);
59074    else if (resource instanceof DeviceDefinition)
59075      composeDeviceDefinition(name, (DeviceDefinition)resource);
59076    else if (resource instanceof DeviceMetric)
59077      composeDeviceMetric(name, (DeviceMetric)resource);
59078    else if (resource instanceof DeviceRequest)
59079      composeDeviceRequest(name, (DeviceRequest)resource);
59080    else if (resource instanceof DeviceUseStatement)
59081      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
59082    else if (resource instanceof DiagnosticReport)
59083      composeDiagnosticReport(name, (DiagnosticReport)resource);
59084    else if (resource instanceof DocumentManifest)
59085      composeDocumentManifest(name, (DocumentManifest)resource);
59086    else if (resource instanceof DocumentReference)
59087      composeDocumentReference(name, (DocumentReference)resource);
59088    else if (resource instanceof EffectEvidenceSynthesis)
59089      composeEffectEvidenceSynthesis(name, (EffectEvidenceSynthesis)resource);
59090    else if (resource instanceof Encounter)
59091      composeEncounter(name, (Encounter)resource);
59092    else if (resource instanceof Endpoint)
59093      composeEndpoint(name, (Endpoint)resource);
59094    else if (resource instanceof EnrollmentRequest)
59095      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
59096    else if (resource instanceof EnrollmentResponse)
59097      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
59098    else if (resource instanceof EpisodeOfCare)
59099      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
59100    else if (resource instanceof EventDefinition)
59101      composeEventDefinition(name, (EventDefinition)resource);
59102    else if (resource instanceof Evidence)
59103      composeEvidence(name, (Evidence)resource);
59104    else if (resource instanceof EvidenceVariable)
59105      composeEvidenceVariable(name, (EvidenceVariable)resource);
59106    else if (resource instanceof ExampleScenario)
59107      composeExampleScenario(name, (ExampleScenario)resource);
59108    else if (resource instanceof ExplanationOfBenefit)
59109      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
59110    else if (resource instanceof FamilyMemberHistory)
59111      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
59112    else if (resource instanceof Flag)
59113      composeFlag(name, (Flag)resource);
59114    else if (resource instanceof Goal)
59115      composeGoal(name, (Goal)resource);
59116    else if (resource instanceof GraphDefinition)
59117      composeGraphDefinition(name, (GraphDefinition)resource);
59118    else if (resource instanceof Group)
59119      composeGroup(name, (Group)resource);
59120    else if (resource instanceof GuidanceResponse)
59121      composeGuidanceResponse(name, (GuidanceResponse)resource);
59122    else if (resource instanceof HealthcareService)
59123      composeHealthcareService(name, (HealthcareService)resource);
59124    else if (resource instanceof ImagingStudy)
59125      composeImagingStudy(name, (ImagingStudy)resource);
59126    else if (resource instanceof Immunization)
59127      composeImmunization(name, (Immunization)resource);
59128    else if (resource instanceof ImmunizationEvaluation)
59129      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
59130    else if (resource instanceof ImmunizationRecommendation)
59131      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
59132    else if (resource instanceof ImplementationGuide)
59133      composeImplementationGuide(name, (ImplementationGuide)resource);
59134    else if (resource instanceof InsurancePlan)
59135      composeInsurancePlan(name, (InsurancePlan)resource);
59136    else if (resource instanceof Invoice)
59137      composeInvoice(name, (Invoice)resource);
59138    else if (resource instanceof Library)
59139      composeLibrary(name, (Library)resource);
59140    else if (resource instanceof Linkage)
59141      composeLinkage(name, (Linkage)resource);
59142    else if (resource instanceof ListResource)
59143      composeListResource(name, (ListResource)resource);
59144    else if (resource instanceof Location)
59145      composeLocation(name, (Location)resource);
59146    else if (resource instanceof Measure)
59147      composeMeasure(name, (Measure)resource);
59148    else if (resource instanceof MeasureReport)
59149      composeMeasureReport(name, (MeasureReport)resource);
59150    else if (resource instanceof Media)
59151      composeMedia(name, (Media)resource);
59152    else if (resource instanceof Medication)
59153      composeMedication(name, (Medication)resource);
59154    else if (resource instanceof MedicationAdministration)
59155      composeMedicationAdministration(name, (MedicationAdministration)resource);
59156    else if (resource instanceof MedicationDispense)
59157      composeMedicationDispense(name, (MedicationDispense)resource);
59158    else if (resource instanceof MedicationKnowledge)
59159      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
59160    else if (resource instanceof MedicationRequest)
59161      composeMedicationRequest(name, (MedicationRequest)resource);
59162    else if (resource instanceof MedicationStatement)
59163      composeMedicationStatement(name, (MedicationStatement)resource);
59164    else if (resource instanceof MedicinalProduct)
59165      composeMedicinalProduct(name, (MedicinalProduct)resource);
59166    else if (resource instanceof MedicinalProductAuthorization)
59167      composeMedicinalProductAuthorization(name, (MedicinalProductAuthorization)resource);
59168    else if (resource instanceof MedicinalProductContraindication)
59169      composeMedicinalProductContraindication(name, (MedicinalProductContraindication)resource);
59170    else if (resource instanceof MedicinalProductIndication)
59171      composeMedicinalProductIndication(name, (MedicinalProductIndication)resource);
59172    else if (resource instanceof MedicinalProductIngredient)
59173      composeMedicinalProductIngredient(name, (MedicinalProductIngredient)resource);
59174    else if (resource instanceof MedicinalProductInteraction)
59175      composeMedicinalProductInteraction(name, (MedicinalProductInteraction)resource);
59176    else if (resource instanceof MedicinalProductManufactured)
59177      composeMedicinalProductManufactured(name, (MedicinalProductManufactured)resource);
59178    else if (resource instanceof MedicinalProductPackaged)
59179      composeMedicinalProductPackaged(name, (MedicinalProductPackaged)resource);
59180    else if (resource instanceof MedicinalProductPharmaceutical)
59181      composeMedicinalProductPharmaceutical(name, (MedicinalProductPharmaceutical)resource);
59182    else if (resource instanceof MedicinalProductUndesirableEffect)
59183      composeMedicinalProductUndesirableEffect(name, (MedicinalProductUndesirableEffect)resource);
59184    else if (resource instanceof MessageDefinition)
59185      composeMessageDefinition(name, (MessageDefinition)resource);
59186    else if (resource instanceof MessageHeader)
59187      composeMessageHeader(name, (MessageHeader)resource);
59188    else if (resource instanceof MolecularSequence)
59189      composeMolecularSequence(name, (MolecularSequence)resource);
59190    else if (resource instanceof NamingSystem)
59191      composeNamingSystem(name, (NamingSystem)resource);
59192    else if (resource instanceof NutritionOrder)
59193      composeNutritionOrder(name, (NutritionOrder)resource);
59194    else if (resource instanceof Observation)
59195      composeObservation(name, (Observation)resource);
59196    else if (resource instanceof ObservationDefinition)
59197      composeObservationDefinition(name, (ObservationDefinition)resource);
59198    else if (resource instanceof OperationDefinition)
59199      composeOperationDefinition(name, (OperationDefinition)resource);
59200    else if (resource instanceof OperationOutcome)
59201      composeOperationOutcome(name, (OperationOutcome)resource);
59202    else if (resource instanceof Organization)
59203      composeOrganization(name, (Organization)resource);
59204    else if (resource instanceof OrganizationAffiliation)
59205      composeOrganizationAffiliation(name, (OrganizationAffiliation)resource);
59206    else if (resource instanceof Patient)
59207      composePatient(name, (Patient)resource);
59208    else if (resource instanceof PaymentNotice)
59209      composePaymentNotice(name, (PaymentNotice)resource);
59210    else if (resource instanceof PaymentReconciliation)
59211      composePaymentReconciliation(name, (PaymentReconciliation)resource);
59212    else if (resource instanceof Person)
59213      composePerson(name, (Person)resource);
59214    else if (resource instanceof PlanDefinition)
59215      composePlanDefinition(name, (PlanDefinition)resource);
59216    else if (resource instanceof Practitioner)
59217      composePractitioner(name, (Practitioner)resource);
59218    else if (resource instanceof PractitionerRole)
59219      composePractitionerRole(name, (PractitionerRole)resource);
59220    else if (resource instanceof Procedure)
59221      composeProcedure(name, (Procedure)resource);
59222    else if (resource instanceof Provenance)
59223      composeProvenance(name, (Provenance)resource);
59224    else if (resource instanceof Questionnaire)
59225      composeQuestionnaire(name, (Questionnaire)resource);
59226    else if (resource instanceof QuestionnaireResponse)
59227      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
59228    else if (resource instanceof RelatedPerson)
59229      composeRelatedPerson(name, (RelatedPerson)resource);
59230    else if (resource instanceof RequestGroup)
59231      composeRequestGroup(name, (RequestGroup)resource);
59232    else if (resource instanceof ResearchDefinition)
59233      composeResearchDefinition(name, (ResearchDefinition)resource);
59234    else if (resource instanceof ResearchElementDefinition)
59235      composeResearchElementDefinition(name, (ResearchElementDefinition)resource);
59236    else if (resource instanceof ResearchStudy)
59237      composeResearchStudy(name, (ResearchStudy)resource);
59238    else if (resource instanceof ResearchSubject)
59239      composeResearchSubject(name, (ResearchSubject)resource);
59240    else if (resource instanceof RiskAssessment)
59241      composeRiskAssessment(name, (RiskAssessment)resource);
59242    else if (resource instanceof RiskEvidenceSynthesis)
59243      composeRiskEvidenceSynthesis(name, (RiskEvidenceSynthesis)resource);
59244    else if (resource instanceof Schedule)
59245      composeSchedule(name, (Schedule)resource);
59246    else if (resource instanceof SearchParameter)
59247      composeSearchParameter(name, (SearchParameter)resource);
59248    else if (resource instanceof ServiceRequest)
59249      composeServiceRequest(name, (ServiceRequest)resource);
59250    else if (resource instanceof Slot)
59251      composeSlot(name, (Slot)resource);
59252    else if (resource instanceof Specimen)
59253      composeSpecimen(name, (Specimen)resource);
59254    else if (resource instanceof SpecimenDefinition)
59255      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
59256    else if (resource instanceof StructureDefinition)
59257      composeStructureDefinition(name, (StructureDefinition)resource);
59258    else if (resource instanceof StructureMap)
59259      composeStructureMap(name, (StructureMap)resource);
59260    else if (resource instanceof Subscription)
59261      composeSubscription(name, (Subscription)resource);
59262    else if (resource instanceof Substance)
59263      composeSubstance(name, (Substance)resource);
59264    else if (resource instanceof SubstanceNucleicAcid)
59265      composeSubstanceNucleicAcid(name, (SubstanceNucleicAcid)resource);
59266    else if (resource instanceof SubstancePolymer)
59267      composeSubstancePolymer(name, (SubstancePolymer)resource);
59268    else if (resource instanceof SubstanceProtein)
59269      composeSubstanceProtein(name, (SubstanceProtein)resource);
59270    else if (resource instanceof SubstanceReferenceInformation)
59271      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation)resource);
59272    else if (resource instanceof SubstanceSourceMaterial)
59273      composeSubstanceSourceMaterial(name, (SubstanceSourceMaterial)resource);
59274    else if (resource instanceof SubstanceSpecification)
59275      composeSubstanceSpecification(name, (SubstanceSpecification)resource);
59276    else if (resource instanceof SupplyDelivery)
59277      composeSupplyDelivery(name, (SupplyDelivery)resource);
59278    else if (resource instanceof SupplyRequest)
59279      composeSupplyRequest(name, (SupplyRequest)resource);
59280    else if (resource instanceof Task)
59281      composeTask(name, (Task)resource);
59282    else if (resource instanceof TerminologyCapabilities)
59283      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
59284    else if (resource instanceof TestReport)
59285      composeTestReport(name, (TestReport)resource);
59286    else if (resource instanceof TestScript)
59287      composeTestScript(name, (TestScript)resource);
59288    else if (resource instanceof ValueSet)
59289      composeValueSet(name, (ValueSet)resource);
59290    else if (resource instanceof VerificationResult)
59291      composeVerificationResult(name, (VerificationResult)resource);
59292    else if (resource instanceof VisionPrescription)
59293      composeVisionPrescription(name, (VisionPrescription)resource);
59294    else if (resource instanceof Binary)
59295      composeBinary(name, (Binary)resource);
59296    else
59297      throw new Error("Unhandled resource type "+resource.getClass().getName());
59298  }
59299
59300  protected void composeType(String prefix, Type type) throws IOException {
59301    if (type == null)
59302      ;
59303    else if (type instanceof Extension)
59304       composeExtension(prefix+"Extension", (Extension) type);
59305    else if (type instanceof Narrative)
59306       composeNarrative(prefix+"Narrative", (Narrative) type);
59307    else if (type instanceof Count)
59308       composeCount(prefix+"Count", (Count) type);
59309    else if (type instanceof Dosage)
59310       composeDosage(prefix+"Dosage", (Dosage) type);
59311    else if (type instanceof MarketingStatus)
59312       composeMarketingStatus(prefix+"MarketingStatus", (MarketingStatus) type);
59313    else if (type instanceof SubstanceAmount)
59314       composeSubstanceAmount(prefix+"SubstanceAmount", (SubstanceAmount) type);
59315    else if (type instanceof Population)
59316       composePopulation(prefix+"Population", (Population) type);
59317    else if (type instanceof Distance)
59318       composeDistance(prefix+"Distance", (Distance) type);
59319    else if (type instanceof Age)
59320       composeAge(prefix+"Age", (Age) type);
59321    else if (type instanceof Duration)
59322       composeDuration(prefix+"Duration", (Duration) type);
59323    else if (type instanceof ProductShelfLife)
59324       composeProductShelfLife(prefix+"ProductShelfLife", (ProductShelfLife) type);
59325    else if (type instanceof Timing)
59326       composeTiming(prefix+"Timing", (Timing) type);
59327    else if (type instanceof ProdCharacteristic)
59328       composeProdCharacteristic(prefix+"ProdCharacteristic", (ProdCharacteristic) type);
59329    else if (type instanceof Meta)
59330       composeMeta(prefix+"Meta", (Meta) type);
59331    else if (type instanceof Address)
59332       composeAddress(prefix+"Address", (Address) type);
59333    else if (type instanceof Contributor)
59334       composeContributor(prefix+"Contributor", (Contributor) type);
59335    else if (type instanceof Attachment)
59336       composeAttachment(prefix+"Attachment", (Attachment) type);
59337    else if (type instanceof DataRequirement)
59338       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
59339    else if (type instanceof Money)
59340       composeMoney(prefix+"Money", (Money) type);
59341    else if (type instanceof HumanName)
59342       composeHumanName(prefix+"HumanName", (HumanName) type);
59343    else if (type instanceof ContactPoint)
59344       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
59345    else if (type instanceof Identifier)
59346       composeIdentifier(prefix+"Identifier", (Identifier) type);
59347    else if (type instanceof Coding)
59348       composeCoding(prefix+"Coding", (Coding) type);
59349    else if (type instanceof SampledData)
59350       composeSampledData(prefix+"SampledData", (SampledData) type);
59351    else if (type instanceof Ratio)
59352       composeRatio(prefix+"Ratio", (Ratio) type);
59353    else if (type instanceof Reference)
59354       composeReference(prefix+"Reference", (Reference) type);
59355    else if (type instanceof TriggerDefinition)
59356       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
59357    else if (type instanceof Quantity)
59358       composeQuantity(prefix+"Quantity", (Quantity) type);
59359    else if (type instanceof Period)
59360       composePeriod(prefix+"Period", (Period) type);
59361    else if (type instanceof Range)
59362       composeRange(prefix+"Range", (Range) type);
59363    else if (type instanceof RelatedArtifact)
59364       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
59365    else if (type instanceof Annotation)
59366       composeAnnotation(prefix+"Annotation", (Annotation) type);
59367    else if (type instanceof ContactDetail)
59368       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
59369    else if (type instanceof UsageContext)
59370       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
59371    else if (type instanceof Expression)
59372       composeExpression(prefix+"Expression", (Expression) type);
59373    else if (type instanceof Signature)
59374       composeSignature(prefix+"Signature", (Signature) type);
59375    else if (type instanceof CodeableConcept)
59376       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
59377    else if (type instanceof ParameterDefinition)
59378       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
59379    else if (type instanceof CodeType) {
59380      composeCodeCore(prefix+"Code", (CodeType) type, false);
59381      composeCodeExtras(prefix+"Code", (CodeType) type, false);
59382    }
59383    else if (type instanceof OidType) {
59384      composeOidCore(prefix+"Oid", (OidType) type, false);
59385      composeOidExtras(prefix+"Oid", (OidType) type, false);
59386    }
59387    else if (type instanceof CanonicalType) {
59388      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
59389      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
59390    }
59391    else if (type instanceof UuidType) {
59392      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
59393      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
59394    }
59395    else if (type instanceof UrlType) {
59396      composeUrlCore(prefix+"Url", (UrlType) type, false);
59397      composeUrlExtras(prefix+"Url", (UrlType) type, false);
59398    }
59399    else if (type instanceof UnsignedIntType) {
59400      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
59401      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
59402    }
59403    else if (type instanceof MarkdownType) {
59404      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
59405      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
59406    }
59407    else if (type instanceof IdType) {
59408      composeIdCore(prefix+"Id", (IdType) type, false);
59409      composeIdExtras(prefix+"Id", (IdType) type, false);
59410    }
59411    else if (type instanceof PositiveIntType) {
59412      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
59413      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
59414    }
59415    else if (type instanceof DateType) {
59416      composeDateCore(prefix+"Date", (DateType) type, false);
59417      composeDateExtras(prefix+"Date", (DateType) type, false);
59418    }
59419    else if (type instanceof DateTimeType) {
59420      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
59421      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
59422    }
59423    else if (type instanceof StringType) {
59424      composeStringCore(prefix+"String", (StringType) type, false);
59425      composeStringExtras(prefix+"String", (StringType) type, false);
59426    }
59427    else if (type instanceof IntegerType) {
59428      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
59429      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
59430    }
59431    else if (type instanceof UriType) {
59432      composeUriCore(prefix+"Uri", (UriType) type, false);
59433      composeUriExtras(prefix+"Uri", (UriType) type, false);
59434    }
59435    else if (type instanceof InstantType) {
59436      composeInstantCore(prefix+"Instant", (InstantType) type, false);
59437      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
59438    }
59439    else if (type instanceof BooleanType) {
59440      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
59441      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
59442    }
59443    else if (type instanceof Base64BinaryType) {
59444      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
59445      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
59446    }
59447    else if (type instanceof TimeType) {
59448      composeTimeCore(prefix+"Time", (TimeType) type, false);
59449      composeTimeExtras(prefix+"Time", (TimeType) type, false);
59450    }
59451    else if (type instanceof DecimalType) {
59452      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
59453      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
59454    }
59455    else
59456      throw new Error("Unhandled type");
59457  }
59458
59459  protected void composeTypeInner(Type type) throws IOException {
59460    if (type == null)
59461      ;
59462    else if (type instanceof Extension)
59463       composeExtensionInner((Extension) type);
59464    else if (type instanceof Narrative)
59465       composeNarrativeInner((Narrative) type);
59466    else if (type instanceof Count)
59467       composeCountInner((Count) type);
59468    else if (type instanceof Dosage)
59469       composeDosageInner((Dosage) type);
59470    else if (type instanceof MarketingStatus)
59471       composeMarketingStatusInner((MarketingStatus) type);
59472    else if (type instanceof SubstanceAmount)
59473       composeSubstanceAmountInner((SubstanceAmount) type);
59474    else if (type instanceof Population)
59475       composePopulationInner((Population) type);
59476    else if (type instanceof Distance)
59477       composeDistanceInner((Distance) type);
59478    else if (type instanceof Age)
59479       composeAgeInner((Age) type);
59480    else if (type instanceof Duration)
59481       composeDurationInner((Duration) type);
59482    else if (type instanceof ProductShelfLife)
59483       composeProductShelfLifeInner((ProductShelfLife) type);
59484    else if (type instanceof Timing)
59485       composeTimingInner((Timing) type);
59486    else if (type instanceof ProdCharacteristic)
59487       composeProdCharacteristicInner((ProdCharacteristic) type);
59488    else if (type instanceof Meta)
59489       composeMetaInner((Meta) type);
59490    else if (type instanceof Address)
59491       composeAddressInner((Address) type);
59492    else if (type instanceof Contributor)
59493       composeContributorInner((Contributor) type);
59494    else if (type instanceof Attachment)
59495       composeAttachmentInner((Attachment) type);
59496    else if (type instanceof DataRequirement)
59497       composeDataRequirementInner((DataRequirement) type);
59498    else if (type instanceof Money)
59499       composeMoneyInner((Money) type);
59500    else if (type instanceof HumanName)
59501       composeHumanNameInner((HumanName) type);
59502    else if (type instanceof ContactPoint)
59503       composeContactPointInner((ContactPoint) type);
59504    else if (type instanceof Identifier)
59505       composeIdentifierInner((Identifier) type);
59506    else if (type instanceof Coding)
59507       composeCodingInner((Coding) type);
59508    else if (type instanceof SampledData)
59509       composeSampledDataInner((SampledData) type);
59510    else if (type instanceof Ratio)
59511       composeRatioInner((Ratio) type);
59512    else if (type instanceof Reference)
59513       composeReferenceInner((Reference) type);
59514    else if (type instanceof TriggerDefinition)
59515       composeTriggerDefinitionInner((TriggerDefinition) type);
59516    else if (type instanceof Quantity)
59517       composeQuantityInner((Quantity) type);
59518    else if (type instanceof Period)
59519       composePeriodInner((Period) type);
59520    else if (type instanceof Range)
59521       composeRangeInner((Range) type);
59522    else if (type instanceof RelatedArtifact)
59523       composeRelatedArtifactInner((RelatedArtifact) type);
59524    else if (type instanceof Annotation)
59525       composeAnnotationInner((Annotation) type);
59526    else if (type instanceof ContactDetail)
59527       composeContactDetailInner((ContactDetail) type);
59528    else if (type instanceof UsageContext)
59529       composeUsageContextInner((UsageContext) type);
59530    else if (type instanceof Expression)
59531       composeExpressionInner((Expression) type);
59532    else if (type instanceof Signature)
59533       composeSignatureInner((Signature) type);
59534    else if (type instanceof CodeableConcept)
59535       composeCodeableConceptInner((CodeableConcept) type);
59536    else if (type instanceof ParameterDefinition)
59537       composeParameterDefinitionInner((ParameterDefinition) type);
59538    else
59539      throw new Error("Unhandled type: "+type.fhirType());
59540  }
59541
59542}