001package org.hl7.fhir.r4.formats;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0
033
034import org.hl7.fhir.r4.model.DateType;
035import org.hl7.fhir.r4.model.DateTimeType;
036import org.hl7.fhir.r4.model.CodeType;
037import org.hl7.fhir.r4.model.StringType;
038import org.hl7.fhir.r4.model.IntegerType;
039import org.hl7.fhir.r4.model.OidType;
040import org.hl7.fhir.r4.model.CanonicalType;
041import org.hl7.fhir.r4.model.UriType;
042import org.hl7.fhir.r4.model.UuidType;
043import org.hl7.fhir.r4.model.UrlType;
044import org.hl7.fhir.r4.model.InstantType;
045import org.hl7.fhir.r4.model.BooleanType;
046import org.hl7.fhir.r4.model.Base64BinaryType;
047import org.hl7.fhir.r4.model.UnsignedIntType;
048import org.hl7.fhir.r4.model.MarkdownType;
049import org.hl7.fhir.r4.model.TimeType;
050import org.hl7.fhir.r4.model.IdType;
051import org.hl7.fhir.r4.model.PositiveIntType;
052import org.hl7.fhir.r4.model.DecimalType;
053import org.hl7.fhir.r4.model.*;
054import org.hl7.fhir.utilities.Utilities;
055import org.hl7.fhir.utilities.xhtml.XhtmlNode;
056import org.hl7.fhir.exceptions.FHIRFormatError;
057import org.hl7.fhir.exceptions.FHIRException;
058import com.google.gson.JsonObject;
059import com.google.gson.JsonArray;
060import java.io.IOException;
061
062public class JsonParser extends JsonParserBase {
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    return res;
199  }
200
201  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
202    Extension res = new Extension();
203    parseExtensionProperties(json, res);
204    return res;
205  }
206
207  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
208    parseTypeProperties(json, res);
209    if (json.has("url"))
210      res.setUrlElement(parseUri(json.get("url").getAsString()));
211    if (json.has("_url"))
212      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
213    Type value = parseType("value", json);
214    if (value != null)
215      res.setValue(value);
216  }
217
218  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
219    Narrative res = new Narrative();
220    parseNarrativeProperties(json, res);
221    return res;
222  }
223
224  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
225    parseTypeProperties(json, res);
226    if (json.has("status"))
227      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
228    if (json.has("_status"))
229      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
230    if (json.has("div"))
231      res.setDiv(parseXhtml(json.get("div").getAsString()));
232  }
233
234  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
235    Meta res = new Meta();
236    parseMetaProperties(json, res);
237    return res;
238  }
239
240  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
241    parseElementProperties(json, res);
242    if (json.has("versionId"))
243      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
244    if (json.has("_versionId"))
245      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
246    if (json.has("lastUpdated"))
247      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
248    if (json.has("_lastUpdated"))
249      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
250    if (json.has("source"))
251      res.setSourceElement(parseUri(json.get("source").getAsString()));
252    if (json.has("_source"))
253      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
254    if (json.has("profile")) {
255      JsonArray array = json.getAsJsonArray("profile");
256      for (int i = 0; i < array.size(); i++) {
257        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
258      }
259    };
260    if (json.has("_profile")) {
261      JsonArray array = json.getAsJsonArray("_profile");
262      for (int i = 0; i < array.size(); i++) {
263        if (i == res.getProfile().size())
264          res.getProfile().add(parseCanonical(null));
265        if (array.get(i) instanceof JsonObject) 
266          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
267      }
268    };
269    if (json.has("security")) {
270      JsonArray array = json.getAsJsonArray("security");
271      for (int i = 0; i < array.size(); i++) {
272        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
273      }
274    };
275    if (json.has("tag")) {
276      JsonArray array = json.getAsJsonArray("tag");
277      for (int i = 0; i < array.size(); i++) {
278        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
279      }
280    };
281  }
282
283  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
284    Address res = new Address();
285    parseAddressProperties(json, res);
286    return res;
287  }
288
289  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
290    parseTypeProperties(json, res);
291    if (json.has("use"))
292      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
293    if (json.has("_use"))
294      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
295    if (json.has("type"))
296      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
297    if (json.has("_type"))
298      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
299    if (json.has("text"))
300      res.setTextElement(parseString(json.get("text").getAsString()));
301    if (json.has("_text"))
302      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
303    if (json.has("line")) {
304      JsonArray array = json.getAsJsonArray("line");
305      for (int i = 0; i < array.size(); i++) {
306        res.getLine().add(parseString(array.get(i).getAsString()));
307      }
308    };
309    if (json.has("_line")) {
310      JsonArray array = json.getAsJsonArray("_line");
311      for (int i = 0; i < array.size(); i++) {
312        if (i == res.getLine().size())
313          res.getLine().add(parseString(null));
314        if (array.get(i) instanceof JsonObject) 
315          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
316      }
317    };
318    if (json.has("city"))
319      res.setCityElement(parseString(json.get("city").getAsString()));
320    if (json.has("_city"))
321      parseElementProperties(json.getAsJsonObject("_city"), res.getCityElement());
322    if (json.has("district"))
323      res.setDistrictElement(parseString(json.get("district").getAsString()));
324    if (json.has("_district"))
325      parseElementProperties(json.getAsJsonObject("_district"), res.getDistrictElement());
326    if (json.has("state"))
327      res.setStateElement(parseString(json.get("state").getAsString()));
328    if (json.has("_state"))
329      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
330    if (json.has("postalCode"))
331      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
332    if (json.has("_postalCode"))
333      parseElementProperties(json.getAsJsonObject("_postalCode"), res.getPostalCodeElement());
334    if (json.has("country"))
335      res.setCountryElement(parseString(json.get("country").getAsString()));
336    if (json.has("_country"))
337      parseElementProperties(json.getAsJsonObject("_country"), res.getCountryElement());
338    if (json.has("period"))
339      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
340  }
341
342  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
343    Contributor res = new Contributor();
344    parseContributorProperties(json, res);
345    return res;
346  }
347
348  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
349    parseTypeProperties(json, res);
350    if (json.has("type"))
351      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
352    if (json.has("_type"))
353      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
354    if (json.has("name"))
355      res.setNameElement(parseString(json.get("name").getAsString()));
356    if (json.has("_name"))
357      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
358    if (json.has("contact")) {
359      JsonArray array = json.getAsJsonArray("contact");
360      for (int i = 0; i < array.size(); i++) {
361        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
362      }
363    };
364  }
365
366  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
367    Attachment res = new Attachment();
368    parseAttachmentProperties(json, res);
369    return res;
370  }
371
372  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
373    parseTypeProperties(json, res);
374    if (json.has("contentType"))
375      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
376    if (json.has("_contentType"))
377      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
378    if (json.has("language"))
379      res.setLanguageElement(parseCode(json.get("language").getAsString()));
380    if (json.has("_language"))
381      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
382    if (json.has("data"))
383      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
384    if (json.has("_data"))
385      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
386    if (json.has("url"))
387      res.setUrlElement(parseUrl(json.get("url").getAsString()));
388    if (json.has("_url"))
389      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
390    if (json.has("size"))
391      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
392    if (json.has("_size"))
393      parseElementProperties(json.getAsJsonObject("_size"), res.getSizeElement());
394    if (json.has("hash"))
395      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
396    if (json.has("_hash"))
397      parseElementProperties(json.getAsJsonObject("_hash"), res.getHashElement());
398    if (json.has("title"))
399      res.setTitleElement(parseString(json.get("title").getAsString()));
400    if (json.has("_title"))
401      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
402    if (json.has("creation"))
403      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
404    if (json.has("_creation"))
405      parseElementProperties(json.getAsJsonObject("_creation"), res.getCreationElement());
406  }
407
408  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
409    Count res = new Count();
410    parseCountProperties(json, res);
411    return res;
412  }
413
414  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
415    parseQuantityProperties(json, res);
416  }
417
418  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
419    DataRequirement res = new DataRequirement();
420    parseDataRequirementProperties(json, res);
421    return res;
422  }
423
424  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
425    parseTypeProperties(json, res);
426    if (json.has("type"))
427      res.setTypeElement(parseCode(json.get("type").getAsString()));
428    if (json.has("_type"))
429      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
430    if (json.has("profile")) {
431      JsonArray array = json.getAsJsonArray("profile");
432      for (int i = 0; i < array.size(); i++) {
433        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
434      }
435    };
436    if (json.has("_profile")) {
437      JsonArray array = json.getAsJsonArray("_profile");
438      for (int i = 0; i < array.size(); i++) {
439        if (i == res.getProfile().size())
440          res.getProfile().add(parseCanonical(null));
441        if (array.get(i) instanceof JsonObject) 
442          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
443      }
444    };
445    Type subject = parseType("subject", json);
446    if (subject != null)
447      res.setSubject(subject);
448    if (json.has("mustSupport")) {
449      JsonArray array = json.getAsJsonArray("mustSupport");
450      for (int i = 0; i < array.size(); i++) {
451        res.getMustSupport().add(parseString(array.get(i).getAsString()));
452      }
453    };
454    if (json.has("_mustSupport")) {
455      JsonArray array = json.getAsJsonArray("_mustSupport");
456      for (int i = 0; i < array.size(); i++) {
457        if (i == res.getMustSupport().size())
458          res.getMustSupport().add(parseString(null));
459        if (array.get(i) instanceof JsonObject) 
460          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
461      }
462    };
463    if (json.has("codeFilter")) {
464      JsonArray array = json.getAsJsonArray("codeFilter");
465      for (int i = 0; i < array.size(); i++) {
466        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
467      }
468    };
469    if (json.has("dateFilter")) {
470      JsonArray array = json.getAsJsonArray("dateFilter");
471      for (int i = 0; i < array.size(); i++) {
472        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
473      }
474    };
475    if (json.has("limit"))
476      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
477    if (json.has("_limit"))
478      parseElementProperties(json.getAsJsonObject("_limit"), res.getLimitElement());
479    if (json.has("sort")) {
480      JsonArray array = json.getAsJsonArray("sort");
481      for (int i = 0; i < array.size(); i++) {
482        res.getSort().add(parseDataRequirementDataRequirementSortComponent(array.get(i).getAsJsonObject(), res));
483      }
484    };
485  }
486
487  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
488    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
489    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
490    return res;
491  }
492
493  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
494    parseTypeProperties(json, res);
495    if (json.has("path"))
496      res.setPathElement(parseString(json.get("path").getAsString()));
497    if (json.has("_path"))
498      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
499    Type valueSet = parseType("valueSet", json);
500    if (valueSet != null)
501      res.setValueSet(valueSet);
502    if (json.has("code")) {
503      JsonArray array = json.getAsJsonArray("code");
504      for (int i = 0; i < array.size(); i++) {
505        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
506      }
507    };
508  }
509
510  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
511    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
512    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
513    return res;
514  }
515
516  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
517    parseTypeProperties(json, res);
518    if (json.has("path"))
519      res.setPathElement(parseString(json.get("path").getAsString()));
520    if (json.has("_path"))
521      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
522    Type value = parseType("value", json);
523    if (value != null)
524      res.setValue(value);
525  }
526
527  protected DataRequirement.DataRequirementSortComponent parseDataRequirementDataRequirementSortComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
528    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
529    parseDataRequirementDataRequirementSortComponentProperties(json, owner, res);
530    return res;
531  }
532
533  protected void parseDataRequirementDataRequirementSortComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
534    parseTypeProperties(json, res);
535    if (json.has("path"))
536      res.setPathElement(parseString(json.get("path").getAsString()));
537    if (json.has("_path"))
538      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
539    if (json.has("direction"))
540      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
541    if (json.has("_direction"))
542      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
543  }
544
545  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
546    Dosage res = new Dosage();
547    parseDosageProperties(json, res);
548    return res;
549  }
550
551  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
552    parseBackboneElementProperties(json, res);
553    if (json.has("sequence"))
554      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
555    if (json.has("_sequence"))
556      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
557    if (json.has("text"))
558      res.setTextElement(parseString(json.get("text").getAsString()));
559    if (json.has("_text"))
560      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
561    if (json.has("additionalInstruction")) {
562      JsonArray array = json.getAsJsonArray("additionalInstruction");
563      for (int i = 0; i < array.size(); i++) {
564        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
565      }
566    };
567    if (json.has("patientInstruction"))
568      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
569    if (json.has("_patientInstruction"))
570      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
571    if (json.has("timing"))
572      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
573    Type asNeeded = parseType("asNeeded", json);
574    if (asNeeded != null)
575      res.setAsNeeded(asNeeded);
576    if (json.has("site"))
577      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
578    if (json.has("route"))
579      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
580    if (json.has("method"))
581      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
582    if (json.has("doseAndRate")) {
583      JsonArray array = json.getAsJsonArray("doseAndRate");
584      for (int i = 0; i < array.size(); i++) {
585        res.getDoseAndRate().add(parseDosageDosageDoseAndRateComponent(array.get(i).getAsJsonObject(), res));
586      }
587    };
588    if (json.has("maxDosePerPeriod"))
589      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
590    if (json.has("maxDosePerAdministration"))
591      res.setMaxDosePerAdministration(parseSimpleQuantity(json.getAsJsonObject("maxDosePerAdministration")));
592    if (json.has("maxDosePerLifetime"))
593      res.setMaxDosePerLifetime(parseSimpleQuantity(json.getAsJsonObject("maxDosePerLifetime")));
594  }
595
596  protected Dosage.DosageDoseAndRateComponent parseDosageDosageDoseAndRateComponent(JsonObject json, Dosage owner) throws IOException, FHIRFormatError {
597    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
598    parseDosageDosageDoseAndRateComponentProperties(json, owner, res);
599    return res;
600  }
601
602  protected void parseDosageDosageDoseAndRateComponentProperties(JsonObject json, Dosage owner, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
603    parseTypeProperties(json, res);
604    if (json.has("type"))
605      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
606    Type dose = parseType("dose", json);
607    if (dose != null)
608      res.setDose(dose);
609    Type rate = parseType("rate", json);
610    if (rate != null)
611      res.setRate(rate);
612  }
613
614  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
615    Money res = new Money();
616    parseMoneyProperties(json, res);
617    return res;
618  }
619
620  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
621    parseQuantityProperties(json, res);
622  }
623
624  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
625    HumanName res = new HumanName();
626    parseHumanNameProperties(json, res);
627    return res;
628  }
629
630  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
631    parseTypeProperties(json, res);
632    if (json.has("use"))
633      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
634    if (json.has("_use"))
635      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
636    if (json.has("text"))
637      res.setTextElement(parseString(json.get("text").getAsString()));
638    if (json.has("_text"))
639      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
640    if (json.has("family"))
641      res.setFamilyElement(parseString(json.get("family").getAsString()));
642    if (json.has("_family"))
643      parseElementProperties(json.getAsJsonObject("_family"), res.getFamilyElement());
644    if (json.has("given")) {
645      JsonArray array = json.getAsJsonArray("given");
646      for (int i = 0; i < array.size(); i++) {
647        res.getGiven().add(parseString(array.get(i).getAsString()));
648      }
649    };
650    if (json.has("_given")) {
651      JsonArray array = json.getAsJsonArray("_given");
652      for (int i = 0; i < array.size(); i++) {
653        if (i == res.getGiven().size())
654          res.getGiven().add(parseString(null));
655        if (array.get(i) instanceof JsonObject) 
656          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
657      }
658    };
659    if (json.has("prefix")) {
660      JsonArray array = json.getAsJsonArray("prefix");
661      for (int i = 0; i < array.size(); i++) {
662        res.getPrefix().add(parseString(array.get(i).getAsString()));
663      }
664    };
665    if (json.has("_prefix")) {
666      JsonArray array = json.getAsJsonArray("_prefix");
667      for (int i = 0; i < array.size(); i++) {
668        if (i == res.getPrefix().size())
669          res.getPrefix().add(parseString(null));
670        if (array.get(i) instanceof JsonObject) 
671          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
672      }
673    };
674    if (json.has("suffix")) {
675      JsonArray array = json.getAsJsonArray("suffix");
676      for (int i = 0; i < array.size(); i++) {
677        res.getSuffix().add(parseString(array.get(i).getAsString()));
678      }
679    };
680    if (json.has("_suffix")) {
681      JsonArray array = json.getAsJsonArray("_suffix");
682      for (int i = 0; i < array.size(); i++) {
683        if (i == res.getSuffix().size())
684          res.getSuffix().add(parseString(null));
685        if (array.get(i) instanceof JsonObject) 
686          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
687      }
688    };
689    if (json.has("period"))
690      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
691  }
692
693  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
694    ContactPoint res = new ContactPoint();
695    parseContactPointProperties(json, res);
696    return res;
697  }
698
699  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
700    parseTypeProperties(json, res);
701    if (json.has("system"))
702      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
703    if (json.has("_system"))
704      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
705    if (json.has("value"))
706      res.setValueElement(parseString(json.get("value").getAsString()));
707    if (json.has("_value"))
708      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
709    if (json.has("use"))
710      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
711    if (json.has("_use"))
712      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
713    if (json.has("rank"))
714      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
715    if (json.has("_rank"))
716      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
717    if (json.has("period"))
718      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
719  }
720
721  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
722    Identifier res = new Identifier();
723    parseIdentifierProperties(json, res);
724    return res;
725  }
726
727  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
728    parseTypeProperties(json, res);
729    if (json.has("use"))
730      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
731    if (json.has("_use"))
732      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
733    if (json.has("type"))
734      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
735    if (json.has("system"))
736      res.setSystemElement(parseUri(json.get("system").getAsString()));
737    if (json.has("_system"))
738      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
739    if (json.has("value"))
740      res.setValueElement(parseString(json.get("value").getAsString()));
741    if (json.has("_value"))
742      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
743    if (json.has("period"))
744      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
745    if (json.has("assigner"))
746      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
747  }
748
749  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
750    Coding res = new Coding();
751    parseCodingProperties(json, res);
752    return res;
753  }
754
755  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
756    parseTypeProperties(json, res);
757    if (json.has("system"))
758      res.setSystemElement(parseUri(json.get("system").getAsString()));
759    if (json.has("_system"))
760      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
761    if (json.has("version"))
762      res.setVersionElement(parseString(json.get("version").getAsString()));
763    if (json.has("_version"))
764      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
765    if (json.has("code"))
766      res.setCodeElement(parseCode(json.get("code").getAsString()));
767    if (json.has("_code"))
768      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
769    if (json.has("display"))
770      res.setDisplayElement(parseString(json.get("display").getAsString()));
771    if (json.has("_display"))
772      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
773    if (json.has("userSelected"))
774      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
775    if (json.has("_userSelected"))
776      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
777  }
778
779  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
780    SampledData res = new SampledData();
781    parseSampledDataProperties(json, res);
782    return res;
783  }
784
785  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
786    parseTypeProperties(json, res);
787    if (json.has("origin"))
788      res.setOrigin(parseSimpleQuantity(json.getAsJsonObject("origin")));
789    if (json.has("period"))
790      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
791    if (json.has("_period"))
792      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
793    if (json.has("factor"))
794      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
795    if (json.has("_factor"))
796      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
797    if (json.has("lowerLimit"))
798      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
799    if (json.has("_lowerLimit"))
800      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
801    if (json.has("upperLimit"))
802      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
803    if (json.has("_upperLimit"))
804      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
805    if (json.has("dimensions"))
806      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
807    if (json.has("_dimensions"))
808      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
809    if (json.has("data"))
810      res.setDataElement(parseString(json.get("data").getAsString()));
811    if (json.has("_data"))
812      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
813  }
814
815  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
816    Ratio res = new Ratio();
817    parseRatioProperties(json, res);
818    return res;
819  }
820
821  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
822    parseTypeProperties(json, res);
823    if (json.has("numerator"))
824      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
825    if (json.has("denominator"))
826      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
827  }
828
829  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
830    Distance res = new Distance();
831    parseDistanceProperties(json, res);
832    return res;
833  }
834
835  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
836    parseQuantityProperties(json, res);
837  }
838
839  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
840    Age res = new Age();
841    parseAgeProperties(json, res);
842    return res;
843  }
844
845  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
846    parseQuantityProperties(json, res);
847  }
848
849  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
850    Reference res = new Reference();
851    parseReferenceProperties(json, res);
852    return res;
853  }
854
855  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
856    parseTypeProperties(json, res);
857    if (json.has("reference"))
858      res.setReferenceElement(parseString(json.get("reference").getAsString()));
859    if (json.has("_reference"))
860      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
861    if (json.has("type"))
862      res.setTypeElement(parseUri(json.get("type").getAsString()));
863    if (json.has("_type"))
864      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
865    if (json.has("identifier"))
866      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
867    if (json.has("display"))
868      res.setDisplayElement(parseString(json.get("display").getAsString()));
869    if (json.has("_display"))
870      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
871  }
872
873  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
874    TriggerDefinition res = new TriggerDefinition();
875    parseTriggerDefinitionProperties(json, res);
876    return res;
877  }
878
879  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
880    parseTypeProperties(json, res);
881    if (json.has("type"))
882      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
883    if (json.has("_type"))
884      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
885    if (json.has("name"))
886      res.setNameElement(parseString(json.get("name").getAsString()));
887    if (json.has("_name"))
888      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
889    Type timing = parseType("timing", json);
890    if (timing != null)
891      res.setTiming(timing);
892    if (json.has("data"))
893      res.setData(parseDataRequirement(json.getAsJsonObject("data")));
894    if (json.has("condition"))
895      res.setCondition(parseTriggerDefinitionTriggerDefinitionConditionComponent(json.getAsJsonObject("condition"), res));
896  }
897
898  protected TriggerDefinition.TriggerDefinitionConditionComponent parseTriggerDefinitionTriggerDefinitionConditionComponent(JsonObject json, TriggerDefinition owner) throws IOException, FHIRFormatError {
899    TriggerDefinition.TriggerDefinitionConditionComponent res = new TriggerDefinition.TriggerDefinitionConditionComponent();
900    parseTriggerDefinitionTriggerDefinitionConditionComponentProperties(json, owner, res);
901    return res;
902  }
903
904  protected void parseTriggerDefinitionTriggerDefinitionConditionComponentProperties(JsonObject json, TriggerDefinition owner, TriggerDefinition.TriggerDefinitionConditionComponent res) throws IOException, FHIRFormatError {
905    parseTypeProperties(json, res);
906    if (json.has("description"))
907      res.setDescriptionElement(parseString(json.get("description").getAsString()));
908    if (json.has("_description"))
909      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
910    if (json.has("language"))
911      res.setLanguageElement(parseEnumeration(json.get("language").getAsString(), TriggerDefinition.ExpressionLanguage.NULL, new TriggerDefinition.ExpressionLanguageEnumFactory()));
912    if (json.has("_language"))
913      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
914    if (json.has("expression"))
915      res.setExpressionElement(parseString(json.get("expression").getAsString()));
916    if (json.has("_expression"))
917      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
918  }
919
920  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
921    Quantity res = new Quantity();
922    parseQuantityProperties(json, res);
923    return res;
924  }
925
926  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
927    parseTypeProperties(json, res);
928    if (json.has("value"))
929      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
930    if (json.has("_value"))
931      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
932    if (json.has("comparator"))
933      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
934    if (json.has("_comparator"))
935      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
936    if (json.has("unit"))
937      res.setUnitElement(parseString(json.get("unit").getAsString()));
938    if (json.has("_unit"))
939      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
940    if (json.has("system"))
941      res.setSystemElement(parseUri(json.get("system").getAsString()));
942    if (json.has("_system"))
943      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
944    if (json.has("code"))
945      res.setCodeElement(parseCode(json.get("code").getAsString()));
946    if (json.has("_code"))
947      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
948  }
949
950  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
951    Period res = new Period();
952    parsePeriodProperties(json, res);
953    return res;
954  }
955
956  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
957    parseTypeProperties(json, res);
958    if (json.has("start"))
959      res.setStartElement(parseDateTime(json.get("start").getAsString()));
960    if (json.has("_start"))
961      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
962    if (json.has("end"))
963      res.setEndElement(parseDateTime(json.get("end").getAsString()));
964    if (json.has("_end"))
965      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
966  }
967
968  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
969    Duration res = new Duration();
970    parseDurationProperties(json, res);
971    return res;
972  }
973
974  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
975    parseQuantityProperties(json, res);
976  }
977
978  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
979    Range res = new Range();
980    parseRangeProperties(json, res);
981    return res;
982  }
983
984  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
985    parseTypeProperties(json, res);
986    if (json.has("low"))
987      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
988    if (json.has("high"))
989      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
990  }
991
992  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
993    RelatedArtifact res = new RelatedArtifact();
994    parseRelatedArtifactProperties(json, res);
995    return res;
996  }
997
998  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
999    parseTypeProperties(json, res);
1000    if (json.has("type"))
1001      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1002    if (json.has("_type"))
1003      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1004    if (json.has("display"))
1005      res.setDisplayElement(parseString(json.get("display").getAsString()));
1006    if (json.has("_display"))
1007      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
1008    if (json.has("citation"))
1009      res.setCitationElement(parseString(json.get("citation").getAsString()));
1010    if (json.has("_citation"))
1011      parseElementProperties(json.getAsJsonObject("_citation"), res.getCitationElement());
1012    if (json.has("url"))
1013      res.setUrlElement(parseUrl(json.get("url").getAsString()));
1014    if (json.has("_url"))
1015      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1016    if (json.has("document"))
1017      res.setDocument(parseAttachment(json.getAsJsonObject("document")));
1018    if (json.has("resource"))
1019      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1020    if (json.has("_resource"))
1021      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
1022  }
1023
1024  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
1025    Annotation res = new Annotation();
1026    parseAnnotationProperties(json, res);
1027    return res;
1028  }
1029
1030  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
1031    parseTypeProperties(json, res);
1032    Type author = parseType("author", json);
1033    if (author != null)
1034      res.setAuthor(author);
1035    if (json.has("time"))
1036      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
1037    if (json.has("_time"))
1038      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
1039    if (json.has("text"))
1040      res.setTextElement(parseString(json.get("text").getAsString()));
1041    if (json.has("_text"))
1042      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1043  }
1044
1045  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
1046    ContactDetail res = new ContactDetail();
1047    parseContactDetailProperties(json, res);
1048    return res;
1049  }
1050
1051  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
1052    parseTypeProperties(json, res);
1053    if (json.has("name"))
1054      res.setNameElement(parseString(json.get("name").getAsString()));
1055    if (json.has("_name"))
1056      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1057    if (json.has("telecom")) {
1058      JsonArray array = json.getAsJsonArray("telecom");
1059      for (int i = 0; i < array.size(); i++) {
1060        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1061      }
1062    };
1063  }
1064
1065  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1066    UsageContext res = new UsageContext();
1067    parseUsageContextProperties(json, res);
1068    return res;
1069  }
1070
1071  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1072    parseTypeProperties(json, res);
1073    if (json.has("code"))
1074      res.setCode(parseCoding(json.getAsJsonObject("code")));
1075    Type value = parseType("value", json);
1076    if (value != null)
1077      res.setValue(value);
1078  }
1079
1080  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1081    Signature res = new Signature();
1082    parseSignatureProperties(json, res);
1083    return res;
1084  }
1085
1086  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1087    parseTypeProperties(json, res);
1088    if (json.has("type")) {
1089      JsonArray array = json.getAsJsonArray("type");
1090      for (int i = 0; i < array.size(); i++) {
1091        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1092      }
1093    };
1094    if (json.has("when"))
1095      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1096    if (json.has("_when"))
1097      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
1098    Type who = parseType("who", json);
1099    if (who != null)
1100      res.setWho(who);
1101    Type onBehalfOf = parseType("onBehalfOf", json);
1102    if (onBehalfOf != null)
1103      res.setOnBehalfOf(onBehalfOf);
1104    if (json.has("targetFormat"))
1105      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1106    if (json.has("_targetFormat"))
1107      parseElementProperties(json.getAsJsonObject("_targetFormat"), res.getTargetFormatElement());
1108    if (json.has("sigFormat"))
1109      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1110    if (json.has("_sigFormat"))
1111      parseElementProperties(json.getAsJsonObject("_sigFormat"), res.getSigFormatElement());
1112    if (json.has("blob"))
1113      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
1114    if (json.has("_blob"))
1115      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
1116  }
1117
1118  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1119    Timing res = new Timing();
1120    parseTimingProperties(json, res);
1121    return res;
1122  }
1123
1124  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1125    parseBackboneElementProperties(json, res);
1126    if (json.has("event")) {
1127      JsonArray array = json.getAsJsonArray("event");
1128      for (int i = 0; i < array.size(); i++) {
1129        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1130      }
1131    };
1132    if (json.has("_event")) {
1133      JsonArray array = json.getAsJsonArray("_event");
1134      for (int i = 0; i < array.size(); i++) {
1135        if (i == res.getEvent().size())
1136          res.getEvent().add(parseDateTime(null));
1137        if (array.get(i) instanceof JsonObject) 
1138          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1139      }
1140    };
1141    if (json.has("repeat"))
1142      res.setRepeat(parseTimingTimingRepeatComponent(json.getAsJsonObject("repeat"), res));
1143    if (json.has("code"))
1144      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1145  }
1146
1147  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1148    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1149    parseTimingTimingRepeatComponentProperties(json, owner, res);
1150    return res;
1151  }
1152
1153  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1154    parseTypeProperties(json, res);
1155    Type bounds = parseType("bounds", json);
1156    if (bounds != null)
1157      res.setBounds(bounds);
1158    if (json.has("count"))
1159      res.setCountElement(parseInteger(json.get("count").getAsLong()));
1160    if (json.has("_count"))
1161      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
1162    if (json.has("countMax"))
1163      res.setCountMaxElement(parseInteger(json.get("countMax").getAsLong()));
1164    if (json.has("_countMax"))
1165      parseElementProperties(json.getAsJsonObject("_countMax"), res.getCountMaxElement());
1166    if (json.has("duration"))
1167      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1168    if (json.has("_duration"))
1169      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
1170    if (json.has("durationMax"))
1171      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1172    if (json.has("_durationMax"))
1173      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
1174    if (json.has("durationUnit"))
1175      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1176    if (json.has("_durationUnit"))
1177      parseElementProperties(json.getAsJsonObject("_durationUnit"), res.getDurationUnitElement());
1178    if (json.has("frequency"))
1179      res.setFrequencyElement(parseInteger(json.get("frequency").getAsLong()));
1180    if (json.has("_frequency"))
1181      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
1182    if (json.has("frequencyMax"))
1183      res.setFrequencyMaxElement(parseInteger(json.get("frequencyMax").getAsLong()));
1184    if (json.has("_frequencyMax"))
1185      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
1186    if (json.has("period"))
1187      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1188    if (json.has("_period"))
1189      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
1190    if (json.has("periodMax"))
1191      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1192    if (json.has("_periodMax"))
1193      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
1194    if (json.has("periodUnit"))
1195      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1196    if (json.has("_periodUnit"))
1197      parseElementProperties(json.getAsJsonObject("_periodUnit"), res.getPeriodUnitElement());
1198    if (json.has("dayOfWeek")) {
1199      JsonArray array = json.getAsJsonArray("dayOfWeek");
1200      for (int i = 0; i < array.size(); i++) {
1201        res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1202      }
1203    };
1204    if (json.has("_dayOfWeek")) {
1205      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1206      for (int i = 0; i < array.size(); i++) {
1207        if (i == res.getDayOfWeek().size())
1208          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1209        if (array.get(i) instanceof JsonObject) 
1210          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1211      }
1212    };
1213    if (json.has("timeOfDay")) {
1214      JsonArray array = json.getAsJsonArray("timeOfDay");
1215      for (int i = 0; i < array.size(); i++) {
1216        res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1217      }
1218    };
1219    if (json.has("_timeOfDay")) {
1220      JsonArray array = json.getAsJsonArray("_timeOfDay");
1221      for (int i = 0; i < array.size(); i++) {
1222        if (i == res.getTimeOfDay().size())
1223          res.getTimeOfDay().add(parseTime(null));
1224        if (array.get(i) instanceof JsonObject) 
1225          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1226      }
1227    };
1228    if (json.has("when")) {
1229      JsonArray array = json.getAsJsonArray("when");
1230      for (int i = 0; i < array.size(); i++) {
1231        res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1232      }
1233    };
1234    if (json.has("_when")) {
1235      JsonArray array = json.getAsJsonArray("_when");
1236      for (int i = 0; i < array.size(); i++) {
1237        if (i == res.getWhen().size())
1238          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1239        if (array.get(i) instanceof JsonObject) 
1240          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1241      }
1242    };
1243    if (json.has("offset"))
1244      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1245    if (json.has("_offset"))
1246      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
1247  }
1248
1249  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
1250    CodeableConcept res = new CodeableConcept();
1251    parseCodeableConceptProperties(json, res);
1252    return res;
1253  }
1254
1255  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
1256    parseTypeProperties(json, res);
1257    if (json.has("coding")) {
1258      JsonArray array = json.getAsJsonArray("coding");
1259      for (int i = 0; i < array.size(); i++) {
1260        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
1261      }
1262    };
1263    if (json.has("text"))
1264      res.setTextElement(parseString(json.get("text").getAsString()));
1265    if (json.has("_text"))
1266      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1267  }
1268
1269  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1270    ParameterDefinition res = new ParameterDefinition();
1271    parseParameterDefinitionProperties(json, res);
1272    return res;
1273  }
1274
1275  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1276    parseTypeProperties(json, res);
1277    if (json.has("name"))
1278      res.setNameElement(parseCode(json.get("name").getAsString()));
1279    if (json.has("_name"))
1280      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1281    if (json.has("use"))
1282      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1283    if (json.has("_use"))
1284      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1285    if (json.has("min"))
1286      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1287    if (json.has("_min"))
1288      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1289    if (json.has("max"))
1290      res.setMaxElement(parseString(json.get("max").getAsString()));
1291    if (json.has("_max"))
1292      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1293    if (json.has("documentation"))
1294      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1295    if (json.has("_documentation"))
1296      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
1297    if (json.has("type"))
1298      res.setTypeElement(parseCode(json.get("type").getAsString()));
1299    if (json.has("_type"))
1300      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1301    if (json.has("profile"))
1302      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1303    if (json.has("_profile"))
1304      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
1305  }
1306
1307  protected SimpleQuantity parseSimpleQuantity(JsonObject json) throws IOException, FHIRFormatError {
1308    SimpleQuantity res = new SimpleQuantity();
1309    parseSimpleQuantityProperties(json, res);
1310    return res;
1311  }
1312
1313  protected void parseSimpleQuantityProperties(JsonObject json, SimpleQuantity res) throws IOException, FHIRFormatError {
1314    parseTypeProperties(json, res);
1315    if (json.has("value"))
1316      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1317    if (json.has("_value"))
1318      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1319    if (json.has("comparator"))
1320      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
1321    if (json.has("_comparator"))
1322      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
1323    if (json.has("unit"))
1324      res.setUnitElement(parseString(json.get("unit").getAsString()));
1325    if (json.has("_unit"))
1326      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
1327    if (json.has("system"))
1328      res.setSystemElement(parseUri(json.get("system").getAsString()));
1329    if (json.has("_system"))
1330      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
1331    if (json.has("code"))
1332      res.setCodeElement(parseCode(json.get("code").getAsString()));
1333    if (json.has("_code"))
1334      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1335  }
1336
1337  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
1338    MarketingStatus res = new MarketingStatus();
1339    parseMarketingStatusProperties(json, res);
1340    return res;
1341  }
1342
1343  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
1344    parseBackboneElementProperties(json, res);
1345    if (json.has("country"))
1346      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
1347    if (json.has("jurisdiction"))
1348      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
1349    if (json.has("status"))
1350      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
1351    if (json.has("dateRange"))
1352      res.setDateRange(parsePeriod(json.getAsJsonObject("dateRange")));
1353    if (json.has("restoreDate"))
1354      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
1355    if (json.has("_restoreDate"))
1356      parseElementProperties(json.getAsJsonObject("_restoreDate"), res.getRestoreDateElement());
1357  }
1358
1359  protected SubstanceAmount parseSubstanceAmount(JsonObject json) throws IOException, FHIRFormatError {
1360    SubstanceAmount res = new SubstanceAmount();
1361    parseSubstanceAmountProperties(json, res);
1362    return res;
1363  }
1364
1365  protected void parseSubstanceAmountProperties(JsonObject json, SubstanceAmount res) throws IOException, FHIRFormatError {
1366    parseBackboneElementProperties(json, res);
1367    Type amount = parseType("amount", json);
1368    if (amount != null)
1369      res.setAmount(amount);
1370    if (json.has("amountType"))
1371      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
1372    if (json.has("amountText"))
1373      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
1374    if (json.has("_amountText"))
1375      parseElementProperties(json.getAsJsonObject("_amountText"), res.getAmountTextElement());
1376    if (json.has("referenceRange"))
1377      res.setReferenceRange(parseSubstanceAmountSubstanceAmountReferenceRangeComponent(json.getAsJsonObject("referenceRange"), res));
1378  }
1379
1380  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountSubstanceAmountReferenceRangeComponent(JsonObject json, SubstanceAmount owner) throws IOException, FHIRFormatError {
1381    SubstanceAmount.SubstanceAmountReferenceRangeComponent res = new SubstanceAmount.SubstanceAmountReferenceRangeComponent();
1382    parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(json, owner, res);
1383    return res;
1384  }
1385
1386  protected void parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(JsonObject json, SubstanceAmount owner, SubstanceAmount.SubstanceAmountReferenceRangeComponent res) throws IOException, FHIRFormatError {
1387    parseTypeProperties(json, res);
1388    if (json.has("lowLimit"))
1389      res.setLowLimit(parseQuantity(json.getAsJsonObject("lowLimit")));
1390    if (json.has("highLimit"))
1391      res.setHighLimit(parseQuantity(json.getAsJsonObject("highLimit")));
1392  }
1393
1394  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1395    ElementDefinition res = new ElementDefinition();
1396    parseElementDefinitionProperties(json, res);
1397    return res;
1398  }
1399
1400  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1401    parseBackboneElementProperties(json, res);
1402    if (json.has("path"))
1403      res.setPathElement(parseString(json.get("path").getAsString()));
1404    if (json.has("_path"))
1405      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1406    if (json.has("representation")) {
1407      JsonArray array = json.getAsJsonArray("representation");
1408      for (int i = 0; i < array.size(); i++) {
1409        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1410      }
1411    };
1412    if (json.has("_representation")) {
1413      JsonArray array = json.getAsJsonArray("_representation");
1414      for (int i = 0; i < array.size(); i++) {
1415        if (i == res.getRepresentation().size())
1416          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1417        if (array.get(i) instanceof JsonObject) 
1418          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1419      }
1420    };
1421    if (json.has("sliceName"))
1422      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1423    if (json.has("_sliceName"))
1424      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
1425    if (json.has("label"))
1426      res.setLabelElement(parseString(json.get("label").getAsString()));
1427    if (json.has("_label"))
1428      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1429    if (json.has("code")) {
1430      JsonArray array = json.getAsJsonArray("code");
1431      for (int i = 0; i < array.size(); i++) {
1432        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1433      }
1434    };
1435    if (json.has("slicing"))
1436      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(json.getAsJsonObject("slicing"), res));
1437    if (json.has("short"))
1438      res.setShortElement(parseString(json.get("short").getAsString()));
1439    if (json.has("_short"))
1440      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
1441    if (json.has("definition"))
1442      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1443    if (json.has("_definition"))
1444      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
1445    if (json.has("comment"))
1446      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1447    if (json.has("_comment"))
1448      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1449    if (json.has("requirements"))
1450      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1451    if (json.has("_requirements"))
1452      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1453    if (json.has("alias")) {
1454      JsonArray array = json.getAsJsonArray("alias");
1455      for (int i = 0; i < array.size(); i++) {
1456        res.getAlias().add(parseString(array.get(i).getAsString()));
1457      }
1458    };
1459    if (json.has("_alias")) {
1460      JsonArray array = json.getAsJsonArray("_alias");
1461      for (int i = 0; i < array.size(); i++) {
1462        if (i == res.getAlias().size())
1463          res.getAlias().add(parseString(null));
1464        if (array.get(i) instanceof JsonObject) 
1465          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1466      }
1467    };
1468    if (json.has("min"))
1469      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1470    if (json.has("_min"))
1471      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1472    if (json.has("max"))
1473      res.setMaxElement(parseString(json.get("max").getAsString()));
1474    if (json.has("_max"))
1475      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1476    if (json.has("base"))
1477      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(json.getAsJsonObject("base"), res));
1478    if (json.has("contentReference"))
1479      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1480    if (json.has("_contentReference"))
1481      parseElementProperties(json.getAsJsonObject("_contentReference"), res.getContentReferenceElement());
1482    if (json.has("type")) {
1483      JsonArray array = json.getAsJsonArray("type");
1484      for (int i = 0; i < array.size(); i++) {
1485        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1486      }
1487    };
1488    Type defaultValue = parseType("defaultValue", json);
1489    if (defaultValue != null)
1490      res.setDefaultValue(defaultValue);
1491    if (json.has("meaningWhenMissing"))
1492      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1493    if (json.has("_meaningWhenMissing"))
1494      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1495    if (json.has("orderMeaning"))
1496      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1497    if (json.has("_orderMeaning"))
1498      parseElementProperties(json.getAsJsonObject("_orderMeaning"), res.getOrderMeaningElement());
1499    Type fixed = parseType("fixed", json);
1500    if (fixed != null)
1501      res.setFixed(fixed);
1502    Type pattern = parseType("pattern", json);
1503    if (pattern != null)
1504      res.setPattern(pattern);
1505    if (json.has("example")) {
1506      JsonArray array = json.getAsJsonArray("example");
1507      for (int i = 0; i < array.size(); i++) {
1508        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1509      }
1510    };
1511    Type minValue = parseType("minValue", json);
1512    if (minValue != null)
1513      res.setMinValue(minValue);
1514    Type maxValue = parseType("maxValue", json);
1515    if (maxValue != null)
1516      res.setMaxValue(maxValue);
1517    if (json.has("maxLength"))
1518      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1519    if (json.has("_maxLength"))
1520      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
1521    if (json.has("condition")) {
1522      JsonArray array = json.getAsJsonArray("condition");
1523      for (int i = 0; i < array.size(); i++) {
1524        res.getCondition().add(parseId(array.get(i).getAsString()));
1525      }
1526    };
1527    if (json.has("_condition")) {
1528      JsonArray array = json.getAsJsonArray("_condition");
1529      for (int i = 0; i < array.size(); i++) {
1530        if (i == res.getCondition().size())
1531          res.getCondition().add(parseId(null));
1532        if (array.get(i) instanceof JsonObject) 
1533          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1534      }
1535    };
1536    if (json.has("constraint")) {
1537      JsonArray array = json.getAsJsonArray("constraint");
1538      for (int i = 0; i < array.size(); i++) {
1539        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1540      }
1541    };
1542    if (json.has("mustSupport"))
1543      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1544    if (json.has("_mustSupport"))
1545      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
1546    if (json.has("isModifier"))
1547      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1548    if (json.has("_isModifier"))
1549      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
1550    if (json.has("isModifierReason"))
1551      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
1552    if (json.has("_isModifierReason"))
1553      parseElementProperties(json.getAsJsonObject("_isModifierReason"), res.getIsModifierReasonElement());
1554    if (json.has("isSummary"))
1555      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1556    if (json.has("_isSummary"))
1557      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
1558    if (json.has("binding"))
1559      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(json.getAsJsonObject("binding"), res));
1560    if (json.has("mapping")) {
1561      JsonArray array = json.getAsJsonArray("mapping");
1562      for (int i = 0; i < array.size(); i++) {
1563        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1564      }
1565    };
1566  }
1567
1568  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1569    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1570    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1571    return res;
1572  }
1573
1574  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1575    parseTypeProperties(json, res);
1576    if (json.has("discriminator")) {
1577      JsonArray array = json.getAsJsonArray("discriminator");
1578      for (int i = 0; i < array.size(); i++) {
1579        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1580      }
1581    };
1582    if (json.has("description"))
1583      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1584    if (json.has("_description"))
1585      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1586    if (json.has("ordered"))
1587      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1588    if (json.has("_ordered"))
1589      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
1590    if (json.has("rules"))
1591      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1592    if (json.has("_rules"))
1593      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
1594  }
1595
1596  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1597    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1598    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1599    return res;
1600  }
1601
1602  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1603    parseTypeProperties(json, res);
1604    if (json.has("type"))
1605      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1606    if (json.has("_type"))
1607      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1608    if (json.has("path"))
1609      res.setPathElement(parseString(json.get("path").getAsString()));
1610    if (json.has("_path"))
1611      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1612  }
1613
1614  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1615    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1616    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1617    return res;
1618  }
1619
1620  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1621    parseTypeProperties(json, res);
1622    if (json.has("path"))
1623      res.setPathElement(parseString(json.get("path").getAsString()));
1624    if (json.has("_path"))
1625      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1626    if (json.has("min"))
1627      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1628    if (json.has("_min"))
1629      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1630    if (json.has("max"))
1631      res.setMaxElement(parseString(json.get("max").getAsString()));
1632    if (json.has("_max"))
1633      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1634  }
1635
1636  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1637    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1638    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1639    return res;
1640  }
1641
1642  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1643    parseTypeProperties(json, res);
1644    if (json.has("code"))
1645      res.setCodeElement(parseUri(json.get("code").getAsString()));
1646    if (json.has("_code"))
1647      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1648    if (json.has("profile")) {
1649      JsonArray array = json.getAsJsonArray("profile");
1650      for (int i = 0; i < array.size(); i++) {
1651        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1652      }
1653    };
1654    if (json.has("_profile")) {
1655      JsonArray array = json.getAsJsonArray("_profile");
1656      for (int i = 0; i < array.size(); i++) {
1657        if (i == res.getProfile().size())
1658          res.getProfile().add(parseCanonical(null));
1659        if (array.get(i) instanceof JsonObject) 
1660          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1661      }
1662    };
1663    if (json.has("targetProfile")) {
1664      JsonArray array = json.getAsJsonArray("targetProfile");
1665      for (int i = 0; i < array.size(); i++) {
1666        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1667      }
1668    };
1669    if (json.has("_targetProfile")) {
1670      JsonArray array = json.getAsJsonArray("_targetProfile");
1671      for (int i = 0; i < array.size(); i++) {
1672        if (i == res.getTargetProfile().size())
1673          res.getTargetProfile().add(parseCanonical(null));
1674        if (array.get(i) instanceof JsonObject) 
1675          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1676      }
1677    };
1678    if (json.has("aggregation")) {
1679      JsonArray array = json.getAsJsonArray("aggregation");
1680      for (int i = 0; i < array.size(); i++) {
1681        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1682      }
1683    };
1684    if (json.has("_aggregation")) {
1685      JsonArray array = json.getAsJsonArray("_aggregation");
1686      for (int i = 0; i < array.size(); i++) {
1687        if (i == res.getAggregation().size())
1688          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1689        if (array.get(i) instanceof JsonObject) 
1690          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1691      }
1692    };
1693    if (json.has("versioning"))
1694      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1695    if (json.has("_versioning"))
1696      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
1697  }
1698
1699  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1700    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1701    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
1702    return res;
1703  }
1704
1705  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1706    parseTypeProperties(json, res);
1707    if (json.has("label"))
1708      res.setLabelElement(parseString(json.get("label").getAsString()));
1709    if (json.has("_label"))
1710      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1711    Type value = parseType("value", json);
1712    if (value != null)
1713      res.setValue(value);
1714  }
1715
1716  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1717    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1718    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
1719    return res;
1720  }
1721
1722  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1723    parseTypeProperties(json, res);
1724    if (json.has("key"))
1725      res.setKeyElement(parseId(json.get("key").getAsString()));
1726    if (json.has("_key"))
1727      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
1728    if (json.has("requirements"))
1729      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1730    if (json.has("_requirements"))
1731      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1732    if (json.has("severity"))
1733      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1734    if (json.has("_severity"))
1735      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1736    if (json.has("human"))
1737      res.setHumanElement(parseString(json.get("human").getAsString()));
1738    if (json.has("_human"))
1739      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
1740    if (json.has("expression"))
1741      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1742    if (json.has("_expression"))
1743      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1744    if (json.has("xpath"))
1745      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1746    if (json.has("_xpath"))
1747      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
1748    if (json.has("source"))
1749      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1750    if (json.has("_source"))
1751      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
1752  }
1753
1754  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1755    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1756    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
1757    return res;
1758  }
1759
1760  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1761    parseTypeProperties(json, res);
1762    if (json.has("strength"))
1763      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1764    if (json.has("_strength"))
1765      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
1766    if (json.has("description"))
1767      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1768    if (json.has("_description"))
1769      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1770    Type valueSet = parseType("valueSet", json);
1771    if (valueSet != null)
1772      res.setValueSet(valueSet);
1773  }
1774
1775  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1776    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1777    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
1778    return res;
1779  }
1780
1781  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1782    parseTypeProperties(json, res);
1783    if (json.has("identity"))
1784      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1785    if (json.has("_identity"))
1786      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
1787    if (json.has("language"))
1788      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1789    if (json.has("_language"))
1790      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1791    if (json.has("map"))
1792      res.setMapElement(parseString(json.get("map").getAsString()));
1793    if (json.has("_map"))
1794      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
1795    if (json.has("comment"))
1796      res.setCommentElement(parseString(json.get("comment").getAsString()));
1797    if (json.has("_comment"))
1798      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1799  }
1800
1801  protected SubstanceMoiety parseSubstanceMoiety(JsonObject json) throws IOException, FHIRFormatError {
1802    SubstanceMoiety res = new SubstanceMoiety();
1803    parseSubstanceMoietyProperties(json, res);
1804    return res;
1805  }
1806
1807  protected void parseSubstanceMoietyProperties(JsonObject json, SubstanceMoiety res) throws IOException, FHIRFormatError {
1808    parseBackboneElementProperties(json, res);
1809    if (json.has("role"))
1810      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
1811    if (json.has("identifier"))
1812      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1813    if (json.has("name"))
1814      res.setNameElement(parseString(json.get("name").getAsString()));
1815    if (json.has("_name"))
1816      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1817    if (json.has("stereochemistry"))
1818      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
1819    if (json.has("opticalActivity"))
1820      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
1821    if (json.has("molecularFormula"))
1822      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
1823    if (json.has("_molecularFormula"))
1824      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
1825    if (json.has("amount"))
1826      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
1827  }
1828
1829  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1830    ProductShelfLife res = new ProductShelfLife();
1831    parseProductShelfLifeProperties(json, res);
1832    return res;
1833  }
1834
1835  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1836    parseBackboneElementProperties(json, res);
1837    if (json.has("identifier"))
1838      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1839    if (json.has("type"))
1840      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1841    if (json.has("period"))
1842      res.setPeriod(parseQuantity(json.getAsJsonObject("period")));
1843    if (json.has("specialPrecautionsForStorage")) {
1844      JsonArray array = json.getAsJsonArray("specialPrecautionsForStorage");
1845      for (int i = 0; i < array.size(); i++) {
1846        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1847      }
1848    };
1849  }
1850
1851  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1852    ProdCharacteristic res = new ProdCharacteristic();
1853    parseProdCharacteristicProperties(json, res);
1854    return res;
1855  }
1856
1857  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
1858    parseBackboneElementProperties(json, res);
1859    if (json.has("height"))
1860      res.setHeight(parseQuantity(json.getAsJsonObject("height")));
1861    if (json.has("width"))
1862      res.setWidth(parseQuantity(json.getAsJsonObject("width")));
1863    if (json.has("depth"))
1864      res.setDepth(parseQuantity(json.getAsJsonObject("depth")));
1865    if (json.has("weight"))
1866      res.setWeight(parseQuantity(json.getAsJsonObject("weight")));
1867    if (json.has("nominalVolume"))
1868      res.setNominalVolume(parseQuantity(json.getAsJsonObject("nominalVolume")));
1869    if (json.has("externalDiameter"))
1870      res.setExternalDiameter(parseQuantity(json.getAsJsonObject("externalDiameter")));
1871    if (json.has("shape"))
1872      res.setShapeElement(parseString(json.get("shape").getAsString()));
1873    if (json.has("_shape"))
1874      parseElementProperties(json.getAsJsonObject("_shape"), res.getShapeElement());
1875    if (json.has("color")) {
1876      JsonArray array = json.getAsJsonArray("color");
1877      for (int i = 0; i < array.size(); i++) {
1878        res.getColor().add(parseString(array.get(i).getAsString()));
1879      }
1880    };
1881    if (json.has("_color")) {
1882      JsonArray array = json.getAsJsonArray("_color");
1883      for (int i = 0; i < array.size(); i++) {
1884        if (i == res.getColor().size())
1885          res.getColor().add(parseString(null));
1886        if (array.get(i) instanceof JsonObject) 
1887          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1888      }
1889    };
1890    if (json.has("imprint")) {
1891      JsonArray array = json.getAsJsonArray("imprint");
1892      for (int i = 0; i < array.size(); i++) {
1893        res.getImprint().add(parseString(array.get(i).getAsString()));
1894      }
1895    };
1896    if (json.has("_imprint")) {
1897      JsonArray array = json.getAsJsonArray("_imprint");
1898      for (int i = 0; i < array.size(); i++) {
1899        if (i == res.getImprint().size())
1900          res.getImprint().add(parseString(null));
1901        if (array.get(i) instanceof JsonObject) 
1902          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1903      }
1904    };
1905    if (json.has("image")) {
1906      JsonArray array = json.getAsJsonArray("image");
1907      for (int i = 0; i < array.size(); i++) {
1908        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1909      }
1910    };
1911    if (json.has("scoring"))
1912      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
1913  }
1914
1915  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1916    parseResourceProperties(json, res);
1917    if (json.has("text"))
1918      res.setText(parseNarrative(json.getAsJsonObject("text")));
1919    if (json.has("contained")) {
1920      JsonArray array = json.getAsJsonArray("contained");
1921      for (int i = 0; i < array.size(); i++) {
1922        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1923      }
1924    };
1925    if (json.has("extension")) {
1926      JsonArray array = json.getAsJsonArray("extension");
1927      for (int i = 0; i < array.size(); i++) {
1928        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1929      }
1930    };
1931    if (json.has("modifierExtension")) {
1932      JsonArray array = json.getAsJsonArray("modifierExtension");
1933      for (int i = 0; i < array.size(); i++) {
1934        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1935      }
1936    };
1937  }
1938
1939  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1940    Parameters res = new Parameters();
1941    parseParametersProperties(json, res);
1942    return res;
1943  }
1944
1945  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
1946    parseResourceProperties(json, res);
1947    if (json.has("parameter")) {
1948      JsonArray array = json.getAsJsonArray("parameter");
1949      for (int i = 0; i < array.size(); i++) {
1950        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1951      }
1952    };
1953  }
1954
1955  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1956    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1957    parseParametersParametersParameterComponentProperties(json, owner, res);
1958    return res;
1959  }
1960
1961  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
1962    parseBackboneElementProperties(json, res);
1963    if (json.has("name"))
1964      res.setNameElement(parseString(json.get("name").getAsString()));
1965    if (json.has("_name"))
1966      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1967    Type value = parseType("value", json);
1968    if (value != null)
1969      res.setValue(value);
1970    if (json.has("resource"))
1971      res.setResource(parseResource(json.getAsJsonObject("resource")));
1972    if (json.has("part")) {
1973      JsonArray array = json.getAsJsonArray("part");
1974      for (int i = 0; i < array.size(); i++) {
1975        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1976      }
1977    };
1978  }
1979
1980  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1981    if (json.has("id"))
1982      res.setIdElement(parseId(json.get("id").getAsString()));
1983    if (json.has("_id"))
1984      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
1985    if (json.has("meta"))
1986      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
1987    if (json.has("implicitRules"))
1988      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1989    if (json.has("_implicitRules"))
1990      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
1991    if (json.has("language"))
1992      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1993    if (json.has("_language"))
1994      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1995  }
1996
1997  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
1998    Account res = new Account();
1999    parseAccountProperties(json, res);
2000    return res;
2001  }
2002
2003  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2004    parseDomainResourceProperties(json, res);
2005    if (json.has("identifier")) {
2006      JsonArray array = json.getAsJsonArray("identifier");
2007      for (int i = 0; i < array.size(); i++) {
2008        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2009      }
2010    };
2011    if (json.has("status"))
2012      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2013    if (json.has("_status"))
2014      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2015    if (json.has("type"))
2016      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2017    if (json.has("name"))
2018      res.setNameElement(parseString(json.get("name").getAsString()));
2019    if (json.has("_name"))
2020      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2021    if (json.has("subject"))
2022      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2023    if (json.has("servicePeriod"))
2024      res.setServicePeriod(parsePeriod(json.getAsJsonObject("servicePeriod")));
2025    if (json.has("coverage")) {
2026      JsonArray array = json.getAsJsonArray("coverage");
2027      for (int i = 0; i < array.size(); i++) {
2028        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
2029      }
2030    };
2031    if (json.has("owner"))
2032      res.setOwner(parseReference(json.getAsJsonObject("owner")));
2033    if (json.has("description"))
2034      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2035    if (json.has("_description"))
2036      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2037    if (json.has("guarantor")) {
2038      JsonArray array = json.getAsJsonArray("guarantor");
2039      for (int i = 0; i < array.size(); i++) {
2040        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
2041      }
2042    };
2043    if (json.has("partOf"))
2044      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
2045  }
2046
2047  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2048    Account.CoverageComponent res = new Account.CoverageComponent();
2049    parseAccountCoverageComponentProperties(json, owner, res);
2050    return res;
2051  }
2052
2053  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2054    parseBackboneElementProperties(json, res);
2055    if (json.has("coverage"))
2056      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
2057    if (json.has("priority"))
2058      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2059    if (json.has("_priority"))
2060      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2061  }
2062
2063  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2064    Account.GuarantorComponent res = new Account.GuarantorComponent();
2065    parseAccountGuarantorComponentProperties(json, owner, res);
2066    return res;
2067  }
2068
2069  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2070    parseBackboneElementProperties(json, res);
2071    if (json.has("party"))
2072      res.setParty(parseReference(json.getAsJsonObject("party")));
2073    if (json.has("onHold"))
2074      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2075    if (json.has("_onHold"))
2076      parseElementProperties(json.getAsJsonObject("_onHold"), res.getOnHoldElement());
2077    if (json.has("period"))
2078      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2079  }
2080
2081  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2082    ActivityDefinition res = new ActivityDefinition();
2083    parseActivityDefinitionProperties(json, res);
2084    return res;
2085  }
2086
2087  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2088    parseDomainResourceProperties(json, res);
2089    if (json.has("url"))
2090      res.setUrlElement(parseUri(json.get("url").getAsString()));
2091    if (json.has("_url"))
2092      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2093    if (json.has("identifier")) {
2094      JsonArray array = json.getAsJsonArray("identifier");
2095      for (int i = 0; i < array.size(); i++) {
2096        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2097      }
2098    };
2099    if (json.has("version"))
2100      res.setVersionElement(parseString(json.get("version").getAsString()));
2101    if (json.has("_version"))
2102      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
2103    if (json.has("name"))
2104      res.setNameElement(parseString(json.get("name").getAsString()));
2105    if (json.has("_name"))
2106      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2107    if (json.has("title"))
2108      res.setTitleElement(parseString(json.get("title").getAsString()));
2109    if (json.has("_title"))
2110      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
2111    if (json.has("subtitle"))
2112      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2113    if (json.has("_subtitle"))
2114      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
2115    if (json.has("status"))
2116      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2117    if (json.has("_status"))
2118      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2119    if (json.has("experimental"))
2120      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2121    if (json.has("_experimental"))
2122      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
2123    Type subject = parseType("subject", json);
2124    if (subject != null)
2125      res.setSubject(subject);
2126    if (json.has("date"))
2127      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2128    if (json.has("_date"))
2129      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2130    if (json.has("publisher"))
2131      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2132    if (json.has("_publisher"))
2133      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
2134    if (json.has("contact")) {
2135      JsonArray array = json.getAsJsonArray("contact");
2136      for (int i = 0; i < array.size(); i++) {
2137        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2138      }
2139    };
2140    if (json.has("description"))
2141      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2142    if (json.has("_description"))
2143      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2144    if (json.has("useContext")) {
2145      JsonArray array = json.getAsJsonArray("useContext");
2146      for (int i = 0; i < array.size(); i++) {
2147        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2148      }
2149    };
2150    if (json.has("jurisdiction")) {
2151      JsonArray array = json.getAsJsonArray("jurisdiction");
2152      for (int i = 0; i < array.size(); i++) {
2153        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2154      }
2155    };
2156    if (json.has("purpose"))
2157      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2158    if (json.has("_purpose"))
2159      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
2160    if (json.has("usage"))
2161      res.setUsageElement(parseString(json.get("usage").getAsString()));
2162    if (json.has("_usage"))
2163      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
2164    if (json.has("copyright"))
2165      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2166    if (json.has("_copyright"))
2167      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
2168    if (json.has("approvalDate"))
2169      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2170    if (json.has("_approvalDate"))
2171      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
2172    if (json.has("lastReviewDate"))
2173      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2174    if (json.has("_lastReviewDate"))
2175      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
2176    if (json.has("effectivePeriod"))
2177      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
2178    if (json.has("topic")) {
2179      JsonArray array = json.getAsJsonArray("topic");
2180      for (int i = 0; i < array.size(); i++) {
2181        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2182      }
2183    };
2184    if (json.has("contributor")) {
2185      JsonArray array = json.getAsJsonArray("contributor");
2186      for (int i = 0; i < array.size(); i++) {
2187        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
2188      }
2189    };
2190    if (json.has("relatedArtifact")) {
2191      JsonArray array = json.getAsJsonArray("relatedArtifact");
2192      for (int i = 0; i < array.size(); i++) {
2193        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2194      }
2195    };
2196    if (json.has("library")) {
2197      JsonArray array = json.getAsJsonArray("library");
2198      for (int i = 0; i < array.size(); i++) {
2199        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2200      }
2201    };
2202    if (json.has("_library")) {
2203      JsonArray array = json.getAsJsonArray("_library");
2204      for (int i = 0; i < array.size(); i++) {
2205        if (i == res.getLibrary().size())
2206          res.getLibrary().add(parseCanonical(null));
2207        if (array.get(i) instanceof JsonObject) 
2208          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2209      }
2210    };
2211    if (json.has("kind"))
2212      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
2213    if (json.has("_kind"))
2214      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
2215    if (json.has("code"))
2216      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2217    if (json.has("doNotPerform"))
2218      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2219    if (json.has("_doNotPerform"))
2220      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
2221    Type timing = parseType("timing", json);
2222    if (timing != null)
2223      res.setTiming(timing);
2224    if (json.has("location"))
2225      res.setLocation(parseReference(json.getAsJsonObject("location")));
2226    if (json.has("participant")) {
2227      JsonArray array = json.getAsJsonArray("participant");
2228      for (int i = 0; i < array.size(); i++) {
2229        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
2230      }
2231    };
2232    Type product = parseType("product", json);
2233    if (product != null)
2234      res.setProduct(product);
2235    if (json.has("quantity"))
2236      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
2237    if (json.has("dosage")) {
2238      JsonArray array = json.getAsJsonArray("dosage");
2239      for (int i = 0; i < array.size(); i++) {
2240        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2241      }
2242    };
2243    if (json.has("bodySite")) {
2244      JsonArray array = json.getAsJsonArray("bodySite");
2245      for (int i = 0; i < array.size(); i++) {
2246        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2247      }
2248    };
2249    if (json.has("specimenRequirement")) {
2250      JsonArray array = json.getAsJsonArray("specimenRequirement");
2251      for (int i = 0; i < array.size(); i++) {
2252        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2253      }
2254    };
2255    if (json.has("transform"))
2256      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2257    if (json.has("_transform"))
2258      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
2259    if (json.has("dynamicValue")) {
2260      JsonArray array = json.getAsJsonArray("dynamicValue");
2261      for (int i = 0; i < array.size(); i++) {
2262        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
2263      }
2264    };
2265  }
2266
2267  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2268    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2269    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
2270    return res;
2271  }
2272
2273  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2274    parseBackboneElementProperties(json, res);
2275    if (json.has("type"))
2276      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
2277    if (json.has("_type"))
2278      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2279    if (json.has("role"))
2280      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
2281  }
2282
2283  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2284    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2285    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
2286    return res;
2287  }
2288
2289  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2290    parseBackboneElementProperties(json, res);
2291    if (json.has("description"))
2292      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2293    if (json.has("_description"))
2294      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2295    if (json.has("path"))
2296      res.setPathElement(parseString(json.get("path").getAsString()));
2297    if (json.has("_path"))
2298      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
2299    if (json.has("language"))
2300      res.setLanguageElement(parseString(json.get("language").getAsString()));
2301    if (json.has("_language"))
2302      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
2303    if (json.has("expression"))
2304      res.setExpressionElement(parseString(json.get("expression").getAsString()));
2305    if (json.has("_expression"))
2306      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
2307  }
2308
2309  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2310    AdverseEvent res = new AdverseEvent();
2311    parseAdverseEventProperties(json, res);
2312    return res;
2313  }
2314
2315  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2316    parseDomainResourceProperties(json, res);
2317    if (json.has("identifier"))
2318      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2319    if (json.has("actuality"))
2320      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2321    if (json.has("_actuality"))
2322      parseElementProperties(json.getAsJsonObject("_actuality"), res.getActualityElement());
2323    if (json.has("category")) {
2324      JsonArray array = json.getAsJsonArray("category");
2325      for (int i = 0; i < array.size(); i++) {
2326        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2327      }
2328    };
2329    if (json.has("event"))
2330      res.setEvent(parseCodeableConcept(json.getAsJsonObject("event")));
2331    if (json.has("subject"))
2332      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2333    if (json.has("context"))
2334      res.setContext(parseReference(json.getAsJsonObject("context")));
2335    if (json.has("date"))
2336      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2337    if (json.has("_date"))
2338      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2339    if (json.has("resultingCondition")) {
2340      JsonArray array = json.getAsJsonArray("resultingCondition");
2341      for (int i = 0; i < array.size(); i++) {
2342        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2343      }
2344    };
2345    if (json.has("location"))
2346      res.setLocation(parseReference(json.getAsJsonObject("location")));
2347    if (json.has("seriousness"))
2348      res.setSeriousness(parseCodeableConcept(json.getAsJsonObject("seriousness")));
2349    if (json.has("severity"))
2350      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
2351    if (json.has("outcome"))
2352      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
2353    if (json.has("recorder"))
2354      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2355    if (json.has("contributor")) {
2356      JsonArray array = json.getAsJsonArray("contributor");
2357      for (int i = 0; i < array.size(); i++) {
2358        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
2359      }
2360    };
2361    if (json.has("suspectEntity")) {
2362      JsonArray array = json.getAsJsonArray("suspectEntity");
2363      for (int i = 0; i < array.size(); i++) {
2364        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2365      }
2366    };
2367    if (json.has("subjectMedicalHistory")) {
2368      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2369      for (int i = 0; i < array.size(); i++) {
2370        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2371      }
2372    };
2373    if (json.has("referenceDocument")) {
2374      JsonArray array = json.getAsJsonArray("referenceDocument");
2375      for (int i = 0; i < array.size(); i++) {
2376        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2377      }
2378    };
2379    if (json.has("study")) {
2380      JsonArray array = json.getAsJsonArray("study");
2381      for (int i = 0; i < array.size(); i++) {
2382        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2383      }
2384    };
2385  }
2386
2387  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2388    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2389    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2390    return res;
2391  }
2392
2393  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2394    parseBackboneElementProperties(json, res);
2395    if (json.has("instance"))
2396      res.setInstance(parseReference(json.getAsJsonObject("instance")));
2397    if (json.has("causality")) {
2398      JsonArray array = json.getAsJsonArray("causality");
2399      for (int i = 0; i < array.size(); i++) {
2400        res.getCausality().add(parseAdverseEventAdverseEventSuspectEntityCausalityComponent(array.get(i).getAsJsonObject(), owner));
2401      }
2402    };
2403  }
2404
2405  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventAdverseEventSuspectEntityCausalityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2406    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2407    parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(json, owner, res);
2408    return res;
2409  }
2410
2411  protected void parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
2412    parseBackboneElementProperties(json, res);
2413    if (json.has("assessment"))
2414      res.setAssessment(parseCodeableConcept(json.getAsJsonObject("assessment")));
2415    if (json.has("productRelatedness"))
2416      res.setProductRelatednessElement(parseString(json.get("productRelatedness").getAsString()));
2417    if (json.has("_productRelatedness"))
2418      parseElementProperties(json.getAsJsonObject("_productRelatedness"), res.getProductRelatednessElement());
2419    if (json.has("author"))
2420      res.setAuthor(parseReference(json.getAsJsonObject("author")));
2421    if (json.has("method"))
2422      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
2423  }
2424
2425  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2426    AllergyIntolerance res = new AllergyIntolerance();
2427    parseAllergyIntoleranceProperties(json, res);
2428    return res;
2429  }
2430
2431  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2432    parseDomainResourceProperties(json, res);
2433    if (json.has("identifier")) {
2434      JsonArray array = json.getAsJsonArray("identifier");
2435      for (int i = 0; i < array.size(); i++) {
2436        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2437      }
2438    };
2439    if (json.has("clinicalStatus"))
2440      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL, new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory()));
2441    if (json.has("_clinicalStatus"))
2442      parseElementProperties(json.getAsJsonObject("_clinicalStatus"), res.getClinicalStatusElement());
2443    if (json.has("verificationStatus"))
2444      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL, new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory()));
2445    if (json.has("_verificationStatus"))
2446      parseElementProperties(json.getAsJsonObject("_verificationStatus"), res.getVerificationStatusElement());
2447    if (json.has("type"))
2448      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2449    if (json.has("_type"))
2450      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2451    if (json.has("category")) {
2452      JsonArray array = json.getAsJsonArray("category");
2453      for (int i = 0; i < array.size(); i++) {
2454        res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2455      }
2456    };
2457    if (json.has("_category")) {
2458      JsonArray array = json.getAsJsonArray("_category");
2459      for (int i = 0; i < array.size(); i++) {
2460        if (i == res.getCategory().size())
2461          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2462        if (array.get(i) instanceof JsonObject) 
2463          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2464      }
2465    };
2466    if (json.has("criticality"))
2467      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2468    if (json.has("_criticality"))
2469      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
2470    if (json.has("code"))
2471      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2472    if (json.has("patient"))
2473      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2474    if (json.has("encounter"))
2475      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2476    Type onset = parseType("onset", json);
2477    if (onset != null)
2478      res.setOnset(onset);
2479    if (json.has("assertedDate"))
2480      res.setAssertedDateElement(parseDateTime(json.get("assertedDate").getAsString()));
2481    if (json.has("_assertedDate"))
2482      parseElementProperties(json.getAsJsonObject("_assertedDate"), res.getAssertedDateElement());
2483    if (json.has("recorder"))
2484      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2485    if (json.has("asserter"))
2486      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
2487    if (json.has("lastOccurrence"))
2488      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2489    if (json.has("_lastOccurrence"))
2490      parseElementProperties(json.getAsJsonObject("_lastOccurrence"), res.getLastOccurrenceElement());
2491    if (json.has("note")) {
2492      JsonArray array = json.getAsJsonArray("note");
2493      for (int i = 0; i < array.size(); i++) {
2494        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2495      }
2496    };
2497    if (json.has("reaction")) {
2498      JsonArray array = json.getAsJsonArray("reaction");
2499      for (int i = 0; i < array.size(); i++) {
2500        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2501      }
2502    };
2503  }
2504
2505  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2506    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2507    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2508    return res;
2509  }
2510
2511  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2512    parseBackboneElementProperties(json, res);
2513    if (json.has("substance"))
2514      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
2515    if (json.has("manifestation")) {
2516      JsonArray array = json.getAsJsonArray("manifestation");
2517      for (int i = 0; i < array.size(); i++) {
2518        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2519      }
2520    };
2521    if (json.has("description"))
2522      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2523    if (json.has("_description"))
2524      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2525    if (json.has("onset"))
2526      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2527    if (json.has("_onset"))
2528      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
2529    if (json.has("severity"))
2530      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2531    if (json.has("_severity"))
2532      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
2533    if (json.has("exposureRoute"))
2534      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
2535    if (json.has("note")) {
2536      JsonArray array = json.getAsJsonArray("note");
2537      for (int i = 0; i < array.size(); i++) {
2538        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2539      }
2540    };
2541  }
2542
2543  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2544    Appointment res = new Appointment();
2545    parseAppointmentProperties(json, res);
2546    return res;
2547  }
2548
2549  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2550    parseDomainResourceProperties(json, res);
2551    if (json.has("identifier")) {
2552      JsonArray array = json.getAsJsonArray("identifier");
2553      for (int i = 0; i < array.size(); i++) {
2554        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2555      }
2556    };
2557    if (json.has("status"))
2558      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2559    if (json.has("_status"))
2560      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2561    if (json.has("serviceCategory")) {
2562      JsonArray array = json.getAsJsonArray("serviceCategory");
2563      for (int i = 0; i < array.size(); i++) {
2564        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2565      }
2566    };
2567    if (json.has("serviceType")) {
2568      JsonArray array = json.getAsJsonArray("serviceType");
2569      for (int i = 0; i < array.size(); i++) {
2570        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2571      }
2572    };
2573    if (json.has("specialty")) {
2574      JsonArray array = json.getAsJsonArray("specialty");
2575      for (int i = 0; i < array.size(); i++) {
2576        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2577      }
2578    };
2579    if (json.has("appointmentType"))
2580      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
2581    if (json.has("reason")) {
2582      JsonArray array = json.getAsJsonArray("reason");
2583      for (int i = 0; i < array.size(); i++) {
2584        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2585      }
2586    };
2587    if (json.has("indication")) {
2588      JsonArray array = json.getAsJsonArray("indication");
2589      for (int i = 0; i < array.size(); i++) {
2590        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
2591      }
2592    };
2593    if (json.has("priority"))
2594      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2595    if (json.has("_priority"))
2596      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2597    if (json.has("description"))
2598      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2599    if (json.has("_description"))
2600      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2601    if (json.has("supportingInformation")) {
2602      JsonArray array = json.getAsJsonArray("supportingInformation");
2603      for (int i = 0; i < array.size(); i++) {
2604        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2605      }
2606    };
2607    if (json.has("start"))
2608      res.setStartElement(parseInstant(json.get("start").getAsString()));
2609    if (json.has("_start"))
2610      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2611    if (json.has("end"))
2612      res.setEndElement(parseInstant(json.get("end").getAsString()));
2613    if (json.has("_end"))
2614      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2615    if (json.has("minutesDuration"))
2616      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2617    if (json.has("_minutesDuration"))
2618      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
2619    if (json.has("slot")) {
2620      JsonArray array = json.getAsJsonArray("slot");
2621      for (int i = 0; i < array.size(); i++) {
2622        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2623      }
2624    };
2625    if (json.has("created"))
2626      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2627    if (json.has("_created"))
2628      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2629    if (json.has("comment"))
2630      res.setCommentElement(parseString(json.get("comment").getAsString()));
2631    if (json.has("_comment"))
2632      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2633    if (json.has("patientInstruction"))
2634      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
2635    if (json.has("_patientInstruction"))
2636      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
2637    if (json.has("basedOn")) {
2638      JsonArray array = json.getAsJsonArray("basedOn");
2639      for (int i = 0; i < array.size(); i++) {
2640        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
2641      }
2642    };
2643    if (json.has("participant")) {
2644      JsonArray array = json.getAsJsonArray("participant");
2645      for (int i = 0; i < array.size(); i++) {
2646        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
2647      }
2648    };
2649    if (json.has("requestedPeriod")) {
2650      JsonArray array = json.getAsJsonArray("requestedPeriod");
2651      for (int i = 0; i < array.size(); i++) {
2652        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2653      }
2654    };
2655  }
2656
2657  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
2658    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2659    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
2660    return res;
2661  }
2662
2663  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2664    parseBackboneElementProperties(json, res);
2665    if (json.has("type")) {
2666      JsonArray array = json.getAsJsonArray("type");
2667      for (int i = 0; i < array.size(); i++) {
2668        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2669      }
2670    };
2671    if (json.has("actor"))
2672      res.setActor(parseReference(json.getAsJsonObject("actor")));
2673    if (json.has("required"))
2674      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2675    if (json.has("_required"))
2676      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
2677    if (json.has("status"))
2678      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
2679    if (json.has("_status"))
2680      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2681    if (json.has("period"))
2682      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2683  }
2684
2685  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2686    AppointmentResponse res = new AppointmentResponse();
2687    parseAppointmentResponseProperties(json, res);
2688    return res;
2689  }
2690
2691  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2692    parseDomainResourceProperties(json, res);
2693    if (json.has("identifier")) {
2694      JsonArray array = json.getAsJsonArray("identifier");
2695      for (int i = 0; i < array.size(); i++) {
2696        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2697      }
2698    };
2699    if (json.has("appointment"))
2700      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
2701    if (json.has("start"))
2702      res.setStartElement(parseInstant(json.get("start").getAsString()));
2703    if (json.has("_start"))
2704      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2705    if (json.has("end"))
2706      res.setEndElement(parseInstant(json.get("end").getAsString()));
2707    if (json.has("_end"))
2708      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2709    if (json.has("participantType")) {
2710      JsonArray array = json.getAsJsonArray("participantType");
2711      for (int i = 0; i < array.size(); i++) {
2712        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2713      }
2714    };
2715    if (json.has("actor"))
2716      res.setActor(parseReference(json.getAsJsonObject("actor")));
2717    if (json.has("participantStatus"))
2718      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
2719    if (json.has("_participantStatus"))
2720      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
2721    if (json.has("comment"))
2722      res.setCommentElement(parseString(json.get("comment").getAsString()));
2723    if (json.has("_comment"))
2724      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2725  }
2726
2727  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2728    AuditEvent res = new AuditEvent();
2729    parseAuditEventProperties(json, res);
2730    return res;
2731  }
2732
2733  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2734    parseDomainResourceProperties(json, res);
2735    if (json.has("type"))
2736      res.setType(parseCoding(json.getAsJsonObject("type")));
2737    if (json.has("subtype")) {
2738      JsonArray array = json.getAsJsonArray("subtype");
2739      for (int i = 0; i < array.size(); i++) {
2740        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2741      }
2742    };
2743    if (json.has("action"))
2744      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2745    if (json.has("_action"))
2746      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
2747    if (json.has("period"))
2748      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2749    if (json.has("recorded"))
2750      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2751    if (json.has("_recorded"))
2752      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
2753    if (json.has("outcome"))
2754      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2755    if (json.has("_outcome"))
2756      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
2757    if (json.has("outcomeDesc"))
2758      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2759    if (json.has("_outcomeDesc"))
2760      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
2761    if (json.has("purposeOfEvent")) {
2762      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2763      for (int i = 0; i < array.size(); i++) {
2764        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2765      }
2766    };
2767    if (json.has("agent")) {
2768      JsonArray array = json.getAsJsonArray("agent");
2769      for (int i = 0; i < array.size(); i++) {
2770        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2771      }
2772    };
2773    if (json.has("source"))
2774      res.setSource(parseAuditEventAuditEventSourceComponent(json.getAsJsonObject("source"), res));
2775    if (json.has("entity")) {
2776      JsonArray array = json.getAsJsonArray("entity");
2777      for (int i = 0; i < array.size(); i++) {
2778        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2779      }
2780    };
2781  }
2782
2783  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2784    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2785    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
2786    return res;
2787  }
2788
2789  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
2790    parseBackboneElementProperties(json, res);
2791    if (json.has("type"))
2792      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2793    if (json.has("role")) {
2794      JsonArray array = json.getAsJsonArray("role");
2795      for (int i = 0; i < array.size(); i++) {
2796        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2797      }
2798    };
2799    if (json.has("reference"))
2800      res.setReference(parseReference(json.getAsJsonObject("reference")));
2801    if (json.has("userId"))
2802      res.setUserId(parseIdentifier(json.getAsJsonObject("userId")));
2803    if (json.has("altId"))
2804      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2805    if (json.has("_altId"))
2806      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
2807    if (json.has("name"))
2808      res.setNameElement(parseString(json.get("name").getAsString()));
2809    if (json.has("_name"))
2810      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2811    if (json.has("requestor"))
2812      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2813    if (json.has("_requestor"))
2814      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
2815    if (json.has("location"))
2816      res.setLocation(parseReference(json.getAsJsonObject("location")));
2817    if (json.has("policy")) {
2818      JsonArray array = json.getAsJsonArray("policy");
2819      for (int i = 0; i < array.size(); i++) {
2820        res.getPolicy().add(parseUri(array.get(i).getAsString()));
2821      }
2822    };
2823    if (json.has("_policy")) {
2824      JsonArray array = json.getAsJsonArray("_policy");
2825      for (int i = 0; i < array.size(); i++) {
2826        if (i == res.getPolicy().size())
2827          res.getPolicy().add(parseUri(null));
2828        if (array.get(i) instanceof JsonObject) 
2829          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2830      }
2831    };
2832    if (json.has("media"))
2833      res.setMedia(parseCoding(json.getAsJsonObject("media")));
2834    if (json.has("network"))
2835      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(json.getAsJsonObject("network"), owner));
2836    if (json.has("purposeOfUse")) {
2837      JsonArray array = json.getAsJsonArray("purposeOfUse");
2838      for (int i = 0; i < array.size(); i++) {
2839        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2840      }
2841    };
2842  }
2843
2844  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2845    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2846    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
2847    return res;
2848  }
2849
2850  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
2851    parseBackboneElementProperties(json, res);
2852    if (json.has("address"))
2853      res.setAddressElement(parseString(json.get("address").getAsString()));
2854    if (json.has("_address"))
2855      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
2856    if (json.has("type"))
2857      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
2858    if (json.has("_type"))
2859      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2860  }
2861
2862  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2863    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2864    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
2865    return res;
2866  }
2867
2868  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
2869    parseBackboneElementProperties(json, res);
2870    if (json.has("site"))
2871      res.setSiteElement(parseString(json.get("site").getAsString()));
2872    if (json.has("_site"))
2873      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
2874    if (json.has("identifier"))
2875      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2876    if (json.has("type")) {
2877      JsonArray array = json.getAsJsonArray("type");
2878      for (int i = 0; i < array.size(); i++) {
2879        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
2880      }
2881    };
2882  }
2883
2884  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2885    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
2886    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
2887    return res;
2888  }
2889
2890  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
2891    parseBackboneElementProperties(json, res);
2892    if (json.has("identifier"))
2893      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2894    if (json.has("reference"))
2895      res.setReference(parseReference(json.getAsJsonObject("reference")));
2896    if (json.has("type"))
2897      res.setType(parseCoding(json.getAsJsonObject("type")));
2898    if (json.has("role"))
2899      res.setRole(parseCoding(json.getAsJsonObject("role")));
2900    if (json.has("lifecycle"))
2901      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
2902    if (json.has("securityLabel")) {
2903      JsonArray array = json.getAsJsonArray("securityLabel");
2904      for (int i = 0; i < array.size(); i++) {
2905        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
2906      }
2907    };
2908    if (json.has("name"))
2909      res.setNameElement(parseString(json.get("name").getAsString()));
2910    if (json.has("_name"))
2911      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2912    if (json.has("description"))
2913      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2914    if (json.has("_description"))
2915      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2916    if (json.has("query"))
2917      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
2918    if (json.has("_query"))
2919      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
2920    if (json.has("detail")) {
2921      JsonArray array = json.getAsJsonArray("detail");
2922      for (int i = 0; i < array.size(); i++) {
2923        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
2924      }
2925    };
2926  }
2927
2928  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2929    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
2930    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
2931    return res;
2932  }
2933
2934  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
2935    parseBackboneElementProperties(json, res);
2936    if (json.has("type"))
2937      res.setTypeElement(parseString(json.get("type").getAsString()));
2938    if (json.has("_type"))
2939      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2940    Type value = parseType("value", json);
2941    if (value != null)
2942      res.setValue(value);
2943  }
2944
2945  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
2946    Basic res = new Basic();
2947    parseBasicProperties(json, res);
2948    return res;
2949  }
2950
2951  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
2952    parseDomainResourceProperties(json, res);
2953    if (json.has("identifier")) {
2954      JsonArray array = json.getAsJsonArray("identifier");
2955      for (int i = 0; i < array.size(); i++) {
2956        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2957      }
2958    };
2959    if (json.has("code"))
2960      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2961    if (json.has("subject"))
2962      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2963    if (json.has("created"))
2964      res.setCreatedElement(parseDate(json.get("created").getAsString()));
2965    if (json.has("_created"))
2966      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2967    if (json.has("author"))
2968      res.setAuthor(parseReference(json.getAsJsonObject("author")));
2969  }
2970
2971  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
2972    Binary res = new Binary();
2973    parseBinaryProperties(json, res);
2974    return res;
2975  }
2976
2977  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
2978    parseResourceProperties(json, res);
2979    if (json.has("contentType"))
2980      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
2981    if (json.has("_contentType"))
2982      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
2983    if (json.has("securityContext"))
2984      res.setSecurityContext(parseReference(json.getAsJsonObject("securityContext")));
2985    if (json.has("content"))
2986      res.setContentElement(parseBase64Binary(json.get("content").getAsString()));
2987    if (json.has("_content"))
2988      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
2989  }
2990
2991  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
2992    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
2993    parseBiologicallyDerivedProductProperties(json, res);
2994    return res;
2995  }
2996
2997  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
2998    parseDomainResourceProperties(json, res);
2999    if (json.has("identifier")) {
3000      JsonArray array = json.getAsJsonArray("identifier");
3001      for (int i = 0; i < array.size(); i++) {
3002        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3003      }
3004    };
3005    if (json.has("productCategory"))
3006      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3007    if (json.has("_productCategory"))
3008      parseElementProperties(json.getAsJsonObject("_productCategory"), res.getProductCategoryElement());
3009    if (json.has("productCode"))
3010      res.setProductCode(parseCodeableConcept(json.getAsJsonObject("productCode")));
3011    if (json.has("status"))
3012      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3013    if (json.has("_status"))
3014      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3015    if (json.has("request")) {
3016      JsonArray array = json.getAsJsonArray("request");
3017      for (int i = 0; i < array.size(); i++) {
3018        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3019      }
3020    };
3021    if (json.has("quantity"))
3022      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
3023    if (json.has("_quantity"))
3024      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
3025    if (json.has("parent"))
3026      res.setParent(parseReference(json.getAsJsonObject("parent")));
3027    if (json.has("collection"))
3028      res.setCollection(parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(json.getAsJsonObject("collection"), res));
3029    if (json.has("processing")) {
3030      JsonArray array = json.getAsJsonArray("processing");
3031      for (int i = 0; i < array.size(); i++) {
3032        res.getProcessing().add(parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(array.get(i).getAsJsonObject(), res));
3033      }
3034    };
3035    if (json.has("manipulation"))
3036      res.setManipulation(parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(json.getAsJsonObject("manipulation"), res));
3037    if (json.has("storage")) {
3038      JsonArray array = json.getAsJsonArray("storage");
3039      for (int i = 0; i < array.size(); i++) {
3040        res.getStorage().add(parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(array.get(i).getAsJsonObject(), res));
3041      }
3042    };
3043  }
3044
3045  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3046    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3047    parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(json, owner, res);
3048    return res;
3049  }
3050
3051  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
3052    parseBackboneElementProperties(json, res);
3053    if (json.has("collector"))
3054      res.setCollector(parseReference(json.getAsJsonObject("collector")));
3055    if (json.has("source"))
3056      res.setSource(parseReference(json.getAsJsonObject("source")));
3057    Type collected = parseType("collected", json);
3058    if (collected != null)
3059      res.setCollected(collected);
3060  }
3061
3062  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3063    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
3064    parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(json, owner, res);
3065    return res;
3066  }
3067
3068  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res) throws IOException, FHIRFormatError {
3069    parseBackboneElementProperties(json, res);
3070    if (json.has("description"))
3071      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3072    if (json.has("_description"))
3073      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3074    if (json.has("procedure"))
3075      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
3076    if (json.has("additive"))
3077      res.setAdditive(parseReference(json.getAsJsonObject("additive")));
3078    Type time = parseType("time", json);
3079    if (time != null)
3080      res.setTime(time);
3081  }
3082
3083  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3084    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
3085    parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(json, owner, res);
3086    return res;
3087  }
3088
3089  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res) throws IOException, FHIRFormatError {
3090    parseBackboneElementProperties(json, res);
3091    if (json.has("description"))
3092      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3093    if (json.has("_description"))
3094      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3095    Type time = parseType("time", json);
3096    if (time != null)
3097      res.setTime(time);
3098  }
3099
3100  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3101    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
3102    parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(json, owner, res);
3103    return res;
3104  }
3105
3106  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res) throws IOException, FHIRFormatError {
3107    parseBackboneElementProperties(json, res);
3108    if (json.has("description"))
3109      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3110    if (json.has("_description"))
3111      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3112    if (json.has("temperature"))
3113      res.setTemperatureElement(parseDecimal(json.get("temperature").getAsBigDecimal()));
3114    if (json.has("_temperature"))
3115      parseElementProperties(json.getAsJsonObject("_temperature"), res.getTemperatureElement());
3116    if (json.has("scale"))
3117      res.setScaleElement(parseEnumeration(json.get("scale").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
3118    if (json.has("_scale"))
3119      parseElementProperties(json.getAsJsonObject("_scale"), res.getScaleElement());
3120    if (json.has("duration"))
3121      res.setDuration(parsePeriod(json.getAsJsonObject("duration")));
3122  }
3123
3124  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3125    BodyStructure res = new BodyStructure();
3126    parseBodyStructureProperties(json, res);
3127    return res;
3128  }
3129
3130  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3131    parseDomainResourceProperties(json, res);
3132    if (json.has("identifier")) {
3133      JsonArray array = json.getAsJsonArray("identifier");
3134      for (int i = 0; i < array.size(); i++) {
3135        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3136      }
3137    };
3138    if (json.has("active"))
3139      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3140    if (json.has("_active"))
3141      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
3142    if (json.has("morphology"))
3143      res.setMorphology(parseCodeableConcept(json.getAsJsonObject("morphology")));
3144    if (json.has("location"))
3145      res.setLocation(parseCodeableConcept(json.getAsJsonObject("location")));
3146    if (json.has("locationQualifier")) {
3147      JsonArray array = json.getAsJsonArray("locationQualifier");
3148      for (int i = 0; i < array.size(); i++) {
3149        res.getLocationQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3150      }
3151    };
3152    if (json.has("description"))
3153      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3154    if (json.has("_description"))
3155      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3156    if (json.has("image")) {
3157      JsonArray array = json.getAsJsonArray("image");
3158      for (int i = 0; i < array.size(); i++) {
3159        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3160      }
3161    };
3162    if (json.has("patient"))
3163      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3164  }
3165
3166  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3167    Bundle res = new Bundle();
3168    parseBundleProperties(json, res);
3169    return res;
3170  }
3171
3172  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3173    parseResourceProperties(json, res);
3174    if (json.has("identifier"))
3175      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3176    if (json.has("type"))
3177      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3178    if (json.has("_type"))
3179      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3180    if (json.has("timestamp"))
3181      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3182    if (json.has("_timestamp"))
3183      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
3184    if (json.has("total"))
3185      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3186    if (json.has("_total"))
3187      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
3188    if (json.has("link")) {
3189      JsonArray array = json.getAsJsonArray("link");
3190      for (int i = 0; i < array.size(); i++) {
3191        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
3192      }
3193    };
3194    if (json.has("entry")) {
3195      JsonArray array = json.getAsJsonArray("entry");
3196      for (int i = 0; i < array.size(); i++) {
3197        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
3198      }
3199    };
3200    if (json.has("signature"))
3201      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
3202  }
3203
3204  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3205    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3206    parseBundleBundleLinkComponentProperties(json, owner, res);
3207    return res;
3208  }
3209
3210  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
3211    parseBackboneElementProperties(json, res);
3212    if (json.has("relation"))
3213      res.setRelationElement(parseString(json.get("relation").getAsString()));
3214    if (json.has("_relation"))
3215      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
3216    if (json.has("url"))
3217      res.setUrlElement(parseUri(json.get("url").getAsString()));
3218    if (json.has("_url"))
3219      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3220  }
3221
3222  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3223    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3224    parseBundleBundleEntryComponentProperties(json, owner, res);
3225    return res;
3226  }
3227
3228  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3229    parseBackboneElementProperties(json, res);
3230    if (json.has("link")) {
3231      JsonArray array = json.getAsJsonArray("link");
3232      for (int i = 0; i < array.size(); i++) {
3233        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
3234      }
3235    };
3236    if (json.has("fullUrl"))
3237      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3238    if (json.has("_fullUrl"))
3239      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
3240    if (json.has("resource"))
3241      res.setResource(parseResource(json.getAsJsonObject("resource")));
3242    if (json.has("search"))
3243      res.setSearch(parseBundleBundleEntrySearchComponent(json.getAsJsonObject("search"), owner));
3244    if (json.has("request"))
3245      res.setRequest(parseBundleBundleEntryRequestComponent(json.getAsJsonObject("request"), owner));
3246    if (json.has("response"))
3247      res.setResponse(parseBundleBundleEntryResponseComponent(json.getAsJsonObject("response"), owner));
3248  }
3249
3250  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3251    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3252    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
3253    return res;
3254  }
3255
3256  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3257    parseBackboneElementProperties(json, res);
3258    if (json.has("mode"))
3259      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
3260    if (json.has("_mode"))
3261      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3262    if (json.has("score"))
3263      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3264    if (json.has("_score"))
3265      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
3266  }
3267
3268  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3269    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3270    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
3271    return res;
3272  }
3273
3274  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3275    parseBackboneElementProperties(json, res);
3276    if (json.has("method"))
3277      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3278    if (json.has("_method"))
3279      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
3280    if (json.has("url"))
3281      res.setUrlElement(parseUri(json.get("url").getAsString()));
3282    if (json.has("_url"))
3283      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3284    if (json.has("ifNoneMatch"))
3285      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3286    if (json.has("_ifNoneMatch"))
3287      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
3288    if (json.has("ifModifiedSince"))
3289      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3290    if (json.has("_ifModifiedSince"))
3291      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
3292    if (json.has("ifMatch"))
3293      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3294    if (json.has("_ifMatch"))
3295      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
3296    if (json.has("ifNoneExist"))
3297      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3298    if (json.has("_ifNoneExist"))
3299      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
3300  }
3301
3302  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3303    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3304    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
3305    return res;
3306  }
3307
3308  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3309    parseBackboneElementProperties(json, res);
3310    if (json.has("status"))
3311      res.setStatusElement(parseString(json.get("status").getAsString()));
3312    if (json.has("_status"))
3313      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3314    if (json.has("location"))
3315      res.setLocationElement(parseUri(json.get("location").getAsString()));
3316    if (json.has("_location"))
3317      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
3318    if (json.has("etag"))
3319      res.setEtagElement(parseString(json.get("etag").getAsString()));
3320    if (json.has("_etag"))
3321      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
3322    if (json.has("lastModified"))
3323      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3324    if (json.has("_lastModified"))
3325      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
3326    if (json.has("outcome"))
3327      res.setOutcome(parseResource(json.getAsJsonObject("outcome")));
3328  }
3329
3330  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3331    CapabilityStatement res = new CapabilityStatement();
3332    parseCapabilityStatementProperties(json, res);
3333    return res;
3334  }
3335
3336  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
3337    parseDomainResourceProperties(json, res);
3338    if (json.has("url"))
3339      res.setUrlElement(parseUri(json.get("url").getAsString()));
3340    if (json.has("_url"))
3341      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3342    if (json.has("version"))
3343      res.setVersionElement(parseString(json.get("version").getAsString()));
3344    if (json.has("_version"))
3345      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3346    if (json.has("name"))
3347      res.setNameElement(parseString(json.get("name").getAsString()));
3348    if (json.has("_name"))
3349      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3350    if (json.has("title"))
3351      res.setTitleElement(parseString(json.get("title").getAsString()));
3352    if (json.has("_title"))
3353      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3354    if (json.has("status"))
3355      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
3356    if (json.has("_status"))
3357      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3358    if (json.has("experimental"))
3359      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3360    if (json.has("_experimental"))
3361      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3362    if (json.has("date"))
3363      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3364    if (json.has("_date"))
3365      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3366    if (json.has("publisher"))
3367      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3368    if (json.has("_publisher"))
3369      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3370    if (json.has("contact")) {
3371      JsonArray array = json.getAsJsonArray("contact");
3372      for (int i = 0; i < array.size(); i++) {
3373        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3374      }
3375    };
3376    if (json.has("description"))
3377      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3378    if (json.has("_description"))
3379      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3380    if (json.has("useContext")) {
3381      JsonArray array = json.getAsJsonArray("useContext");
3382      for (int i = 0; i < array.size(); i++) {
3383        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3384      }
3385    };
3386    if (json.has("jurisdiction")) {
3387      JsonArray array = json.getAsJsonArray("jurisdiction");
3388      for (int i = 0; i < array.size(); i++) {
3389        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3390      }
3391    };
3392    if (json.has("purpose"))
3393      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3394    if (json.has("_purpose"))
3395      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
3396    if (json.has("copyright"))
3397      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3398    if (json.has("_copyright"))
3399      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3400    if (json.has("kind"))
3401      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
3402    if (json.has("_kind"))
3403      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
3404    if (json.has("instantiates")) {
3405      JsonArray array = json.getAsJsonArray("instantiates");
3406      for (int i = 0; i < array.size(); i++) {
3407        res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3408      }
3409    };
3410    if (json.has("_instantiates")) {
3411      JsonArray array = json.getAsJsonArray("_instantiates");
3412      for (int i = 0; i < array.size(); i++) {
3413        if (i == res.getInstantiates().size())
3414          res.getInstantiates().add(parseCanonical(null));
3415        if (array.get(i) instanceof JsonObject) 
3416          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3417      }
3418    };
3419    if (json.has("software"))
3420      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(json.getAsJsonObject("software"), res));
3421    if (json.has("implementation"))
3422      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(json.getAsJsonObject("implementation"), res));
3423    if (json.has("fhirVersion"))
3424      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
3425    if (json.has("_fhirVersion"))
3426      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
3427    if (json.has("format")) {
3428      JsonArray array = json.getAsJsonArray("format");
3429      for (int i = 0; i < array.size(); i++) {
3430        res.getFormat().add(parseCode(array.get(i).getAsString()));
3431      }
3432    };
3433    if (json.has("_format")) {
3434      JsonArray array = json.getAsJsonArray("_format");
3435      for (int i = 0; i < array.size(); i++) {
3436        if (i == res.getFormat().size())
3437          res.getFormat().add(parseCode(null));
3438        if (array.get(i) instanceof JsonObject) 
3439          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3440      }
3441    };
3442    if (json.has("patchFormat")) {
3443      JsonArray array = json.getAsJsonArray("patchFormat");
3444      for (int i = 0; i < array.size(); i++) {
3445        res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3446      }
3447    };
3448    if (json.has("_patchFormat")) {
3449      JsonArray array = json.getAsJsonArray("_patchFormat");
3450      for (int i = 0; i < array.size(); i++) {
3451        if (i == res.getPatchFormat().size())
3452          res.getPatchFormat().add(parseCode(null));
3453        if (array.get(i) instanceof JsonObject) 
3454          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3455      }
3456    };
3457    if (json.has("implementationGuide")) {
3458      JsonArray array = json.getAsJsonArray("implementationGuide");
3459      for (int i = 0; i < array.size(); i++) {
3460        res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
3461      }
3462    };
3463    if (json.has("_implementationGuide")) {
3464      JsonArray array = json.getAsJsonArray("_implementationGuide");
3465      for (int i = 0; i < array.size(); i++) {
3466        if (i == res.getImplementationGuide().size())
3467          res.getImplementationGuide().add(parseCanonical(null));
3468        if (array.get(i) instanceof JsonObject) 
3469          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3470      }
3471    };
3472    if (json.has("rest")) {
3473      JsonArray array = json.getAsJsonArray("rest");
3474      for (int i = 0; i < array.size(); i++) {
3475        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3476      }
3477    };
3478    if (json.has("messaging")) {
3479      JsonArray array = json.getAsJsonArray("messaging");
3480      for (int i = 0; i < array.size(); i++) {
3481        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3482      }
3483    };
3484    if (json.has("document")) {
3485      JsonArray array = json.getAsJsonArray("document");
3486      for (int i = 0; i < array.size(); i++) {
3487        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3488      }
3489    };
3490  }
3491
3492  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3493    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3494    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3495    return res;
3496  }
3497
3498  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3499    parseBackboneElementProperties(json, res);
3500    if (json.has("name"))
3501      res.setNameElement(parseString(json.get("name").getAsString()));
3502    if (json.has("_name"))
3503      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3504    if (json.has("version"))
3505      res.setVersionElement(parseString(json.get("version").getAsString()));
3506    if (json.has("_version"))
3507      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3508    if (json.has("releaseDate"))
3509      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3510    if (json.has("_releaseDate"))
3511      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
3512  }
3513
3514  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3515    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3516    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3517    return res;
3518  }
3519
3520  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3521    parseBackboneElementProperties(json, res);
3522    if (json.has("description"))
3523      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3524    if (json.has("_description"))
3525      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3526    if (json.has("url"))
3527      res.setUrlElement(parseUrl(json.get("url").getAsString()));
3528    if (json.has("_url"))
3529      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3530  }
3531
3532  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3533    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3534    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3535    return res;
3536  }
3537
3538  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3539    parseBackboneElementProperties(json, res);
3540    if (json.has("mode"))
3541      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3542    if (json.has("_mode"))
3543      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3544    if (json.has("documentation"))
3545      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3546    if (json.has("_documentation"))
3547      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3548    if (json.has("security"))
3549      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(json.getAsJsonObject("security"), owner));
3550    if (json.has("resource")) {
3551      JsonArray array = json.getAsJsonArray("resource");
3552      for (int i = 0; i < array.size(); i++) {
3553        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3554      }
3555    };
3556    if (json.has("interaction")) {
3557      JsonArray array = json.getAsJsonArray("interaction");
3558      for (int i = 0; i < array.size(); i++) {
3559        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3560      }
3561    };
3562    if (json.has("searchParam")) {
3563      JsonArray array = json.getAsJsonArray("searchParam");
3564      for (int i = 0; i < array.size(); i++) {
3565        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3566      }
3567    };
3568    if (json.has("operation")) {
3569      JsonArray array = json.getAsJsonArray("operation");
3570      for (int i = 0; i < array.size(); i++) {
3571        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3572      }
3573    };
3574    if (json.has("compartment")) {
3575      JsonArray array = json.getAsJsonArray("compartment");
3576      for (int i = 0; i < array.size(); i++) {
3577        res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
3578      }
3579    };
3580    if (json.has("_compartment")) {
3581      JsonArray array = json.getAsJsonArray("_compartment");
3582      for (int i = 0; i < array.size(); i++) {
3583        if (i == res.getCompartment().size())
3584          res.getCompartment().add(parseCanonical(null));
3585        if (array.get(i) instanceof JsonObject) 
3586          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3587      }
3588    };
3589  }
3590
3591  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3592    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3593    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
3594    return res;
3595  }
3596
3597  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3598    parseBackboneElementProperties(json, res);
3599    if (json.has("cors"))
3600      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3601    if (json.has("_cors"))
3602      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
3603    if (json.has("service")) {
3604      JsonArray array = json.getAsJsonArray("service");
3605      for (int i = 0; i < array.size(); i++) {
3606        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3607      }
3608    };
3609    if (json.has("description"))
3610      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3611    if (json.has("_description"))
3612      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3613  }
3614
3615  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3616    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3617    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
3618    return res;
3619  }
3620
3621  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3622    parseBackboneElementProperties(json, res);
3623    if (json.has("type"))
3624      res.setTypeElement(parseCode(json.get("type").getAsString()));
3625    if (json.has("_type"))
3626      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3627    if (json.has("profile"))
3628      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3629    if (json.has("_profile"))
3630      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
3631    if (json.has("supportedProfile")) {
3632      JsonArray array = json.getAsJsonArray("supportedProfile");
3633      for (int i = 0; i < array.size(); i++) {
3634        res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
3635      }
3636    };
3637    if (json.has("_supportedProfile")) {
3638      JsonArray array = json.getAsJsonArray("_supportedProfile");
3639      for (int i = 0; i < array.size(); i++) {
3640        if (i == res.getSupportedProfile().size())
3641          res.getSupportedProfile().add(parseCanonical(null));
3642        if (array.get(i) instanceof JsonObject) 
3643          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
3644      }
3645    };
3646    if (json.has("documentation"))
3647      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3648    if (json.has("_documentation"))
3649      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3650    if (json.has("interaction")) {
3651      JsonArray array = json.getAsJsonArray("interaction");
3652      for (int i = 0; i < array.size(); i++) {
3653        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3654      }
3655    };
3656    if (json.has("versioning"))
3657      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3658    if (json.has("_versioning"))
3659      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
3660    if (json.has("readHistory"))
3661      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3662    if (json.has("_readHistory"))
3663      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
3664    if (json.has("updateCreate"))
3665      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3666    if (json.has("_updateCreate"))
3667      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
3668    if (json.has("conditionalCreate"))
3669      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3670    if (json.has("_conditionalCreate"))
3671      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
3672    if (json.has("conditionalRead"))
3673      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3674    if (json.has("_conditionalRead"))
3675      parseElementProperties(json.getAsJsonObject("_conditionalRead"), res.getConditionalReadElement());
3676    if (json.has("conditionalUpdate"))
3677      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3678    if (json.has("_conditionalUpdate"))
3679      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
3680    if (json.has("conditionalDelete"))
3681      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3682    if (json.has("_conditionalDelete"))
3683      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
3684    if (json.has("referencePolicy")) {
3685      JsonArray array = json.getAsJsonArray("referencePolicy");
3686      for (int i = 0; i < array.size(); i++) {
3687        res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3688      }
3689    };
3690    if (json.has("_referencePolicy")) {
3691      JsonArray array = json.getAsJsonArray("_referencePolicy");
3692      for (int i = 0; i < array.size(); i++) {
3693        if (i == res.getReferencePolicy().size())
3694          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3695        if (array.get(i) instanceof JsonObject) 
3696          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3697      }
3698    };
3699    if (json.has("searchInclude")) {
3700      JsonArray array = json.getAsJsonArray("searchInclude");
3701      for (int i = 0; i < array.size(); i++) {
3702        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3703      }
3704    };
3705    if (json.has("_searchInclude")) {
3706      JsonArray array = json.getAsJsonArray("_searchInclude");
3707      for (int i = 0; i < array.size(); i++) {
3708        if (i == res.getSearchInclude().size())
3709          res.getSearchInclude().add(parseString(null));
3710        if (array.get(i) instanceof JsonObject) 
3711          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3712      }
3713    };
3714    if (json.has("searchRevInclude")) {
3715      JsonArray array = json.getAsJsonArray("searchRevInclude");
3716      for (int i = 0; i < array.size(); i++) {
3717        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3718      }
3719    };
3720    if (json.has("_searchRevInclude")) {
3721      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3722      for (int i = 0; i < array.size(); i++) {
3723        if (i == res.getSearchRevInclude().size())
3724          res.getSearchRevInclude().add(parseString(null));
3725        if (array.get(i) instanceof JsonObject) 
3726          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3727      }
3728    };
3729    if (json.has("searchParam")) {
3730      JsonArray array = json.getAsJsonArray("searchParam");
3731      for (int i = 0; i < array.size(); i++) {
3732        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3733      }
3734    };
3735    if (json.has("operation")) {
3736      JsonArray array = json.getAsJsonArray("operation");
3737      for (int i = 0; i < array.size(); i++) {
3738        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3739      }
3740    };
3741  }
3742
3743  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3744    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
3745    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
3746    return res;
3747  }
3748
3749  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
3750    parseBackboneElementProperties(json, res);
3751    if (json.has("code"))
3752      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
3753    if (json.has("_code"))
3754      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3755    if (json.has("documentation"))
3756      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3757    if (json.has("_documentation"))
3758      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3759  }
3760
3761  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3762    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
3763    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
3764    return res;
3765  }
3766
3767  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
3768    parseBackboneElementProperties(json, res);
3769    if (json.has("name"))
3770      res.setNameElement(parseString(json.get("name").getAsString()));
3771    if (json.has("_name"))
3772      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3773    if (json.has("definition"))
3774      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3775    if (json.has("_definition"))
3776      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3777    if (json.has("type"))
3778      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3779    if (json.has("_type"))
3780      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3781    if (json.has("documentation"))
3782      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3783    if (json.has("_documentation"))
3784      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3785  }
3786
3787  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3788    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
3789    parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(json, owner, res);
3790    return res;
3791  }
3792
3793  protected void parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
3794    parseBackboneElementProperties(json, res);
3795    if (json.has("name"))
3796      res.setNameElement(parseString(json.get("name").getAsString()));
3797    if (json.has("_name"))
3798      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3799    if (json.has("definition"))
3800      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3801    if (json.has("_definition"))
3802      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3803    if (json.has("documentation"))
3804      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3805    if (json.has("_documentation"))
3806      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3807  }
3808
3809  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3810    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
3811    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
3812    return res;
3813  }
3814
3815  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
3816    parseBackboneElementProperties(json, res);
3817    if (json.has("code"))
3818      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
3819    if (json.has("_code"))
3820      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3821    if (json.has("documentation"))
3822      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3823    if (json.has("_documentation"))
3824      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3825  }
3826
3827  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3828    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
3829    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
3830    return res;
3831  }
3832
3833  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
3834    parseBackboneElementProperties(json, res);
3835    if (json.has("endpoint")) {
3836      JsonArray array = json.getAsJsonArray("endpoint");
3837      for (int i = 0; i < array.size(); i++) {
3838        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3839      }
3840    };
3841    if (json.has("reliableCache"))
3842      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3843    if (json.has("_reliableCache"))
3844      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
3845    if (json.has("documentation"))
3846      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3847    if (json.has("_documentation"))
3848      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3849    if (json.has("supportedMessage")) {
3850      JsonArray array = json.getAsJsonArray("supportedMessage");
3851      for (int i = 0; i < array.size(); i++) {
3852        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
3853      }
3854    };
3855  }
3856
3857  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3858    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
3859    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
3860    return res;
3861  }
3862
3863  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
3864    parseBackboneElementProperties(json, res);
3865    if (json.has("protocol"))
3866      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
3867    if (json.has("address"))
3868      res.setAddressElement(parseUrl(json.get("address").getAsString()));
3869    if (json.has("_address"))
3870      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
3871  }
3872
3873  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3874    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
3875    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
3876    return res;
3877  }
3878
3879  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
3880    parseBackboneElementProperties(json, res);
3881    if (json.has("mode"))
3882      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3883    if (json.has("_mode"))
3884      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3885    if (json.has("definition"))
3886      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3887    if (json.has("_definition"))
3888      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3889  }
3890
3891  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3892    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
3893    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
3894    return res;
3895  }
3896
3897  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
3898    parseBackboneElementProperties(json, res);
3899    if (json.has("mode"))
3900      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
3901    if (json.has("_mode"))
3902      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3903    if (json.has("documentation"))
3904      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3905    if (json.has("_documentation"))
3906      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3907    if (json.has("profile"))
3908      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3909    if (json.has("_profile"))
3910      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
3911  }
3912
3913  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
3914    CarePlan res = new CarePlan();
3915    parseCarePlanProperties(json, res);
3916    return res;
3917  }
3918
3919  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
3920    parseDomainResourceProperties(json, res);
3921    if (json.has("identifier")) {
3922      JsonArray array = json.getAsJsonArray("identifier");
3923      for (int i = 0; i < array.size(); i++) {
3924        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3925      }
3926    };
3927    if (json.has("instantiates")) {
3928      JsonArray array = json.getAsJsonArray("instantiates");
3929      for (int i = 0; i < array.size(); i++) {
3930        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
3931      }
3932    };
3933    if (json.has("_instantiates")) {
3934      JsonArray array = json.getAsJsonArray("_instantiates");
3935      for (int i = 0; i < array.size(); i++) {
3936        if (i == res.getInstantiates().size())
3937          res.getInstantiates().add(parseUri(null));
3938        if (array.get(i) instanceof JsonObject) 
3939          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3940      }
3941    };
3942    if (json.has("basedOn")) {
3943      JsonArray array = json.getAsJsonArray("basedOn");
3944      for (int i = 0; i < array.size(); i++) {
3945        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3946      }
3947    };
3948    if (json.has("replaces")) {
3949      JsonArray array = json.getAsJsonArray("replaces");
3950      for (int i = 0; i < array.size(); i++) {
3951        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
3952      }
3953    };
3954    if (json.has("partOf")) {
3955      JsonArray array = json.getAsJsonArray("partOf");
3956      for (int i = 0; i < array.size(); i++) {
3957        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
3958      }
3959    };
3960    if (json.has("status"))
3961      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
3962    if (json.has("_status"))
3963      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3964    if (json.has("intent"))
3965      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
3966    if (json.has("_intent"))
3967      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
3968    if (json.has("category")) {
3969      JsonArray array = json.getAsJsonArray("category");
3970      for (int i = 0; i < array.size(); i++) {
3971        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3972      }
3973    };
3974    if (json.has("title"))
3975      res.setTitleElement(parseString(json.get("title").getAsString()));
3976    if (json.has("_title"))
3977      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3978    if (json.has("description"))
3979      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3980    if (json.has("_description"))
3981      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3982    if (json.has("subject"))
3983      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3984    if (json.has("context"))
3985      res.setContext(parseReference(json.getAsJsonObject("context")));
3986    if (json.has("period"))
3987      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3988    if (json.has("author")) {
3989      JsonArray array = json.getAsJsonArray("author");
3990      for (int i = 0; i < array.size(); i++) {
3991        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
3992      }
3993    };
3994    if (json.has("careTeam")) {
3995      JsonArray array = json.getAsJsonArray("careTeam");
3996      for (int i = 0; i < array.size(); i++) {
3997        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
3998      }
3999    };
4000    if (json.has("addresses")) {
4001      JsonArray array = json.getAsJsonArray("addresses");
4002      for (int i = 0; i < array.size(); i++) {
4003        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
4004      }
4005    };
4006    if (json.has("supportingInfo")) {
4007      JsonArray array = json.getAsJsonArray("supportingInfo");
4008      for (int i = 0; i < array.size(); i++) {
4009        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
4010      }
4011    };
4012    if (json.has("goal")) {
4013      JsonArray array = json.getAsJsonArray("goal");
4014      for (int i = 0; i < array.size(); i++) {
4015        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4016      }
4017    };
4018    if (json.has("activity")) {
4019      JsonArray array = json.getAsJsonArray("activity");
4020      for (int i = 0; i < array.size(); i++) {
4021        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
4022      }
4023    };
4024    if (json.has("note")) {
4025      JsonArray array = json.getAsJsonArray("note");
4026      for (int i = 0; i < array.size(); i++) {
4027        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4028      }
4029    };
4030  }
4031
4032  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4033    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
4034    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
4035    return res;
4036  }
4037
4038  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
4039    parseBackboneElementProperties(json, res);
4040    if (json.has("outcomeCodeableConcept")) {
4041      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
4042      for (int i = 0; i < array.size(); i++) {
4043        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4044      }
4045    };
4046    if (json.has("outcomeReference")) {
4047      JsonArray array = json.getAsJsonArray("outcomeReference");
4048      for (int i = 0; i < array.size(); i++) {
4049        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
4050      }
4051    };
4052    if (json.has("progress")) {
4053      JsonArray array = json.getAsJsonArray("progress");
4054      for (int i = 0; i < array.size(); i++) {
4055        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
4056      }
4057    };
4058    if (json.has("reference"))
4059      res.setReference(parseReference(json.getAsJsonObject("reference")));
4060    if (json.has("detail"))
4061      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(json.getAsJsonObject("detail"), owner));
4062  }
4063
4064  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4065    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
4066    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
4067    return res;
4068  }
4069
4070  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
4071    parseBackboneElementProperties(json, res);
4072    if (json.has("kind"))
4073      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
4074    if (json.has("_kind"))
4075      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
4076    if (json.has("instantiates"))
4077      res.setInstantiatesElement(parseUri(json.get("instantiates").getAsString()));
4078    if (json.has("_instantiates"))
4079      parseElementProperties(json.getAsJsonObject("_instantiates"), res.getInstantiatesElement());
4080    if (json.has("code"))
4081      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4082    if (json.has("reasonCode")) {
4083      JsonArray array = json.getAsJsonArray("reasonCode");
4084      for (int i = 0; i < array.size(); i++) {
4085        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4086      }
4087    };
4088    if (json.has("reasonReference")) {
4089      JsonArray array = json.getAsJsonArray("reasonReference");
4090      for (int i = 0; i < array.size(); i++) {
4091        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4092      }
4093    };
4094    if (json.has("goal")) {
4095      JsonArray array = json.getAsJsonArray("goal");
4096      for (int i = 0; i < array.size(); i++) {
4097        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4098      }
4099    };
4100    if (json.has("status"))
4101      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
4102    if (json.has("_status"))
4103      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4104    if (json.has("statusReason"))
4105      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
4106    if (json.has("_statusReason"))
4107      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
4108    if (json.has("doNotPerform"))
4109      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
4110    if (json.has("_doNotPerform"))
4111      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
4112    Type scheduled = parseType("scheduled", json);
4113    if (scheduled != null)
4114      res.setScheduled(scheduled);
4115    if (json.has("location"))
4116      res.setLocation(parseReference(json.getAsJsonObject("location")));
4117    if (json.has("performer")) {
4118      JsonArray array = json.getAsJsonArray("performer");
4119      for (int i = 0; i < array.size(); i++) {
4120        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
4121      }
4122    };
4123    Type product = parseType("product", json);
4124    if (product != null)
4125      res.setProduct(product);
4126    if (json.has("dailyAmount"))
4127      res.setDailyAmount(parseSimpleQuantity(json.getAsJsonObject("dailyAmount")));
4128    if (json.has("quantity"))
4129      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4130    if (json.has("description"))
4131      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4132    if (json.has("_description"))
4133      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4134  }
4135
4136  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
4137    CareTeam res = new CareTeam();
4138    parseCareTeamProperties(json, res);
4139    return res;
4140  }
4141
4142  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
4143    parseDomainResourceProperties(json, res);
4144    if (json.has("identifier")) {
4145      JsonArray array = json.getAsJsonArray("identifier");
4146      for (int i = 0; i < array.size(); i++) {
4147        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4148      }
4149    };
4150    if (json.has("status"))
4151      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
4152    if (json.has("_status"))
4153      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4154    if (json.has("category")) {
4155      JsonArray array = json.getAsJsonArray("category");
4156      for (int i = 0; i < array.size(); i++) {
4157        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4158      }
4159    };
4160    if (json.has("name"))
4161      res.setNameElement(parseString(json.get("name").getAsString()));
4162    if (json.has("_name"))
4163      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4164    if (json.has("subject"))
4165      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4166    if (json.has("context"))
4167      res.setContext(parseReference(json.getAsJsonObject("context")));
4168    if (json.has("period"))
4169      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4170    if (json.has("participant")) {
4171      JsonArray array = json.getAsJsonArray("participant");
4172      for (int i = 0; i < array.size(); i++) {
4173        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
4174      }
4175    };
4176    if (json.has("reasonCode")) {
4177      JsonArray array = json.getAsJsonArray("reasonCode");
4178      for (int i = 0; i < array.size(); i++) {
4179        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4180      }
4181    };
4182    if (json.has("reasonReference")) {
4183      JsonArray array = json.getAsJsonArray("reasonReference");
4184      for (int i = 0; i < array.size(); i++) {
4185        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4186      }
4187    };
4188    if (json.has("managingOrganization")) {
4189      JsonArray array = json.getAsJsonArray("managingOrganization");
4190      for (int i = 0; i < array.size(); i++) {
4191        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
4192      }
4193    };
4194    if (json.has("telecom")) {
4195      JsonArray array = json.getAsJsonArray("telecom");
4196      for (int i = 0; i < array.size(); i++) {
4197        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4198      }
4199    };
4200    if (json.has("note")) {
4201      JsonArray array = json.getAsJsonArray("note");
4202      for (int i = 0; i < array.size(); i++) {
4203        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4204      }
4205    };
4206  }
4207
4208  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
4209    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
4210    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
4211    return res;
4212  }
4213
4214  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
4215    parseBackboneElementProperties(json, res);
4216    if (json.has("role"))
4217      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
4218    if (json.has("member"))
4219      res.setMember(parseReference(json.getAsJsonObject("member")));
4220    if (json.has("onBehalfOf"))
4221      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
4222    if (json.has("period"))
4223      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4224  }
4225
4226  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
4227    ChargeItem res = new ChargeItem();
4228    parseChargeItemProperties(json, res);
4229    return res;
4230  }
4231
4232  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
4233    parseDomainResourceProperties(json, res);
4234    if (json.has("identifier")) {
4235      JsonArray array = json.getAsJsonArray("identifier");
4236      for (int i = 0; i < array.size(); i++) {
4237        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4238      }
4239    };
4240    if (json.has("definition")) {
4241      JsonArray array = json.getAsJsonArray("definition");
4242      for (int i = 0; i < array.size(); i++) {
4243        res.getDefinition().add(parseUri(array.get(i).getAsString()));
4244      }
4245    };
4246    if (json.has("_definition")) {
4247      JsonArray array = json.getAsJsonArray("_definition");
4248      for (int i = 0; i < array.size(); i++) {
4249        if (i == res.getDefinition().size())
4250          res.getDefinition().add(parseUri(null));
4251        if (array.get(i) instanceof JsonObject) 
4252          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
4253      }
4254    };
4255    if (json.has("status"))
4256      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
4257    if (json.has("_status"))
4258      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4259    if (json.has("partOf")) {
4260      JsonArray array = json.getAsJsonArray("partOf");
4261      for (int i = 0; i < array.size(); i++) {
4262        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4263      }
4264    };
4265    if (json.has("code"))
4266      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4267    if (json.has("subject"))
4268      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4269    if (json.has("context"))
4270      res.setContext(parseReference(json.getAsJsonObject("context")));
4271    Type occurrence = parseType("occurrence", json);
4272    if (occurrence != null)
4273      res.setOccurrence(occurrence);
4274    if (json.has("participant")) {
4275      JsonArray array = json.getAsJsonArray("participant");
4276      for (int i = 0; i < array.size(); i++) {
4277        res.getParticipant().add(parseChargeItemChargeItemParticipantComponent(array.get(i).getAsJsonObject(), res));
4278      }
4279    };
4280    if (json.has("performingOrganization"))
4281      res.setPerformingOrganization(parseReference(json.getAsJsonObject("performingOrganization")));
4282    if (json.has("requestingOrganization"))
4283      res.setRequestingOrganization(parseReference(json.getAsJsonObject("requestingOrganization")));
4284    if (json.has("costCenter"))
4285      res.setCostCenter(parseReference(json.getAsJsonObject("costCenter")));
4286    if (json.has("quantity"))
4287      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
4288    if (json.has("bodysite")) {
4289      JsonArray array = json.getAsJsonArray("bodysite");
4290      for (int i = 0; i < array.size(); i++) {
4291        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4292      }
4293    };
4294    if (json.has("factorOverride"))
4295      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
4296    if (json.has("_factorOverride"))
4297      parseElementProperties(json.getAsJsonObject("_factorOverride"), res.getFactorOverrideElement());
4298    if (json.has("priceOverride"))
4299      res.setPriceOverride(parseMoney(json.getAsJsonObject("priceOverride")));
4300    if (json.has("overrideReason"))
4301      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
4302    if (json.has("_overrideReason"))
4303      parseElementProperties(json.getAsJsonObject("_overrideReason"), res.getOverrideReasonElement());
4304    if (json.has("enterer"))
4305      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
4306    if (json.has("enteredDate"))
4307      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
4308    if (json.has("_enteredDate"))
4309      parseElementProperties(json.getAsJsonObject("_enteredDate"), res.getEnteredDateElement());
4310    if (json.has("reason")) {
4311      JsonArray array = json.getAsJsonArray("reason");
4312      for (int i = 0; i < array.size(); i++) {
4313        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4314      }
4315    };
4316    if (json.has("service")) {
4317      JsonArray array = json.getAsJsonArray("service");
4318      for (int i = 0; i < array.size(); i++) {
4319        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
4320      }
4321    };
4322    if (json.has("account")) {
4323      JsonArray array = json.getAsJsonArray("account");
4324      for (int i = 0; i < array.size(); i++) {
4325        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
4326      }
4327    };
4328    if (json.has("note")) {
4329      JsonArray array = json.getAsJsonArray("note");
4330      for (int i = 0; i < array.size(); i++) {
4331        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4332      }
4333    };
4334    if (json.has("supportingInformation")) {
4335      JsonArray array = json.getAsJsonArray("supportingInformation");
4336      for (int i = 0; i < array.size(); i++) {
4337        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
4338      }
4339    };
4340  }
4341
4342  protected ChargeItem.ChargeItemParticipantComponent parseChargeItemChargeItemParticipantComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
4343    ChargeItem.ChargeItemParticipantComponent res = new ChargeItem.ChargeItemParticipantComponent();
4344    parseChargeItemChargeItemParticipantComponentProperties(json, owner, res);
4345    return res;
4346  }
4347
4348  protected void parseChargeItemChargeItemParticipantComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemParticipantComponent res) throws IOException, FHIRFormatError {
4349    parseBackboneElementProperties(json, res);
4350    if (json.has("role"))
4351      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
4352    if (json.has("actor"))
4353      res.setActor(parseReference(json.getAsJsonObject("actor")));
4354  }
4355
4356  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
4357    Claim res = new Claim();
4358    parseClaimProperties(json, res);
4359    return res;
4360  }
4361
4362  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
4363    parseDomainResourceProperties(json, res);
4364    if (json.has("identifier")) {
4365      JsonArray array = json.getAsJsonArray("identifier");
4366      for (int i = 0; i < array.size(); i++) {
4367        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4368      }
4369    };
4370    if (json.has("status"))
4371      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
4372    if (json.has("_status"))
4373      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4374    if (json.has("type"))
4375      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4376    if (json.has("subType")) {
4377      JsonArray array = json.getAsJsonArray("subType");
4378      for (int i = 0; i < array.size(); i++) {
4379        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4380      }
4381    };
4382    if (json.has("use"))
4383      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
4384    if (json.has("_use"))
4385      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
4386    if (json.has("patient"))
4387      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4388    if (json.has("billablePeriod"))
4389      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
4390    if (json.has("created"))
4391      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4392    if (json.has("_created"))
4393      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4394    if (json.has("enterer"))
4395      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
4396    if (json.has("insurer"))
4397      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
4398    if (json.has("provider"))
4399      res.setProvider(parseReference(json.getAsJsonObject("provider")));
4400    if (json.has("priority"))
4401      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
4402    if (json.has("fundsReserve"))
4403      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
4404    if (json.has("related")) {
4405      JsonArray array = json.getAsJsonArray("related");
4406      for (int i = 0; i < array.size(); i++) {
4407        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
4408      }
4409    };
4410    if (json.has("prescription"))
4411      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
4412    if (json.has("originalPrescription"))
4413      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
4414    if (json.has("payee"))
4415      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee"), res));
4416    if (json.has("referral"))
4417      res.setReferral(parseReference(json.getAsJsonObject("referral")));
4418    if (json.has("facility"))
4419      res.setFacility(parseReference(json.getAsJsonObject("facility")));
4420    if (json.has("careTeam")) {
4421      JsonArray array = json.getAsJsonArray("careTeam");
4422      for (int i = 0; i < array.size(); i++) {
4423        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
4424      }
4425    };
4426    if (json.has("information")) {
4427      JsonArray array = json.getAsJsonArray("information");
4428      for (int i = 0; i < array.size(); i++) {
4429        res.getInformation().add(parseClaimSpecialConditionComponent(array.get(i).getAsJsonObject(), res));
4430      }
4431    };
4432    if (json.has("diagnosis")) {
4433      JsonArray array = json.getAsJsonArray("diagnosis");
4434      for (int i = 0; i < array.size(); i++) {
4435        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
4436      }
4437    };
4438    if (json.has("procedure")) {
4439      JsonArray array = json.getAsJsonArray("procedure");
4440      for (int i = 0; i < array.size(); i++) {
4441        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
4442      }
4443    };
4444    if (json.has("insurance")) {
4445      JsonArray array = json.getAsJsonArray("insurance");
4446      for (int i = 0; i < array.size(); i++) {
4447        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
4448      }
4449    };
4450    if (json.has("accident"))
4451      res.setAccident(parseClaimAccidentComponent(json.getAsJsonObject("accident"), res));
4452    if (json.has("item")) {
4453      JsonArray array = json.getAsJsonArray("item");
4454      for (int i = 0; i < array.size(); i++) {
4455        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
4456      }
4457    };
4458    if (json.has("total"))
4459      res.setTotal(parseMoney(json.getAsJsonObject("total")));
4460  }
4461
4462  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4463    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
4464    parseClaimRelatedClaimComponentProperties(json, owner, res);
4465    return res;
4466  }
4467
4468  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
4469    parseBackboneElementProperties(json, res);
4470    if (json.has("claim"))
4471      res.setClaim(parseReference(json.getAsJsonObject("claim")));
4472    if (json.has("relationship"))
4473      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
4474    if (json.has("reference"))
4475      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
4476  }
4477
4478  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4479    Claim.PayeeComponent res = new Claim.PayeeComponent();
4480    parseClaimPayeeComponentProperties(json, owner, res);
4481    return res;
4482  }
4483
4484  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
4485    parseBackboneElementProperties(json, res);
4486    if (json.has("type"))
4487      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4488    if (json.has("resource"))
4489      res.setResource(parseCoding(json.getAsJsonObject("resource")));
4490    if (json.has("party"))
4491      res.setParty(parseReference(json.getAsJsonObject("party")));
4492  }
4493
4494  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4495    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
4496    parseClaimCareTeamComponentProperties(json, owner, res);
4497    return res;
4498  }
4499
4500  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
4501    parseBackboneElementProperties(json, res);
4502    if (json.has("sequence"))
4503      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4504    if (json.has("_sequence"))
4505      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4506    if (json.has("provider"))
4507      res.setProvider(parseReference(json.getAsJsonObject("provider")));
4508    if (json.has("responsible"))
4509      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
4510    if (json.has("_responsible"))
4511      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
4512    if (json.has("role"))
4513      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
4514    if (json.has("qualification"))
4515      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
4516  }
4517
4518  protected Claim.SpecialConditionComponent parseClaimSpecialConditionComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4519    Claim.SpecialConditionComponent res = new Claim.SpecialConditionComponent();
4520    parseClaimSpecialConditionComponentProperties(json, owner, res);
4521    return res;
4522  }
4523
4524  protected void parseClaimSpecialConditionComponentProperties(JsonObject json, Claim owner, Claim.SpecialConditionComponent res) throws IOException, FHIRFormatError {
4525    parseBackboneElementProperties(json, res);
4526    if (json.has("sequence"))
4527      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4528    if (json.has("_sequence"))
4529      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4530    if (json.has("category"))
4531      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4532    if (json.has("code"))
4533      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4534    Type timing = parseType("timing", json);
4535    if (timing != null)
4536      res.setTiming(timing);
4537    Type value = parseType("value", json);
4538    if (value != null)
4539      res.setValue(value);
4540    if (json.has("reason"))
4541      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
4542  }
4543
4544  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4545    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
4546    parseClaimDiagnosisComponentProperties(json, owner, res);
4547    return res;
4548  }
4549
4550  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
4551    parseBackboneElementProperties(json, res);
4552    if (json.has("sequence"))
4553      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4554    if (json.has("_sequence"))
4555      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4556    Type diagnosis = parseType("diagnosis", json);
4557    if (diagnosis != null)
4558      res.setDiagnosis(diagnosis);
4559    if (json.has("type")) {
4560      JsonArray array = json.getAsJsonArray("type");
4561      for (int i = 0; i < array.size(); i++) {
4562        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4563      }
4564    };
4565    if (json.has("packageCode"))
4566      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
4567  }
4568
4569  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4570    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
4571    parseClaimProcedureComponentProperties(json, owner, res);
4572    return res;
4573  }
4574
4575  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
4576    parseBackboneElementProperties(json, res);
4577    if (json.has("sequence"))
4578      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4579    if (json.has("_sequence"))
4580      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4581    if (json.has("date"))
4582      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4583    if (json.has("_date"))
4584      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4585    Type procedure = parseType("procedure", json);
4586    if (procedure != null)
4587      res.setProcedure(procedure);
4588  }
4589
4590  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4591    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
4592    parseClaimInsuranceComponentProperties(json, owner, res);
4593    return res;
4594  }
4595
4596  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
4597    parseBackboneElementProperties(json, res);
4598    if (json.has("sequence"))
4599      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4600    if (json.has("_sequence"))
4601      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4602    if (json.has("focal"))
4603      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
4604    if (json.has("_focal"))
4605      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
4606    if (json.has("identifier"))
4607      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4608    if (json.has("coverage"))
4609      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
4610    if (json.has("businessArrangement"))
4611      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
4612    if (json.has("_businessArrangement"))
4613      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
4614    if (json.has("preAuthRef")) {
4615      JsonArray array = json.getAsJsonArray("preAuthRef");
4616      for (int i = 0; i < array.size(); i++) {
4617        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
4618      }
4619    };
4620    if (json.has("_preAuthRef")) {
4621      JsonArray array = json.getAsJsonArray("_preAuthRef");
4622      for (int i = 0; i < array.size(); i++) {
4623        if (i == res.getPreAuthRef().size())
4624          res.getPreAuthRef().add(parseString(null));
4625        if (array.get(i) instanceof JsonObject) 
4626          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
4627      }
4628    };
4629    if (json.has("claimResponse"))
4630      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
4631  }
4632
4633  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4634    Claim.AccidentComponent res = new Claim.AccidentComponent();
4635    parseClaimAccidentComponentProperties(json, owner, res);
4636    return res;
4637  }
4638
4639  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
4640    parseBackboneElementProperties(json, res);
4641    if (json.has("date"))
4642      res.setDateElement(parseDate(json.get("date").getAsString()));
4643    if (json.has("_date"))
4644      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4645    if (json.has("type"))
4646      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4647    Type location = parseType("location", json);
4648    if (location != null)
4649      res.setLocation(location);
4650  }
4651
4652  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4653    Claim.ItemComponent res = new Claim.ItemComponent();
4654    parseClaimItemComponentProperties(json, owner, res);
4655    return res;
4656  }
4657
4658  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
4659    parseBackboneElementProperties(json, res);
4660    if (json.has("sequence"))
4661      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4662    if (json.has("_sequence"))
4663      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4664    if (json.has("careTeamSequence")) {
4665      JsonArray array = json.getAsJsonArray("careTeamSequence");
4666      for (int i = 0; i < array.size(); i++) {
4667        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
4668      }
4669    };
4670    if (json.has("_careTeamSequence")) {
4671      JsonArray array = json.getAsJsonArray("_careTeamSequence");
4672      for (int i = 0; i < array.size(); i++) {
4673        if (i == res.getCareTeamSequence().size())
4674          res.getCareTeamSequence().add(parsePositiveInt(null));
4675        if (array.get(i) instanceof JsonObject) 
4676          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
4677      }
4678    };
4679    if (json.has("diagnosisSequence")) {
4680      JsonArray array = json.getAsJsonArray("diagnosisSequence");
4681      for (int i = 0; i < array.size(); i++) {
4682        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
4683      }
4684    };
4685    if (json.has("_diagnosisSequence")) {
4686      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
4687      for (int i = 0; i < array.size(); i++) {
4688        if (i == res.getDiagnosisSequence().size())
4689          res.getDiagnosisSequence().add(parsePositiveInt(null));
4690        if (array.get(i) instanceof JsonObject) 
4691          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
4692      }
4693    };
4694    if (json.has("procedureSequence")) {
4695      JsonArray array = json.getAsJsonArray("procedureSequence");
4696      for (int i = 0; i < array.size(); i++) {
4697        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
4698      }
4699    };
4700    if (json.has("_procedureSequence")) {
4701      JsonArray array = json.getAsJsonArray("_procedureSequence");
4702      for (int i = 0; i < array.size(); i++) {
4703        if (i == res.getProcedureSequence().size())
4704          res.getProcedureSequence().add(parsePositiveInt(null));
4705        if (array.get(i) instanceof JsonObject) 
4706          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
4707      }
4708    };
4709    if (json.has("informationSequence")) {
4710      JsonArray array = json.getAsJsonArray("informationSequence");
4711      for (int i = 0; i < array.size(); i++) {
4712        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
4713      }
4714    };
4715    if (json.has("_informationSequence")) {
4716      JsonArray array = json.getAsJsonArray("_informationSequence");
4717      for (int i = 0; i < array.size(); i++) {
4718        if (i == res.getInformationSequence().size())
4719          res.getInformationSequence().add(parsePositiveInt(null));
4720        if (array.get(i) instanceof JsonObject) 
4721          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
4722      }
4723    };
4724    if (json.has("revenue"))
4725      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4726    if (json.has("category"))
4727      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4728    if (json.has("service"))
4729      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4730    if (json.has("modifier")) {
4731      JsonArray array = json.getAsJsonArray("modifier");
4732      for (int i = 0; i < array.size(); i++) {
4733        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4734      }
4735    };
4736    if (json.has("programCode")) {
4737      JsonArray array = json.getAsJsonArray("programCode");
4738      for (int i = 0; i < array.size(); i++) {
4739        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4740      }
4741    };
4742    Type serviced = parseType("serviced", json);
4743    if (serviced != null)
4744      res.setServiced(serviced);
4745    Type location = parseType("location", json);
4746    if (location != null)
4747      res.setLocation(location);
4748    if (json.has("quantity"))
4749      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4750    if (json.has("unitPrice"))
4751      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4752    if (json.has("factor"))
4753      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4754    if (json.has("_factor"))
4755      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4756    if (json.has("net"))
4757      res.setNet(parseMoney(json.getAsJsonObject("net")));
4758    if (json.has("udi")) {
4759      JsonArray array = json.getAsJsonArray("udi");
4760      for (int i = 0; i < array.size(); i++) {
4761        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4762      }
4763    };
4764    if (json.has("bodySite"))
4765      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
4766    if (json.has("subSite")) {
4767      JsonArray array = json.getAsJsonArray("subSite");
4768      for (int i = 0; i < array.size(); i++) {
4769        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4770      }
4771    };
4772    if (json.has("encounter")) {
4773      JsonArray array = json.getAsJsonArray("encounter");
4774      for (int i = 0; i < array.size(); i++) {
4775        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
4776      }
4777    };
4778    if (json.has("detail")) {
4779      JsonArray array = json.getAsJsonArray("detail");
4780      for (int i = 0; i < array.size(); i++) {
4781        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
4782      }
4783    };
4784  }
4785
4786  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4787    Claim.DetailComponent res = new Claim.DetailComponent();
4788    parseClaimDetailComponentProperties(json, owner, res);
4789    return res;
4790  }
4791
4792  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
4793    parseBackboneElementProperties(json, res);
4794    if (json.has("sequence"))
4795      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4796    if (json.has("_sequence"))
4797      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4798    if (json.has("revenue"))
4799      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4800    if (json.has("category"))
4801      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4802    if (json.has("service"))
4803      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4804    if (json.has("modifier")) {
4805      JsonArray array = json.getAsJsonArray("modifier");
4806      for (int i = 0; i < array.size(); i++) {
4807        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4808      }
4809    };
4810    if (json.has("programCode")) {
4811      JsonArray array = json.getAsJsonArray("programCode");
4812      for (int i = 0; i < array.size(); i++) {
4813        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4814      }
4815    };
4816    if (json.has("quantity"))
4817      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4818    if (json.has("unitPrice"))
4819      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4820    if (json.has("factor"))
4821      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4822    if (json.has("_factor"))
4823      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4824    if (json.has("net"))
4825      res.setNet(parseMoney(json.getAsJsonObject("net")));
4826    if (json.has("udi")) {
4827      JsonArray array = json.getAsJsonArray("udi");
4828      for (int i = 0; i < array.size(); i++) {
4829        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4830      }
4831    };
4832    if (json.has("subDetail")) {
4833      JsonArray array = json.getAsJsonArray("subDetail");
4834      for (int i = 0; i < array.size(); i++) {
4835        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
4836      }
4837    };
4838  }
4839
4840  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4841    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
4842    parseClaimSubDetailComponentProperties(json, owner, res);
4843    return res;
4844  }
4845
4846  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
4847    parseBackboneElementProperties(json, res);
4848    if (json.has("sequence"))
4849      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4850    if (json.has("_sequence"))
4851      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4852    if (json.has("revenue"))
4853      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4854    if (json.has("category"))
4855      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4856    if (json.has("service"))
4857      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4858    if (json.has("modifier")) {
4859      JsonArray array = json.getAsJsonArray("modifier");
4860      for (int i = 0; i < array.size(); i++) {
4861        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4862      }
4863    };
4864    if (json.has("programCode")) {
4865      JsonArray array = json.getAsJsonArray("programCode");
4866      for (int i = 0; i < array.size(); i++) {
4867        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4868      }
4869    };
4870    if (json.has("quantity"))
4871      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4872    if (json.has("unitPrice"))
4873      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4874    if (json.has("factor"))
4875      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4876    if (json.has("_factor"))
4877      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4878    if (json.has("net"))
4879      res.setNet(parseMoney(json.getAsJsonObject("net")));
4880    if (json.has("udi")) {
4881      JsonArray array = json.getAsJsonArray("udi");
4882      for (int i = 0; i < array.size(); i++) {
4883        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4884      }
4885    };
4886  }
4887
4888  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
4889    ClaimResponse res = new ClaimResponse();
4890    parseClaimResponseProperties(json, res);
4891    return res;
4892  }
4893
4894  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
4895    parseDomainResourceProperties(json, res);
4896    if (json.has("identifier")) {
4897      JsonArray array = json.getAsJsonArray("identifier");
4898      for (int i = 0; i < array.size(); i++) {
4899        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4900      }
4901    };
4902    if (json.has("status"))
4903      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
4904    if (json.has("_status"))
4905      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4906    if (json.has("type"))
4907      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4908    if (json.has("subType")) {
4909      JsonArray array = json.getAsJsonArray("subType");
4910      for (int i = 0; i < array.size(); i++) {
4911        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4912      }
4913    };
4914    if (json.has("use"))
4915      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ClaimResponse.Use.NULL, new ClaimResponse.UseEnumFactory()));
4916    if (json.has("_use"))
4917      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
4918    if (json.has("patient"))
4919      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4920    if (json.has("created"))
4921      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4922    if (json.has("_created"))
4923      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4924    if (json.has("insurer"))
4925      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
4926    if (json.has("requestProvider"))
4927      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
4928    if (json.has("request"))
4929      res.setRequest(parseReference(json.getAsJsonObject("request")));
4930    if (json.has("outcome"))
4931      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ClaimResponse.RemittanceOutcome.NULL, new ClaimResponse.RemittanceOutcomeEnumFactory()));
4932    if (json.has("_outcome"))
4933      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
4934    if (json.has("disposition"))
4935      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
4936    if (json.has("_disposition"))
4937      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
4938    if (json.has("payeeType"))
4939      res.setPayeeType(parseCodeableConcept(json.getAsJsonObject("payeeType")));
4940    if (json.has("item")) {
4941      JsonArray array = json.getAsJsonArray("item");
4942      for (int i = 0; i < array.size(); i++) {
4943        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
4944      }
4945    };
4946    if (json.has("addItem")) {
4947      JsonArray array = json.getAsJsonArray("addItem");
4948      for (int i = 0; i < array.size(); i++) {
4949        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
4950      }
4951    };
4952    if (json.has("error")) {
4953      JsonArray array = json.getAsJsonArray("error");
4954      for (int i = 0; i < array.size(); i++) {
4955        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
4956      }
4957    };
4958    if (json.has("total")) {
4959      JsonArray array = json.getAsJsonArray("total");
4960      for (int i = 0; i < array.size(); i++) {
4961        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject(), res));
4962      }
4963    };
4964    if (json.has("payment"))
4965      res.setPayment(parseClaimResponsePaymentComponent(json.getAsJsonObject("payment"), res));
4966    if (json.has("reserved"))
4967      res.setReserved(parseCoding(json.getAsJsonObject("reserved")));
4968    if (json.has("form"))
4969      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
4970    if (json.has("processNote")) {
4971      JsonArray array = json.getAsJsonArray("processNote");
4972      for (int i = 0; i < array.size(); i++) {
4973        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
4974      }
4975    };
4976    if (json.has("communicationRequest")) {
4977      JsonArray array = json.getAsJsonArray("communicationRequest");
4978      for (int i = 0; i < array.size(); i++) {
4979        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
4980      }
4981    };
4982    if (json.has("insurance")) {
4983      JsonArray array = json.getAsJsonArray("insurance");
4984      for (int i = 0; i < array.size(); i++) {
4985        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
4986      }
4987    };
4988  }
4989
4990  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4991    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
4992    parseClaimResponseItemComponentProperties(json, owner, res);
4993    return res;
4994  }
4995
4996  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
4997    parseBackboneElementProperties(json, res);
4998    if (json.has("itemSequence"))
4999      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5000    if (json.has("_itemSequence"))
5001      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
5002    if (json.has("noteNumber")) {
5003      JsonArray array = json.getAsJsonArray("noteNumber");
5004      for (int i = 0; i < array.size(); i++) {
5005        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5006      }
5007    };
5008    if (json.has("_noteNumber")) {
5009      JsonArray array = json.getAsJsonArray("_noteNumber");
5010      for (int i = 0; i < array.size(); i++) {
5011        if (i == res.getNoteNumber().size())
5012          res.getNoteNumber().add(parsePositiveInt(null));
5013        if (array.get(i) instanceof JsonObject) 
5014          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5015      }
5016    };
5017    if (json.has("adjudication")) {
5018      JsonArray array = json.getAsJsonArray("adjudication");
5019      for (int i = 0; i < array.size(); i++) {
5020        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5021      }
5022    };
5023    if (json.has("detail")) {
5024      JsonArray array = json.getAsJsonArray("detail");
5025      for (int i = 0; i < array.size(); i++) {
5026        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5027      }
5028    };
5029  }
5030
5031  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5032    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
5033    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
5034    return res;
5035  }
5036
5037  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
5038    parseBackboneElementProperties(json, res);
5039    if (json.has("category"))
5040      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5041    if (json.has("reason"))
5042      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
5043    if (json.has("amount"))
5044      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5045    if (json.has("value"))
5046      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
5047    if (json.has("_value"))
5048      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
5049  }
5050
5051  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5052    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
5053    parseClaimResponseItemDetailComponentProperties(json, owner, res);
5054    return res;
5055  }
5056
5057  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
5058    parseBackboneElementProperties(json, res);
5059    if (json.has("detailSequence"))
5060      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5061    if (json.has("_detailSequence"))
5062      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
5063    if (json.has("noteNumber")) {
5064      JsonArray array = json.getAsJsonArray("noteNumber");
5065      for (int i = 0; i < array.size(); i++) {
5066        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5067      }
5068    };
5069    if (json.has("_noteNumber")) {
5070      JsonArray array = json.getAsJsonArray("_noteNumber");
5071      for (int i = 0; i < array.size(); i++) {
5072        if (i == res.getNoteNumber().size())
5073          res.getNoteNumber().add(parsePositiveInt(null));
5074        if (array.get(i) instanceof JsonObject) 
5075          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5076      }
5077    };
5078    if (json.has("adjudication")) {
5079      JsonArray array = json.getAsJsonArray("adjudication");
5080      for (int i = 0; i < array.size(); i++) {
5081        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5082      }
5083    };
5084    if (json.has("subDetail")) {
5085      JsonArray array = json.getAsJsonArray("subDetail");
5086      for (int i = 0; i < array.size(); i++) {
5087        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5088      }
5089    };
5090  }
5091
5092  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5093    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
5094    parseClaimResponseSubDetailComponentProperties(json, owner, res);
5095    return res;
5096  }
5097
5098  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
5099    parseBackboneElementProperties(json, res);
5100    if (json.has("subDetailSequence"))
5101      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5102    if (json.has("_subDetailSequence"))
5103      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
5104    if (json.has("noteNumber")) {
5105      JsonArray array = json.getAsJsonArray("noteNumber");
5106      for (int i = 0; i < array.size(); i++) {
5107        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5108      }
5109    };
5110    if (json.has("_noteNumber")) {
5111      JsonArray array = json.getAsJsonArray("_noteNumber");
5112      for (int i = 0; i < array.size(); i++) {
5113        if (i == res.getNoteNumber().size())
5114          res.getNoteNumber().add(parsePositiveInt(null));
5115        if (array.get(i) instanceof JsonObject) 
5116          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5117      }
5118    };
5119    if (json.has("adjudication")) {
5120      JsonArray array = json.getAsJsonArray("adjudication");
5121      for (int i = 0; i < array.size(); i++) {
5122        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5123      }
5124    };
5125  }
5126
5127  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5128    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
5129    parseClaimResponseAddedItemComponentProperties(json, owner, res);
5130    return res;
5131  }
5132
5133  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
5134    parseBackboneElementProperties(json, res);
5135    if (json.has("itemSequence")) {
5136      JsonArray array = json.getAsJsonArray("itemSequence");
5137      for (int i = 0; i < array.size(); i++) {
5138        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
5139      }
5140    };
5141    if (json.has("_itemSequence")) {
5142      JsonArray array = json.getAsJsonArray("_itemSequence");
5143      for (int i = 0; i < array.size(); i++) {
5144        if (i == res.getItemSequence().size())
5145          res.getItemSequence().add(parsePositiveInt(null));
5146        if (array.get(i) instanceof JsonObject) 
5147          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
5148      }
5149    };
5150    if (json.has("detailSequence")) {
5151      JsonArray array = json.getAsJsonArray("detailSequence");
5152      for (int i = 0; i < array.size(); i++) {
5153        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5154      }
5155    };
5156    if (json.has("_detailSequence")) {
5157      JsonArray array = json.getAsJsonArray("_detailSequence");
5158      for (int i = 0; i < array.size(); i++) {
5159        if (i == res.getDetailSequence().size())
5160          res.getDetailSequence().add(parsePositiveInt(null));
5161        if (array.get(i) instanceof JsonObject) 
5162          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
5163      }
5164    };
5165    if (json.has("subdetailSequence")) {
5166      JsonArray array = json.getAsJsonArray("subdetailSequence");
5167      for (int i = 0; i < array.size(); i++) {
5168        res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5169      }
5170    };
5171    if (json.has("_subdetailSequence")) {
5172      JsonArray array = json.getAsJsonArray("_subdetailSequence");
5173      for (int i = 0; i < array.size(); i++) {
5174        if (i == res.getSubdetailSequence().size())
5175          res.getSubdetailSequence().add(parsePositiveInt(null));
5176        if (array.get(i) instanceof JsonObject) 
5177          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
5178      }
5179    };
5180    if (json.has("service"))
5181      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
5182    if (json.has("modifier")) {
5183      JsonArray array = json.getAsJsonArray("modifier");
5184      for (int i = 0; i < array.size(); i++) {
5185        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5186      }
5187    };
5188    if (json.has("fee"))
5189      res.setFee(parseMoney(json.getAsJsonObject("fee")));
5190    if (json.has("noteNumber")) {
5191      JsonArray array = json.getAsJsonArray("noteNumber");
5192      for (int i = 0; i < array.size(); i++) {
5193        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5194      }
5195    };
5196    if (json.has("_noteNumber")) {
5197      JsonArray array = json.getAsJsonArray("_noteNumber");
5198      for (int i = 0; i < array.size(); i++) {
5199        if (i == res.getNoteNumber().size())
5200          res.getNoteNumber().add(parsePositiveInt(null));
5201        if (array.get(i) instanceof JsonObject) 
5202          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5203      }
5204    };
5205    if (json.has("adjudication")) {
5206      JsonArray array = json.getAsJsonArray("adjudication");
5207      for (int i = 0; i < array.size(); i++) {
5208        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5209      }
5210    };
5211  }
5212
5213  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5214    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
5215    parseClaimResponseErrorComponentProperties(json, owner, res);
5216    return res;
5217  }
5218
5219  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
5220    parseBackboneElementProperties(json, res);
5221    if (json.has("itemSequence"))
5222      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5223    if (json.has("_itemSequence"))
5224      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
5225    if (json.has("detailSequence"))
5226      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5227    if (json.has("_detailSequence"))
5228      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
5229    if (json.has("subDetailSequence"))
5230      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5231    if (json.has("_subDetailSequence"))
5232      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
5233    if (json.has("code"))
5234      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5235  }
5236
5237  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5238    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
5239    parseClaimResponseTotalComponentProperties(json, owner, res);
5240    return res;
5241  }
5242
5243  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
5244    parseBackboneElementProperties(json, res);
5245    if (json.has("category"))
5246      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5247    if (json.has("amount"))
5248      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5249  }
5250
5251  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5252    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
5253    parseClaimResponsePaymentComponentProperties(json, owner, res);
5254    return res;
5255  }
5256
5257  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
5258    parseBackboneElementProperties(json, res);
5259    if (json.has("type"))
5260      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5261    if (json.has("adjustment"))
5262      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
5263    if (json.has("adjustmentReason"))
5264      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
5265    if (json.has("date"))
5266      res.setDateElement(parseDate(json.get("date").getAsString()));
5267    if (json.has("_date"))
5268      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5269    if (json.has("amount"))
5270      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5271    if (json.has("identifier"))
5272      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5273  }
5274
5275  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5276    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
5277    parseClaimResponseNoteComponentProperties(json, owner, res);
5278    return res;
5279  }
5280
5281  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
5282    parseBackboneElementProperties(json, res);
5283    if (json.has("number"))
5284      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
5285    if (json.has("_number"))
5286      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
5287    if (json.has("type"))
5288      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
5289    if (json.has("_type"))
5290      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5291    if (json.has("text"))
5292      res.setTextElement(parseString(json.get("text").getAsString()));
5293    if (json.has("_text"))
5294      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
5295    if (json.has("language"))
5296      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
5297  }
5298
5299  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5300    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
5301    parseClaimResponseInsuranceComponentProperties(json, owner, res);
5302    return res;
5303  }
5304
5305  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
5306    parseBackboneElementProperties(json, res);
5307    if (json.has("sequence"))
5308      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5309    if (json.has("_sequence"))
5310      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5311    if (json.has("focal"))
5312      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5313    if (json.has("_focal"))
5314      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
5315    if (json.has("coverage"))
5316      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
5317    if (json.has("businessArrangement"))
5318      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5319    if (json.has("_businessArrangement"))
5320      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
5321    if (json.has("preAuthRef")) {
5322      JsonArray array = json.getAsJsonArray("preAuthRef");
5323      for (int i = 0; i < array.size(); i++) {
5324        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
5325      }
5326    };
5327    if (json.has("_preAuthRef")) {
5328      JsonArray array = json.getAsJsonArray("_preAuthRef");
5329      for (int i = 0; i < array.size(); i++) {
5330        if (i == res.getPreAuthRef().size())
5331          res.getPreAuthRef().add(parseString(null));
5332        if (array.get(i) instanceof JsonObject) 
5333          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
5334      }
5335    };
5336    if (json.has("claimResponse"))
5337      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
5338  }
5339
5340  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
5341    ClinicalImpression res = new ClinicalImpression();
5342    parseClinicalImpressionProperties(json, res);
5343    return res;
5344  }
5345
5346  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
5347    parseDomainResourceProperties(json, res);
5348    if (json.has("identifier")) {
5349      JsonArray array = json.getAsJsonArray("identifier");
5350      for (int i = 0; i < array.size(); i++) {
5351        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5352      }
5353    };
5354    if (json.has("status"))
5355      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
5356    if (json.has("_status"))
5357      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5358    if (json.has("code"))
5359      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5360    if (json.has("description"))
5361      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5362    if (json.has("_description"))
5363      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5364    if (json.has("subject"))
5365      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5366    if (json.has("context"))
5367      res.setContext(parseReference(json.getAsJsonObject("context")));
5368    Type effective = parseType("effective", json);
5369    if (effective != null)
5370      res.setEffective(effective);
5371    if (json.has("date"))
5372      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5373    if (json.has("_date"))
5374      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5375    if (json.has("assessor"))
5376      res.setAssessor(parseReference(json.getAsJsonObject("assessor")));
5377    if (json.has("previous"))
5378      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
5379    if (json.has("problem")) {
5380      JsonArray array = json.getAsJsonArray("problem");
5381      for (int i = 0; i < array.size(); i++) {
5382        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
5383      }
5384    };
5385    if (json.has("investigation")) {
5386      JsonArray array = json.getAsJsonArray("investigation");
5387      for (int i = 0; i < array.size(); i++) {
5388        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
5389      }
5390    };
5391    if (json.has("protocol")) {
5392      JsonArray array = json.getAsJsonArray("protocol");
5393      for (int i = 0; i < array.size(); i++) {
5394        res.getProtocol().add(parseUri(array.get(i).getAsString()));
5395      }
5396    };
5397    if (json.has("_protocol")) {
5398      JsonArray array = json.getAsJsonArray("_protocol");
5399      for (int i = 0; i < array.size(); i++) {
5400        if (i == res.getProtocol().size())
5401          res.getProtocol().add(parseUri(null));
5402        if (array.get(i) instanceof JsonObject) 
5403          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
5404      }
5405    };
5406    if (json.has("summary"))
5407      res.setSummaryElement(parseString(json.get("summary").getAsString()));
5408    if (json.has("_summary"))
5409      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
5410    if (json.has("finding")) {
5411      JsonArray array = json.getAsJsonArray("finding");
5412      for (int i = 0; i < array.size(); i++) {
5413        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
5414      }
5415    };
5416    if (json.has("prognosisCodeableConcept")) {
5417      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
5418      for (int i = 0; i < array.size(); i++) {
5419        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5420      }
5421    };
5422    if (json.has("prognosisReference")) {
5423      JsonArray array = json.getAsJsonArray("prognosisReference");
5424      for (int i = 0; i < array.size(); i++) {
5425        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
5426      }
5427    };
5428    if (json.has("action")) {
5429      JsonArray array = json.getAsJsonArray("action");
5430      for (int i = 0; i < array.size(); i++) {
5431        res.getAction().add(parseReference(array.get(i).getAsJsonObject()));
5432      }
5433    };
5434    if (json.has("note")) {
5435      JsonArray array = json.getAsJsonArray("note");
5436      for (int i = 0; i < array.size(); i++) {
5437        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5438      }
5439    };
5440  }
5441
5442  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
5443    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
5444    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
5445    return res;
5446  }
5447
5448  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
5449    parseBackboneElementProperties(json, res);
5450    if (json.has("code"))
5451      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5452    if (json.has("item")) {
5453      JsonArray array = json.getAsJsonArray("item");
5454      for (int i = 0; i < array.size(); i++) {
5455        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
5456      }
5457    };
5458  }
5459
5460  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
5461    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
5462    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
5463    return res;
5464  }
5465
5466  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
5467    parseBackboneElementProperties(json, res);
5468    if (json.has("itemCodeableConcept"))
5469      res.setItemCodeableConcept(parseCodeableConcept(json.getAsJsonObject("itemCodeableConcept")));
5470    if (json.has("itemReference"))
5471      res.setItemReference(parseReference(json.getAsJsonObject("itemReference")));
5472    if (json.has("basis"))
5473      res.setBasisElement(parseString(json.get("basis").getAsString()));
5474    if (json.has("_basis"))
5475      parseElementProperties(json.getAsJsonObject("_basis"), res.getBasisElement());
5476  }
5477
5478  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
5479    CodeSystem res = new CodeSystem();
5480    parseCodeSystemProperties(json, res);
5481    return res;
5482  }
5483
5484  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
5485    parseDomainResourceProperties(json, res);
5486    if (json.has("url"))
5487      res.setUrlElement(parseUri(json.get("url").getAsString()));
5488    if (json.has("_url"))
5489      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5490    if (json.has("identifier"))
5491      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5492    if (json.has("version"))
5493      res.setVersionElement(parseString(json.get("version").getAsString()));
5494    if (json.has("_version"))
5495      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
5496    if (json.has("name"))
5497      res.setNameElement(parseString(json.get("name").getAsString()));
5498    if (json.has("_name"))
5499      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5500    if (json.has("title"))
5501      res.setTitleElement(parseString(json.get("title").getAsString()));
5502    if (json.has("_title"))
5503      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5504    if (json.has("status"))
5505      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5506    if (json.has("_status"))
5507      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5508    if (json.has("experimental"))
5509      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5510    if (json.has("_experimental"))
5511      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
5512    if (json.has("date"))
5513      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5514    if (json.has("_date"))
5515      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5516    if (json.has("publisher"))
5517      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5518    if (json.has("_publisher"))
5519      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
5520    if (json.has("contact")) {
5521      JsonArray array = json.getAsJsonArray("contact");
5522      for (int i = 0; i < array.size(); i++) {
5523        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5524      }
5525    };
5526    if (json.has("description"))
5527      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5528    if (json.has("_description"))
5529      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5530    if (json.has("useContext")) {
5531      JsonArray array = json.getAsJsonArray("useContext");
5532      for (int i = 0; i < array.size(); i++) {
5533        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5534      }
5535    };
5536    if (json.has("jurisdiction")) {
5537      JsonArray array = json.getAsJsonArray("jurisdiction");
5538      for (int i = 0; i < array.size(); i++) {
5539        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5540      }
5541    };
5542    if (json.has("purpose"))
5543      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5544    if (json.has("_purpose"))
5545      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
5546    if (json.has("copyright"))
5547      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5548    if (json.has("_copyright"))
5549      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
5550    if (json.has("caseSensitive"))
5551      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
5552    if (json.has("_caseSensitive"))
5553      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
5554    if (json.has("valueSet"))
5555      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
5556    if (json.has("_valueSet"))
5557      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
5558    if (json.has("hierarchyMeaning"))
5559      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
5560    if (json.has("_hierarchyMeaning"))
5561      parseElementProperties(json.getAsJsonObject("_hierarchyMeaning"), res.getHierarchyMeaningElement());
5562    if (json.has("compositional"))
5563      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
5564    if (json.has("_compositional"))
5565      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
5566    if (json.has("versionNeeded"))
5567      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
5568    if (json.has("_versionNeeded"))
5569      parseElementProperties(json.getAsJsonObject("_versionNeeded"), res.getVersionNeededElement());
5570    if (json.has("content"))
5571      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
5572    if (json.has("_content"))
5573      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
5574    if (json.has("supplements"))
5575      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
5576    if (json.has("_supplements"))
5577      parseElementProperties(json.getAsJsonObject("_supplements"), res.getSupplementsElement());
5578    if (json.has("count"))
5579      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
5580    if (json.has("_count"))
5581      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
5582    if (json.has("filter")) {
5583      JsonArray array = json.getAsJsonArray("filter");
5584      for (int i = 0; i < array.size(); i++) {
5585        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
5586      }
5587    };
5588    if (json.has("property")) {
5589      JsonArray array = json.getAsJsonArray("property");
5590      for (int i = 0; i < array.size(); i++) {
5591        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
5592      }
5593    };
5594    if (json.has("concept")) {
5595      JsonArray array = json.getAsJsonArray("concept");
5596      for (int i = 0; i < array.size(); i++) {
5597        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
5598      }
5599    };
5600  }
5601
5602  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5603    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
5604    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
5605    return res;
5606  }
5607
5608  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
5609    parseBackboneElementProperties(json, res);
5610    if (json.has("code"))
5611      res.setCodeElement(parseCode(json.get("code").getAsString()));
5612    if (json.has("_code"))
5613      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5614    if (json.has("description"))
5615      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5616    if (json.has("_description"))
5617      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5618    if (json.has("operator")) {
5619      JsonArray array = json.getAsJsonArray("operator");
5620      for (int i = 0; i < array.size(); i++) {
5621        res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
5622      }
5623    };
5624    if (json.has("_operator")) {
5625      JsonArray array = json.getAsJsonArray("_operator");
5626      for (int i = 0; i < array.size(); i++) {
5627        if (i == res.getOperator().size())
5628          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
5629        if (array.get(i) instanceof JsonObject) 
5630          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
5631      }
5632    };
5633    if (json.has("value"))
5634      res.setValueElement(parseString(json.get("value").getAsString()));
5635    if (json.has("_value"))
5636      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
5637  }
5638
5639  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5640    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
5641    parseCodeSystemPropertyComponentProperties(json, owner, res);
5642    return res;
5643  }
5644
5645  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
5646    parseBackboneElementProperties(json, res);
5647    if (json.has("code"))
5648      res.setCodeElement(parseCode(json.get("code").getAsString()));
5649    if (json.has("_code"))
5650      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5651    if (json.has("uri"))
5652      res.setUriElement(parseUri(json.get("uri").getAsString()));
5653    if (json.has("_uri"))
5654      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
5655    if (json.has("description"))
5656      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5657    if (json.has("_description"))
5658      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5659    if (json.has("type"))
5660      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
5661    if (json.has("_type"))
5662      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5663  }
5664
5665  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5666    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
5667    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
5668    return res;
5669  }
5670
5671  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
5672    parseBackboneElementProperties(json, res);
5673    if (json.has("code"))
5674      res.setCodeElement(parseCode(json.get("code").getAsString()));
5675    if (json.has("_code"))
5676      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5677    if (json.has("display"))
5678      res.setDisplayElement(parseString(json.get("display").getAsString()));
5679    if (json.has("_display"))
5680      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
5681    if (json.has("definition"))
5682      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
5683    if (json.has("_definition"))
5684      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
5685    if (json.has("designation")) {
5686      JsonArray array = json.getAsJsonArray("designation");
5687      for (int i = 0; i < array.size(); i++) {
5688        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
5689      }
5690    };
5691    if (json.has("property")) {
5692      JsonArray array = json.getAsJsonArray("property");
5693      for (int i = 0; i < array.size(); i++) {
5694        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
5695      }
5696    };
5697    if (json.has("concept")) {
5698      JsonArray array = json.getAsJsonArray("concept");
5699      for (int i = 0; i < array.size(); i++) {
5700        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
5701      }
5702    };
5703  }
5704
5705  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5706    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
5707    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
5708    return res;
5709  }
5710
5711  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
5712    parseBackboneElementProperties(json, res);
5713    if (json.has("language"))
5714      res.setLanguageElement(parseCode(json.get("language").getAsString()));
5715    if (json.has("_language"))
5716      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
5717    if (json.has("use"))
5718      res.setUse(parseCoding(json.getAsJsonObject("use")));
5719    if (json.has("value"))
5720      res.setValueElement(parseString(json.get("value").getAsString()));
5721    if (json.has("_value"))
5722      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
5723  }
5724
5725  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5726    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
5727    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
5728    return res;
5729  }
5730
5731  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
5732    parseBackboneElementProperties(json, res);
5733    if (json.has("code"))
5734      res.setCodeElement(parseCode(json.get("code").getAsString()));
5735    if (json.has("_code"))
5736      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5737    Type value = parseType("value", json);
5738    if (value != null)
5739      res.setValue(value);
5740  }
5741
5742  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
5743    Communication res = new Communication();
5744    parseCommunicationProperties(json, res);
5745    return res;
5746  }
5747
5748  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
5749    parseDomainResourceProperties(json, res);
5750    if (json.has("identifier")) {
5751      JsonArray array = json.getAsJsonArray("identifier");
5752      for (int i = 0; i < array.size(); i++) {
5753        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5754      }
5755    };
5756    if (json.has("instantiates")) {
5757      JsonArray array = json.getAsJsonArray("instantiates");
5758      for (int i = 0; i < array.size(); i++) {
5759        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
5760      }
5761    };
5762    if (json.has("_instantiates")) {
5763      JsonArray array = json.getAsJsonArray("_instantiates");
5764      for (int i = 0; i < array.size(); i++) {
5765        if (i == res.getInstantiates().size())
5766          res.getInstantiates().add(parseUri(null));
5767        if (array.get(i) instanceof JsonObject) 
5768          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
5769      }
5770    };
5771    if (json.has("basedOn")) {
5772      JsonArray array = json.getAsJsonArray("basedOn");
5773      for (int i = 0; i < array.size(); i++) {
5774        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5775      }
5776    };
5777    if (json.has("partOf")) {
5778      JsonArray array = json.getAsJsonArray("partOf");
5779      for (int i = 0; i < array.size(); i++) {
5780        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5781      }
5782    };
5783    if (json.has("inResponseTo")) {
5784      JsonArray array = json.getAsJsonArray("inResponseTo");
5785      for (int i = 0; i < array.size(); i++) {
5786        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
5787      }
5788    };
5789    if (json.has("status"))
5790      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
5791    if (json.has("_status"))
5792      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5793    if (json.has("statusReason"))
5794      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
5795    if (json.has("category")) {
5796      JsonArray array = json.getAsJsonArray("category");
5797      for (int i = 0; i < array.size(); i++) {
5798        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5799      }
5800    };
5801    if (json.has("priority"))
5802      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Communication.CommunicationPriority.NULL, new Communication.CommunicationPriorityEnumFactory()));
5803    if (json.has("_priority"))
5804      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
5805    if (json.has("medium")) {
5806      JsonArray array = json.getAsJsonArray("medium");
5807      for (int i = 0; i < array.size(); i++) {
5808        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5809      }
5810    };
5811    if (json.has("subject"))
5812      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5813    if (json.has("recipient")) {
5814      JsonArray array = json.getAsJsonArray("recipient");
5815      for (int i = 0; i < array.size(); i++) {
5816        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
5817      }
5818    };
5819    if (json.has("topic"))
5820      res.setTopic(parseCodeableConcept(json.getAsJsonObject("topic")));
5821    if (json.has("about")) {
5822      JsonArray array = json.getAsJsonArray("about");
5823      for (int i = 0; i < array.size(); i++) {
5824        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
5825      }
5826    };
5827    if (json.has("context"))
5828      res.setContext(parseReference(json.getAsJsonObject("context")));
5829    if (json.has("sent"))
5830      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
5831    if (json.has("_sent"))
5832      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
5833    if (json.has("received"))
5834      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
5835    if (json.has("_received"))
5836      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
5837    if (json.has("sender"))
5838      res.setSender(parseReference(json.getAsJsonObject("sender")));
5839    if (json.has("reasonCode")) {
5840      JsonArray array = json.getAsJsonArray("reasonCode");
5841      for (int i = 0; i < array.size(); i++) {
5842        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5843      }
5844    };
5845    if (json.has("reasonReference")) {
5846      JsonArray array = json.getAsJsonArray("reasonReference");
5847      for (int i = 0; i < array.size(); i++) {
5848        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5849      }
5850    };
5851    if (json.has("payload")) {
5852      JsonArray array = json.getAsJsonArray("payload");
5853      for (int i = 0; i < array.size(); i++) {
5854        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
5855      }
5856    };
5857    if (json.has("note")) {
5858      JsonArray array = json.getAsJsonArray("note");
5859      for (int i = 0; i < array.size(); i++) {
5860        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5861      }
5862    };
5863  }
5864
5865  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
5866    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
5867    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
5868    return res;
5869  }
5870
5871  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
5872    parseBackboneElementProperties(json, res);
5873    Type content = parseType("content", json);
5874    if (content != null)
5875      res.setContent(content);
5876  }
5877
5878  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
5879    CommunicationRequest res = new CommunicationRequest();
5880    parseCommunicationRequestProperties(json, res);
5881    return res;
5882  }
5883
5884  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
5885    parseDomainResourceProperties(json, res);
5886    if (json.has("identifier")) {
5887      JsonArray array = json.getAsJsonArray("identifier");
5888      for (int i = 0; i < array.size(); i++) {
5889        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5890      }
5891    };
5892    if (json.has("basedOn")) {
5893      JsonArray array = json.getAsJsonArray("basedOn");
5894      for (int i = 0; i < array.size(); i++) {
5895        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5896      }
5897    };
5898    if (json.has("replaces")) {
5899      JsonArray array = json.getAsJsonArray("replaces");
5900      for (int i = 0; i < array.size(); i++) {
5901        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
5902      }
5903    };
5904    if (json.has("groupIdentifier"))
5905      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
5906    if (json.has("status"))
5907      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
5908    if (json.has("_status"))
5909      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5910    if (json.has("category")) {
5911      JsonArray array = json.getAsJsonArray("category");
5912      for (int i = 0; i < array.size(); i++) {
5913        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5914      }
5915    };
5916    if (json.has("priority"))
5917      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
5918    if (json.has("_priority"))
5919      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
5920    if (json.has("medium")) {
5921      JsonArray array = json.getAsJsonArray("medium");
5922      for (int i = 0; i < array.size(); i++) {
5923        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5924      }
5925    };
5926    if (json.has("subject"))
5927      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5928    if (json.has("recipient")) {
5929      JsonArray array = json.getAsJsonArray("recipient");
5930      for (int i = 0; i < array.size(); i++) {
5931        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
5932      }
5933    };
5934    if (json.has("about")) {
5935      JsonArray array = json.getAsJsonArray("about");
5936      for (int i = 0; i < array.size(); i++) {
5937        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
5938      }
5939    };
5940    if (json.has("context"))
5941      res.setContext(parseReference(json.getAsJsonObject("context")));
5942    if (json.has("payload")) {
5943      JsonArray array = json.getAsJsonArray("payload");
5944      for (int i = 0; i < array.size(); i++) {
5945        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
5946      }
5947    };
5948    Type occurrence = parseType("occurrence", json);
5949    if (occurrence != null)
5950      res.setOccurrence(occurrence);
5951    if (json.has("authoredOn"))
5952      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
5953    if (json.has("_authoredOn"))
5954      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
5955    if (json.has("requester"))
5956      res.setRequester(parseReference(json.getAsJsonObject("requester")));
5957    if (json.has("sender"))
5958      res.setSender(parseReference(json.getAsJsonObject("sender")));
5959    if (json.has("reasonCode")) {
5960      JsonArray array = json.getAsJsonArray("reasonCode");
5961      for (int i = 0; i < array.size(); i++) {
5962        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5963      }
5964    };
5965    if (json.has("reasonReference")) {
5966      JsonArray array = json.getAsJsonArray("reasonReference");
5967      for (int i = 0; i < array.size(); i++) {
5968        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5969      }
5970    };
5971    if (json.has("note")) {
5972      JsonArray array = json.getAsJsonArray("note");
5973      for (int i = 0; i < array.size(); i++) {
5974        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5975      }
5976    };
5977  }
5978
5979  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
5980    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
5981    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
5982    return res;
5983  }
5984
5985  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
5986    parseBackboneElementProperties(json, res);
5987    Type content = parseType("content", json);
5988    if (content != null)
5989      res.setContent(content);
5990  }
5991
5992  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
5993    CompartmentDefinition res = new CompartmentDefinition();
5994    parseCompartmentDefinitionProperties(json, res);
5995    return res;
5996  }
5997
5998  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
5999    parseDomainResourceProperties(json, res);
6000    if (json.has("url"))
6001      res.setUrlElement(parseUri(json.get("url").getAsString()));
6002    if (json.has("_url"))
6003      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6004    if (json.has("name"))
6005      res.setNameElement(parseString(json.get("name").getAsString()));
6006    if (json.has("_name"))
6007      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6008    if (json.has("title"))
6009      res.setTitleElement(parseString(json.get("title").getAsString()));
6010    if (json.has("_title"))
6011      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6012    if (json.has("status"))
6013      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6014    if (json.has("_status"))
6015      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6016    if (json.has("experimental"))
6017      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6018    if (json.has("_experimental"))
6019      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6020    if (json.has("date"))
6021      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6022    if (json.has("_date"))
6023      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6024    if (json.has("publisher"))
6025      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6026    if (json.has("_publisher"))
6027      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6028    if (json.has("contact")) {
6029      JsonArray array = json.getAsJsonArray("contact");
6030      for (int i = 0; i < array.size(); i++) {
6031        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6032      }
6033    };
6034    if (json.has("description"))
6035      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6036    if (json.has("_description"))
6037      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6038    if (json.has("useContext")) {
6039      JsonArray array = json.getAsJsonArray("useContext");
6040      for (int i = 0; i < array.size(); i++) {
6041        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6042      }
6043    };
6044    if (json.has("jurisdiction")) {
6045      JsonArray array = json.getAsJsonArray("jurisdiction");
6046      for (int i = 0; i < array.size(); i++) {
6047        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6048      }
6049    };
6050    if (json.has("purpose"))
6051      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6052    if (json.has("_purpose"))
6053      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6054    if (json.has("code"))
6055      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
6056    if (json.has("_code"))
6057      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6058    if (json.has("search"))
6059      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
6060    if (json.has("_search"))
6061      parseElementProperties(json.getAsJsonObject("_search"), res.getSearchElement());
6062    if (json.has("resource")) {
6063      JsonArray array = json.getAsJsonArray("resource");
6064      for (int i = 0; i < array.size(); i++) {
6065        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
6066      }
6067    };
6068  }
6069
6070  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
6071    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
6072    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
6073    return res;
6074  }
6075
6076  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
6077    parseBackboneElementProperties(json, res);
6078    if (json.has("code"))
6079      res.setCodeElement(parseCode(json.get("code").getAsString()));
6080    if (json.has("_code"))
6081      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6082    if (json.has("param")) {
6083      JsonArray array = json.getAsJsonArray("param");
6084      for (int i = 0; i < array.size(); i++) {
6085        res.getParam().add(parseString(array.get(i).getAsString()));
6086      }
6087    };
6088    if (json.has("_param")) {
6089      JsonArray array = json.getAsJsonArray("_param");
6090      for (int i = 0; i < array.size(); i++) {
6091        if (i == res.getParam().size())
6092          res.getParam().add(parseString(null));
6093        if (array.get(i) instanceof JsonObject) 
6094          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
6095      }
6096    };
6097    if (json.has("documentation"))
6098      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
6099    if (json.has("_documentation"))
6100      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
6101  }
6102
6103  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
6104    Composition res = new Composition();
6105    parseCompositionProperties(json, res);
6106    return res;
6107  }
6108
6109  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
6110    parseDomainResourceProperties(json, res);
6111    if (json.has("identifier"))
6112      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6113    if (json.has("status"))
6114      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
6115    if (json.has("_status"))
6116      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6117    if (json.has("type"))
6118      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6119    if (json.has("class"))
6120      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
6121    if (json.has("subject"))
6122      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6123    if (json.has("encounter"))
6124      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6125    if (json.has("date"))
6126      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6127    if (json.has("_date"))
6128      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6129    if (json.has("author")) {
6130      JsonArray array = json.getAsJsonArray("author");
6131      for (int i = 0; i < array.size(); i++) {
6132        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6133      }
6134    };
6135    if (json.has("title"))
6136      res.setTitleElement(parseString(json.get("title").getAsString()));
6137    if (json.has("_title"))
6138      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6139    if (json.has("confidentiality"))
6140      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
6141    if (json.has("_confidentiality"))
6142      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
6143    if (json.has("attester")) {
6144      JsonArray array = json.getAsJsonArray("attester");
6145      for (int i = 0; i < array.size(); i++) {
6146        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
6147      }
6148    };
6149    if (json.has("custodian"))
6150      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
6151    if (json.has("relatesTo")) {
6152      JsonArray array = json.getAsJsonArray("relatesTo");
6153      for (int i = 0; i < array.size(); i++) {
6154        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
6155      }
6156    };
6157    if (json.has("event")) {
6158      JsonArray array = json.getAsJsonArray("event");
6159      for (int i = 0; i < array.size(); i++) {
6160        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
6161      }
6162    };
6163    if (json.has("section")) {
6164      JsonArray array = json.getAsJsonArray("section");
6165      for (int i = 0; i < array.size(); i++) {
6166        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
6167      }
6168    };
6169  }
6170
6171  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6172    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
6173    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
6174    return res;
6175  }
6176
6177  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
6178    parseBackboneElementProperties(json, res);
6179    if (json.has("mode"))
6180      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
6181    if (json.has("_mode"))
6182      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6183    if (json.has("time"))
6184      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
6185    if (json.has("_time"))
6186      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
6187    if (json.has("party"))
6188      res.setParty(parseReference(json.getAsJsonObject("party")));
6189  }
6190
6191  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6192    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
6193    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
6194    return res;
6195  }
6196
6197  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
6198    parseBackboneElementProperties(json, res);
6199    if (json.has("code"))
6200      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
6201    if (json.has("_code"))
6202      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6203    Type target = parseType("target", json);
6204    if (target != null)
6205      res.setTarget(target);
6206  }
6207
6208  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6209    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
6210    parseCompositionCompositionEventComponentProperties(json, owner, res);
6211    return res;
6212  }
6213
6214  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
6215    parseBackboneElementProperties(json, res);
6216    if (json.has("code")) {
6217      JsonArray array = json.getAsJsonArray("code");
6218      for (int i = 0; i < array.size(); i++) {
6219        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6220      }
6221    };
6222    if (json.has("period"))
6223      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6224    if (json.has("detail")) {
6225      JsonArray array = json.getAsJsonArray("detail");
6226      for (int i = 0; i < array.size(); i++) {
6227        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
6228      }
6229    };
6230  }
6231
6232  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6233    Composition.SectionComponent res = new Composition.SectionComponent();
6234    parseCompositionSectionComponentProperties(json, owner, res);
6235    return res;
6236  }
6237
6238  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
6239    parseBackboneElementProperties(json, res);
6240    if (json.has("title"))
6241      res.setTitleElement(parseString(json.get("title").getAsString()));
6242    if (json.has("_title"))
6243      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6244    if (json.has("code"))
6245      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6246    if (json.has("author")) {
6247      JsonArray array = json.getAsJsonArray("author");
6248      for (int i = 0; i < array.size(); i++) {
6249        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6250      }
6251    };
6252    if (json.has("text"))
6253      res.setText(parseNarrative(json.getAsJsonObject("text")));
6254    if (json.has("mode"))
6255      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
6256    if (json.has("_mode"))
6257      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6258    if (json.has("orderedBy"))
6259      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
6260    if (json.has("entry")) {
6261      JsonArray array = json.getAsJsonArray("entry");
6262      for (int i = 0; i < array.size(); i++) {
6263        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
6264      }
6265    };
6266    if (json.has("emptyReason"))
6267      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
6268    if (json.has("section")) {
6269      JsonArray array = json.getAsJsonArray("section");
6270      for (int i = 0; i < array.size(); i++) {
6271        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
6272      }
6273    };
6274  }
6275
6276  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
6277    ConceptMap res = new ConceptMap();
6278    parseConceptMapProperties(json, res);
6279    return res;
6280  }
6281
6282  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
6283    parseDomainResourceProperties(json, res);
6284    if (json.has("url"))
6285      res.setUrlElement(parseUri(json.get("url").getAsString()));
6286    if (json.has("_url"))
6287      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6288    if (json.has("identifier"))
6289      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6290    if (json.has("version"))
6291      res.setVersionElement(parseString(json.get("version").getAsString()));
6292    if (json.has("_version"))
6293      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6294    if (json.has("name"))
6295      res.setNameElement(parseString(json.get("name").getAsString()));
6296    if (json.has("_name"))
6297      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6298    if (json.has("title"))
6299      res.setTitleElement(parseString(json.get("title").getAsString()));
6300    if (json.has("_title"))
6301      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6302    if (json.has("status"))
6303      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6304    if (json.has("_status"))
6305      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6306    if (json.has("experimental"))
6307      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6308    if (json.has("_experimental"))
6309      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6310    if (json.has("date"))
6311      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6312    if (json.has("_date"))
6313      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6314    if (json.has("publisher"))
6315      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6316    if (json.has("_publisher"))
6317      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6318    if (json.has("contact")) {
6319      JsonArray array = json.getAsJsonArray("contact");
6320      for (int i = 0; i < array.size(); i++) {
6321        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6322      }
6323    };
6324    if (json.has("description"))
6325      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6326    if (json.has("_description"))
6327      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6328    if (json.has("useContext")) {
6329      JsonArray array = json.getAsJsonArray("useContext");
6330      for (int i = 0; i < array.size(); i++) {
6331        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6332      }
6333    };
6334    if (json.has("jurisdiction")) {
6335      JsonArray array = json.getAsJsonArray("jurisdiction");
6336      for (int i = 0; i < array.size(); i++) {
6337        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6338      }
6339    };
6340    if (json.has("purpose"))
6341      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6342    if (json.has("_purpose"))
6343      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6344    if (json.has("copyright"))
6345      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6346    if (json.has("_copyright"))
6347      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6348    Type source = parseType("source", json);
6349    if (source != null)
6350      res.setSource(source);
6351    Type target = parseType("target", json);
6352    if (target != null)
6353      res.setTarget(target);
6354    if (json.has("group")) {
6355      JsonArray array = json.getAsJsonArray("group");
6356      for (int i = 0; i < array.size(); i++) {
6357        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
6358      }
6359    };
6360  }
6361
6362  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6363    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
6364    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
6365    return res;
6366  }
6367
6368  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
6369    parseBackboneElementProperties(json, res);
6370    if (json.has("source"))
6371      res.setSourceElement(parseUri(json.get("source").getAsString()));
6372    if (json.has("_source"))
6373      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
6374    if (json.has("sourceVersion"))
6375      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
6376    if (json.has("_sourceVersion"))
6377      parseElementProperties(json.getAsJsonObject("_sourceVersion"), res.getSourceVersionElement());
6378    if (json.has("target"))
6379      res.setTargetElement(parseUri(json.get("target").getAsString()));
6380    if (json.has("_target"))
6381      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
6382    if (json.has("targetVersion"))
6383      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
6384    if (json.has("_targetVersion"))
6385      parseElementProperties(json.getAsJsonObject("_targetVersion"), res.getTargetVersionElement());
6386    if (json.has("element")) {
6387      JsonArray array = json.getAsJsonArray("element");
6388      for (int i = 0; i < array.size(); i++) {
6389        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
6390      }
6391    };
6392    if (json.has("unmapped"))
6393      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(json.getAsJsonObject("unmapped"), owner));
6394  }
6395
6396  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6397    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
6398    parseConceptMapSourceElementComponentProperties(json, owner, res);
6399    return res;
6400  }
6401
6402  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
6403    parseBackboneElementProperties(json, res);
6404    if (json.has("code"))
6405      res.setCodeElement(parseCode(json.get("code").getAsString()));
6406    if (json.has("_code"))
6407      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6408    if (json.has("display"))
6409      res.setDisplayElement(parseString(json.get("display").getAsString()));
6410    if (json.has("_display"))
6411      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6412    if (json.has("target")) {
6413      JsonArray array = json.getAsJsonArray("target");
6414      for (int i = 0; i < array.size(); i++) {
6415        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
6416      }
6417    };
6418  }
6419
6420  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6421    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
6422    parseConceptMapTargetElementComponentProperties(json, owner, res);
6423    return res;
6424  }
6425
6426  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
6427    parseBackboneElementProperties(json, res);
6428    if (json.has("code"))
6429      res.setCodeElement(parseCode(json.get("code").getAsString()));
6430    if (json.has("_code"))
6431      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6432    if (json.has("display"))
6433      res.setDisplayElement(parseString(json.get("display").getAsString()));
6434    if (json.has("_display"))
6435      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6436    if (json.has("equivalence"))
6437      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
6438    if (json.has("_equivalence"))
6439      parseElementProperties(json.getAsJsonObject("_equivalence"), res.getEquivalenceElement());
6440    if (json.has("comment"))
6441      res.setCommentElement(parseString(json.get("comment").getAsString()));
6442    if (json.has("_comment"))
6443      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
6444    if (json.has("dependsOn")) {
6445      JsonArray array = json.getAsJsonArray("dependsOn");
6446      for (int i = 0; i < array.size(); i++) {
6447        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
6448      }
6449    };
6450    if (json.has("product")) {
6451      JsonArray array = json.getAsJsonArray("product");
6452      for (int i = 0; i < array.size(); i++) {
6453        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
6454      }
6455    };
6456  }
6457
6458  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6459    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
6460    parseConceptMapOtherElementComponentProperties(json, owner, res);
6461    return res;
6462  }
6463
6464  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
6465    parseBackboneElementProperties(json, res);
6466    if (json.has("property"))
6467      res.setPropertyElement(parseUri(json.get("property").getAsString()));
6468    if (json.has("_property"))
6469      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
6470    if (json.has("system"))
6471      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
6472    if (json.has("_system"))
6473      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
6474    if (json.has("value"))
6475      res.setValueElement(parseString(json.get("value").getAsString()));
6476    if (json.has("_value"))
6477      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6478    if (json.has("display"))
6479      res.setDisplayElement(parseString(json.get("display").getAsString()));
6480    if (json.has("_display"))
6481      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6482  }
6483
6484  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6485    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
6486    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
6487    return res;
6488  }
6489
6490  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
6491    parseBackboneElementProperties(json, res);
6492    if (json.has("mode"))
6493      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
6494    if (json.has("_mode"))
6495      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6496    if (json.has("code"))
6497      res.setCodeElement(parseCode(json.get("code").getAsString()));
6498    if (json.has("_code"))
6499      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6500    if (json.has("display"))
6501      res.setDisplayElement(parseString(json.get("display").getAsString()));
6502    if (json.has("_display"))
6503      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6504    if (json.has("url"))
6505      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
6506    if (json.has("_url"))
6507      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6508  }
6509
6510  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
6511    Condition res = new Condition();
6512    parseConditionProperties(json, res);
6513    return res;
6514  }
6515
6516  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
6517    parseDomainResourceProperties(json, res);
6518    if (json.has("identifier")) {
6519      JsonArray array = json.getAsJsonArray("identifier");
6520      for (int i = 0; i < array.size(); i++) {
6521        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6522      }
6523    };
6524    if (json.has("clinicalStatus"))
6525      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), Condition.ConditionClinicalStatus.NULL, new Condition.ConditionClinicalStatusEnumFactory()));
6526    if (json.has("_clinicalStatus"))
6527      parseElementProperties(json.getAsJsonObject("_clinicalStatus"), res.getClinicalStatusElement());
6528    if (json.has("verificationStatus"))
6529      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), Condition.ConditionVerificationStatus.NULL, new Condition.ConditionVerificationStatusEnumFactory()));
6530    if (json.has("_verificationStatus"))
6531      parseElementProperties(json.getAsJsonObject("_verificationStatus"), res.getVerificationStatusElement());
6532    if (json.has("category")) {
6533      JsonArray array = json.getAsJsonArray("category");
6534      for (int i = 0; i < array.size(); i++) {
6535        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6536      }
6537    };
6538    if (json.has("severity"))
6539      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
6540    if (json.has("code"))
6541      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6542    if (json.has("bodySite")) {
6543      JsonArray array = json.getAsJsonArray("bodySite");
6544      for (int i = 0; i < array.size(); i++) {
6545        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6546      }
6547    };
6548    if (json.has("subject"))
6549      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6550    if (json.has("context"))
6551      res.setContext(parseReference(json.getAsJsonObject("context")));
6552    Type onset = parseType("onset", json);
6553    if (onset != null)
6554      res.setOnset(onset);
6555    Type abatement = parseType("abatement", json);
6556    if (abatement != null)
6557      res.setAbatement(abatement);
6558    if (json.has("assertedDate"))
6559      res.setAssertedDateElement(parseDateTime(json.get("assertedDate").getAsString()));
6560    if (json.has("_assertedDate"))
6561      parseElementProperties(json.getAsJsonObject("_assertedDate"), res.getAssertedDateElement());
6562    if (json.has("recorder"))
6563      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
6564    if (json.has("asserter"))
6565      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
6566    if (json.has("stage")) {
6567      JsonArray array = json.getAsJsonArray("stage");
6568      for (int i = 0; i < array.size(); i++) {
6569        res.getStage().add(parseConditionConditionStageComponent(array.get(i).getAsJsonObject(), res));
6570      }
6571    };
6572    if (json.has("evidence")) {
6573      JsonArray array = json.getAsJsonArray("evidence");
6574      for (int i = 0; i < array.size(); i++) {
6575        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
6576      }
6577    };
6578    if (json.has("note")) {
6579      JsonArray array = json.getAsJsonArray("note");
6580      for (int i = 0; i < array.size(); i++) {
6581        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6582      }
6583    };
6584  }
6585
6586  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
6587    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
6588    parseConditionConditionStageComponentProperties(json, owner, res);
6589    return res;
6590  }
6591
6592  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
6593    parseBackboneElementProperties(json, res);
6594    if (json.has("summary"))
6595      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
6596    if (json.has("assessment")) {
6597      JsonArray array = json.getAsJsonArray("assessment");
6598      for (int i = 0; i < array.size(); i++) {
6599        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
6600      }
6601    };
6602    if (json.has("type"))
6603      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6604  }
6605
6606  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
6607    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
6608    parseConditionConditionEvidenceComponentProperties(json, owner, res);
6609    return res;
6610  }
6611
6612  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
6613    parseBackboneElementProperties(json, res);
6614    if (json.has("code")) {
6615      JsonArray array = json.getAsJsonArray("code");
6616      for (int i = 0; i < array.size(); i++) {
6617        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6618      }
6619    };
6620    if (json.has("detail")) {
6621      JsonArray array = json.getAsJsonArray("detail");
6622      for (int i = 0; i < array.size(); i++) {
6623        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
6624      }
6625    };
6626  }
6627
6628  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
6629    Consent res = new Consent();
6630    parseConsentProperties(json, res);
6631    return res;
6632  }
6633
6634  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
6635    parseDomainResourceProperties(json, res);
6636    if (json.has("identifier")) {
6637      JsonArray array = json.getAsJsonArray("identifier");
6638      for (int i = 0; i < array.size(); i++) {
6639        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6640      }
6641    };
6642    if (json.has("status"))
6643      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
6644    if (json.has("_status"))
6645      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6646    if (json.has("scope"))
6647      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
6648    if (json.has("category")) {
6649      JsonArray array = json.getAsJsonArray("category");
6650      for (int i = 0; i < array.size(); i++) {
6651        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6652      }
6653    };
6654    if (json.has("patient"))
6655      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6656    if (json.has("dateTime"))
6657      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
6658    if (json.has("_dateTime"))
6659      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
6660    if (json.has("performer")) {
6661      JsonArray array = json.getAsJsonArray("performer");
6662      for (int i = 0; i < array.size(); i++) {
6663        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
6664      }
6665    };
6666    if (json.has("organization")) {
6667      JsonArray array = json.getAsJsonArray("organization");
6668      for (int i = 0; i < array.size(); i++) {
6669        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
6670      }
6671    };
6672    Type source = parseType("source", json);
6673    if (source != null)
6674      res.setSource(source);
6675    if (json.has("policy")) {
6676      JsonArray array = json.getAsJsonArray("policy");
6677      for (int i = 0; i < array.size(); i++) {
6678        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
6679      }
6680    };
6681    if (json.has("policyRule"))
6682      res.setPolicyRule(parseCodeableConcept(json.getAsJsonObject("policyRule")));
6683    if (json.has("verification")) {
6684      JsonArray array = json.getAsJsonArray("verification");
6685      for (int i = 0; i < array.size(); i++) {
6686        res.getVerification().add(parseConsentConsentVerificationComponent(array.get(i).getAsJsonObject(), res));
6687      }
6688    };
6689    if (json.has("provision"))
6690      res.setProvision(parseConsentprovisionComponent(json.getAsJsonObject("provision"), res));
6691  }
6692
6693  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6694    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
6695    parseConsentConsentPolicyComponentProperties(json, owner, res);
6696    return res;
6697  }
6698
6699  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
6700    parseBackboneElementProperties(json, res);
6701    if (json.has("authority"))
6702      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
6703    if (json.has("_authority"))
6704      parseElementProperties(json.getAsJsonObject("_authority"), res.getAuthorityElement());
6705    if (json.has("uri"))
6706      res.setUriElement(parseUri(json.get("uri").getAsString()));
6707    if (json.has("_uri"))
6708      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
6709  }
6710
6711  protected Consent.ConsentVerificationComponent parseConsentConsentVerificationComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6712    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
6713    parseConsentConsentVerificationComponentProperties(json, owner, res);
6714    return res;
6715  }
6716
6717  protected void parseConsentConsentVerificationComponentProperties(JsonObject json, Consent owner, Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
6718    parseBackboneElementProperties(json, res);
6719    if (json.has("verified"))
6720      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
6721    if (json.has("_verified"))
6722      parseElementProperties(json.getAsJsonObject("_verified"), res.getVerifiedElement());
6723    if (json.has("verifiedWith"))
6724      res.setVerifiedWith(parseReference(json.getAsJsonObject("verifiedWith")));
6725    if (json.has("verificationDate"))
6726      res.setVerificationDateElement(parseDateTime(json.get("verificationDate").getAsString()));
6727    if (json.has("_verificationDate"))
6728      parseElementProperties(json.getAsJsonObject("_verificationDate"), res.getVerificationDateElement());
6729  }
6730
6731  protected Consent.provisionComponent parseConsentprovisionComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6732    Consent.provisionComponent res = new Consent.provisionComponent();
6733    parseConsentprovisionComponentProperties(json, owner, res);
6734    return res;
6735  }
6736
6737  protected void parseConsentprovisionComponentProperties(JsonObject json, Consent owner, Consent.provisionComponent res) throws IOException, FHIRFormatError {
6738    parseBackboneElementProperties(json, res);
6739    if (json.has("type"))
6740      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentProvisionType.NULL, new Consent.ConsentProvisionTypeEnumFactory()));
6741    if (json.has("_type"))
6742      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6743    if (json.has("period"))
6744      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6745    if (json.has("actor")) {
6746      JsonArray array = json.getAsJsonArray("actor");
6747      for (int i = 0; i < array.size(); i++) {
6748        res.getActor().add(parseConsentprovisionActorComponent(array.get(i).getAsJsonObject(), owner));
6749      }
6750    };
6751    if (json.has("action")) {
6752      JsonArray array = json.getAsJsonArray("action");
6753      for (int i = 0; i < array.size(); i++) {
6754        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6755      }
6756    };
6757    if (json.has("securityLabel")) {
6758      JsonArray array = json.getAsJsonArray("securityLabel");
6759      for (int i = 0; i < array.size(); i++) {
6760        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6761      }
6762    };
6763    if (json.has("purpose")) {
6764      JsonArray array = json.getAsJsonArray("purpose");
6765      for (int i = 0; i < array.size(); i++) {
6766        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
6767      }
6768    };
6769    if (json.has("class")) {
6770      JsonArray array = json.getAsJsonArray("class");
6771      for (int i = 0; i < array.size(); i++) {
6772        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
6773      }
6774    };
6775    if (json.has("code")) {
6776      JsonArray array = json.getAsJsonArray("code");
6777      for (int i = 0; i < array.size(); i++) {
6778        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6779      }
6780    };
6781    if (json.has("dataPeriod"))
6782      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
6783    if (json.has("data")) {
6784      JsonArray array = json.getAsJsonArray("data");
6785      for (int i = 0; i < array.size(); i++) {
6786        res.getData().add(parseConsentprovisionDataComponent(array.get(i).getAsJsonObject(), owner));
6787      }
6788    };
6789    if (json.has("provision")) {
6790      JsonArray array = json.getAsJsonArray("provision");
6791      for (int i = 0; i < array.size(); i++) {
6792        res.getProvision().add(parseConsentprovisionComponent(array.get(i).getAsJsonObject(), owner));
6793      }
6794    };
6795  }
6796
6797  protected Consent.provisionActorComponent parseConsentprovisionActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6798    Consent.provisionActorComponent res = new Consent.provisionActorComponent();
6799    parseConsentprovisionActorComponentProperties(json, owner, res);
6800    return res;
6801  }
6802
6803  protected void parseConsentprovisionActorComponentProperties(JsonObject json, Consent owner, Consent.provisionActorComponent res) throws IOException, FHIRFormatError {
6804    parseBackboneElementProperties(json, res);
6805    if (json.has("role"))
6806      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
6807    if (json.has("reference"))
6808      res.setReference(parseReference(json.getAsJsonObject("reference")));
6809  }
6810
6811  protected Consent.provisionDataComponent parseConsentprovisionDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6812    Consent.provisionDataComponent res = new Consent.provisionDataComponent();
6813    parseConsentprovisionDataComponentProperties(json, owner, res);
6814    return res;
6815  }
6816
6817  protected void parseConsentprovisionDataComponentProperties(JsonObject json, Consent owner, Consent.provisionDataComponent res) throws IOException, FHIRFormatError {
6818    parseBackboneElementProperties(json, res);
6819    if (json.has("meaning"))
6820      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
6821    if (json.has("_meaning"))
6822      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
6823    if (json.has("reference"))
6824      res.setReference(parseReference(json.getAsJsonObject("reference")));
6825  }
6826
6827  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
6828    Contract res = new Contract();
6829    parseContractProperties(json, res);
6830    return res;
6831  }
6832
6833  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
6834    parseDomainResourceProperties(json, res);
6835    if (json.has("identifier")) {
6836      JsonArray array = json.getAsJsonArray("identifier");
6837      for (int i = 0; i < array.size(); i++) {
6838        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6839      }
6840    };
6841    if (json.has("status"))
6842      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
6843    if (json.has("_status"))
6844      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6845    if (json.has("contentDerivative"))
6846      res.setContentDerivative(parseCodeableConcept(json.getAsJsonObject("contentDerivative")));
6847    if (json.has("issued"))
6848      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
6849    if (json.has("_issued"))
6850      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
6851    if (json.has("applies"))
6852      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
6853    if (json.has("subject")) {
6854      JsonArray array = json.getAsJsonArray("subject");
6855      for (int i = 0; i < array.size(); i++) {
6856        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
6857      }
6858    };
6859    if (json.has("authority")) {
6860      JsonArray array = json.getAsJsonArray("authority");
6861      for (int i = 0; i < array.size(); i++) {
6862        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
6863      }
6864    };
6865    if (json.has("domain")) {
6866      JsonArray array = json.getAsJsonArray("domain");
6867      for (int i = 0; i < array.size(); i++) {
6868        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
6869      }
6870    };
6871    if (json.has("type"))
6872      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6873    if (json.has("subType")) {
6874      JsonArray array = json.getAsJsonArray("subType");
6875      for (int i = 0; i < array.size(); i++) {
6876        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6877      }
6878    };
6879    if (json.has("term")) {
6880      JsonArray array = json.getAsJsonArray("term");
6881      for (int i = 0; i < array.size(); i++) {
6882        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
6883      }
6884    };
6885    if (json.has("signer")) {
6886      JsonArray array = json.getAsJsonArray("signer");
6887      for (int i = 0; i < array.size(); i++) {
6888        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
6889      }
6890    };
6891    if (json.has("friendly")) {
6892      JsonArray array = json.getAsJsonArray("friendly");
6893      for (int i = 0; i < array.size(); i++) {
6894        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
6895      }
6896    };
6897    if (json.has("legal")) {
6898      JsonArray array = json.getAsJsonArray("legal");
6899      for (int i = 0; i < array.size(); i++) {
6900        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
6901      }
6902    };
6903    if (json.has("rule"))
6904      res.setRule(parseContractComputableLanguageComponent(json.getAsJsonObject("rule"), res));
6905    Type legallyBinding = parseType("legallyBinding", json);
6906    if (legallyBinding != null)
6907      res.setLegallyBinding(legallyBinding);
6908  }
6909
6910  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6911    Contract.TermComponent res = new Contract.TermComponent();
6912    parseContractTermComponentProperties(json, owner, res);
6913    return res;
6914  }
6915
6916  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
6917    parseBackboneElementProperties(json, res);
6918    if (json.has("identifier"))
6919      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6920    if (json.has("issued"))
6921      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
6922    if (json.has("_issued"))
6923      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
6924    if (json.has("applies"))
6925      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
6926    if (json.has("type"))
6927      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6928    if (json.has("subType"))
6929      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
6930    if (json.has("offer"))
6931      res.setOffer(parseContractContractOfferComponent(json.getAsJsonObject("offer"), owner));
6932    if (json.has("asset")) {
6933      JsonArray array = json.getAsJsonArray("asset");
6934      for (int i = 0; i < array.size(); i++) {
6935        res.getAsset().add(parseContractContractAssetComponent(array.get(i).getAsJsonObject(), owner));
6936      }
6937    };
6938    if (json.has("agent")) {
6939      JsonArray array = json.getAsJsonArray("agent");
6940      for (int i = 0; i < array.size(); i++) {
6941        res.getAgent().add(parseContractAgentComponent(array.get(i).getAsJsonObject(), owner));
6942      }
6943    };
6944    if (json.has("action")) {
6945      JsonArray array = json.getAsJsonArray("action");
6946      for (int i = 0; i < array.size(); i++) {
6947        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6948      }
6949    };
6950    if (json.has("actionReason")) {
6951      JsonArray array = json.getAsJsonArray("actionReason");
6952      for (int i = 0; i < array.size(); i++) {
6953        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6954      }
6955    };
6956    if (json.has("group")) {
6957      JsonArray array = json.getAsJsonArray("group");
6958      for (int i = 0; i < array.size(); i++) {
6959        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
6960      }
6961    };
6962  }
6963
6964  protected Contract.ContractOfferComponent parseContractContractOfferComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6965    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
6966    parseContractContractOfferComponentProperties(json, owner, res);
6967    return res;
6968  }
6969
6970  protected void parseContractContractOfferComponentProperties(JsonObject json, Contract owner, Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
6971    parseBackboneElementProperties(json, res);
6972    if (json.has("topic"))
6973      res.setTopic(parseReference(json.getAsJsonObject("topic")));
6974    if (json.has("type"))
6975      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6976    if (json.has("decision"))
6977      res.setDecision(parseCodeableConcept(json.getAsJsonObject("decision")));
6978    if (json.has("text"))
6979      res.setTextElement(parseString(json.get("text").getAsString()));
6980    if (json.has("_text"))
6981      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
6982    if (json.has("linkId"))
6983      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
6984    if (json.has("_linkId"))
6985      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
6986  }
6987
6988  protected Contract.ContractAssetComponent parseContractContractAssetComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6989    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
6990    parseContractContractAssetComponentProperties(json, owner, res);
6991    return res;
6992  }
6993
6994  protected void parseContractContractAssetComponentProperties(JsonObject json, Contract owner, Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
6995    parseBackboneElementProperties(json, res);
6996    if (json.has("class"))
6997      res.setClass_(parseCoding(json.getAsJsonObject("class")));
6998    if (json.has("code"))
6999      res.setCode(parseCoding(json.getAsJsonObject("code")));
7000    if (json.has("period"))
7001      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7002    if (json.has("dataPeriod"))
7003      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
7004    if (json.has("data")) {
7005      JsonArray array = json.getAsJsonArray("data");
7006      for (int i = 0; i < array.size(); i++) {
7007        res.getData().add(parseContractAssetDataComponent(array.get(i).getAsJsonObject(), owner));
7008      }
7009    };
7010    if (json.has("valuedItem")) {
7011      JsonArray array = json.getAsJsonArray("valuedItem");
7012      for (int i = 0; i < array.size(); i++) {
7013        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), owner));
7014      }
7015    };
7016    if (json.has("securityLabel")) {
7017      JsonArray array = json.getAsJsonArray("securityLabel");
7018      for (int i = 0; i < array.size(); i++) {
7019        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
7020      }
7021    };
7022  }
7023
7024  protected Contract.AssetDataComponent parseContractAssetDataComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7025    Contract.AssetDataComponent res = new Contract.AssetDataComponent();
7026    parseContractAssetDataComponentProperties(json, owner, res);
7027    return res;
7028  }
7029
7030  protected void parseContractAssetDataComponentProperties(JsonObject json, Contract owner, Contract.AssetDataComponent res) throws IOException, FHIRFormatError {
7031    parseBackboneElementProperties(json, res);
7032    if (json.has("meaning"))
7033      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Contract.ContractDataMeaning.NULL, new Contract.ContractDataMeaningEnumFactory()));
7034    if (json.has("_meaning"))
7035      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
7036    if (json.has("reference"))
7037      res.setReference(parseReference(json.getAsJsonObject("reference")));
7038  }
7039
7040  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7041    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
7042    parseContractValuedItemComponentProperties(json, owner, res);
7043    return res;
7044  }
7045
7046  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
7047    parseBackboneElementProperties(json, res);
7048    Type entity = parseType("entity", json);
7049    if (entity != null)
7050      res.setEntity(entity);
7051    if (json.has("identifier"))
7052      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7053    if (json.has("effectiveTime"))
7054      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
7055    if (json.has("_effectiveTime"))
7056      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
7057    if (json.has("quantity"))
7058      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
7059    if (json.has("unitPrice"))
7060      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
7061    if (json.has("factor"))
7062      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7063    if (json.has("_factor"))
7064      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
7065    if (json.has("points"))
7066      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
7067    if (json.has("_points"))
7068      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
7069    if (json.has("net"))
7070      res.setNet(parseMoney(json.getAsJsonObject("net")));
7071  }
7072
7073  protected Contract.AgentComponent parseContractAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7074    Contract.AgentComponent res = new Contract.AgentComponent();
7075    parseContractAgentComponentProperties(json, owner, res);
7076    return res;
7077  }
7078
7079  protected void parseContractAgentComponentProperties(JsonObject json, Contract owner, Contract.AgentComponent res) throws IOException, FHIRFormatError {
7080    parseBackboneElementProperties(json, res);
7081    if (json.has("actor"))
7082      res.setActor(parseReference(json.getAsJsonObject("actor")));
7083    if (json.has("role")) {
7084      JsonArray array = json.getAsJsonArray("role");
7085      for (int i = 0; i < array.size(); i++) {
7086        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7087      }
7088    };
7089  }
7090
7091  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7092    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
7093    parseContractSignatoryComponentProperties(json, owner, res);
7094    return res;
7095  }
7096
7097  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
7098    parseBackboneElementProperties(json, res);
7099    if (json.has("type"))
7100      res.setType(parseCoding(json.getAsJsonObject("type")));
7101    if (json.has("party"))
7102      res.setParty(parseReference(json.getAsJsonObject("party")));
7103    if (json.has("signature")) {
7104      JsonArray array = json.getAsJsonArray("signature");
7105      for (int i = 0; i < array.size(); i++) {
7106        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
7107      }
7108    };
7109  }
7110
7111  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7112    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
7113    parseContractFriendlyLanguageComponentProperties(json, owner, res);
7114    return res;
7115  }
7116
7117  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
7118    parseBackboneElementProperties(json, res);
7119    Type content = parseType("content", json);
7120    if (content != null)
7121      res.setContent(content);
7122  }
7123
7124  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7125    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
7126    parseContractLegalLanguageComponentProperties(json, owner, res);
7127    return res;
7128  }
7129
7130  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
7131    parseBackboneElementProperties(json, res);
7132    Type content = parseType("content", json);
7133    if (content != null)
7134      res.setContent(content);
7135  }
7136
7137  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7138    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
7139    parseContractComputableLanguageComponentProperties(json, owner, res);
7140    return res;
7141  }
7142
7143  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
7144    parseBackboneElementProperties(json, res);
7145    Type content = parseType("content", json);
7146    if (content != null)
7147      res.setContent(content);
7148  }
7149
7150  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
7151    Coverage res = new Coverage();
7152    parseCoverageProperties(json, res);
7153    return res;
7154  }
7155
7156  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
7157    parseDomainResourceProperties(json, res);
7158    if (json.has("identifier")) {
7159      JsonArray array = json.getAsJsonArray("identifier");
7160      for (int i = 0; i < array.size(); i++) {
7161        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7162      }
7163    };
7164    if (json.has("status"))
7165      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
7166    if (json.has("_status"))
7167      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7168    if (json.has("type"))
7169      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7170    if (json.has("policyHolder"))
7171      res.setPolicyHolder(parseReference(json.getAsJsonObject("policyHolder")));
7172    if (json.has("subscriber"))
7173      res.setSubscriber(parseReference(json.getAsJsonObject("subscriber")));
7174    if (json.has("subscriberId"))
7175      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
7176    if (json.has("_subscriberId"))
7177      parseElementProperties(json.getAsJsonObject("_subscriberId"), res.getSubscriberIdElement());
7178    if (json.has("beneficiary"))
7179      res.setBeneficiary(parseReference(json.getAsJsonObject("beneficiary")));
7180    if (json.has("dependent"))
7181      res.setDependentElement(parseString(json.get("dependent").getAsString()));
7182    if (json.has("_dependent"))
7183      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
7184    if (json.has("relationship"))
7185      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
7186    if (json.has("period"))
7187      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7188    if (json.has("payor")) {
7189      JsonArray array = json.getAsJsonArray("payor");
7190      for (int i = 0; i < array.size(); i++) {
7191        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
7192      }
7193    };
7194    if (json.has("class")) {
7195      JsonArray array = json.getAsJsonArray("class");
7196      for (int i = 0; i < array.size(); i++) {
7197        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject(), res));
7198      }
7199    };
7200    if (json.has("order"))
7201      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
7202    if (json.has("_order"))
7203      parseElementProperties(json.getAsJsonObject("_order"), res.getOrderElement());
7204    if (json.has("network"))
7205      res.setNetworkElement(parseString(json.get("network").getAsString()));
7206    if (json.has("_network"))
7207      parseElementProperties(json.getAsJsonObject("_network"), res.getNetworkElement());
7208    if (json.has("copay")) {
7209      JsonArray array = json.getAsJsonArray("copay");
7210      for (int i = 0; i < array.size(); i++) {
7211        res.getCopay().add(parseCoverageCoPayComponent(array.get(i).getAsJsonObject(), res));
7212      }
7213    };
7214    if (json.has("contract")) {
7215      JsonArray array = json.getAsJsonArray("contract");
7216      for (int i = 0; i < array.size(); i++) {
7217        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
7218      }
7219    };
7220  }
7221
7222  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
7223    Coverage.ClassComponent res = new Coverage.ClassComponent();
7224    parseCoverageClassComponentProperties(json, owner, res);
7225    return res;
7226  }
7227
7228  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage owner, Coverage.ClassComponent res) throws IOException, FHIRFormatError {
7229    parseBackboneElementProperties(json, res);
7230    if (json.has("type"))
7231      res.setType(parseCoding(json.getAsJsonObject("type")));
7232    if (json.has("value"))
7233      res.setValueElement(parseString(json.get("value").getAsString()));
7234    if (json.has("_value"))
7235      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7236    if (json.has("name"))
7237      res.setNameElement(parseString(json.get("name").getAsString()));
7238    if (json.has("_name"))
7239      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7240  }
7241
7242  protected Coverage.CoPayComponent parseCoverageCoPayComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
7243    Coverage.CoPayComponent res = new Coverage.CoPayComponent();
7244    parseCoverageCoPayComponentProperties(json, owner, res);
7245    return res;
7246  }
7247
7248  protected void parseCoverageCoPayComponentProperties(JsonObject json, Coverage owner, Coverage.CoPayComponent res) throws IOException, FHIRFormatError {
7249    parseBackboneElementProperties(json, res);
7250    if (json.has("type"))
7251      res.setType(parseCoding(json.getAsJsonObject("type")));
7252    if (json.has("value"))
7253      res.setValue(parseQuantity(json.getAsJsonObject("value")));
7254  }
7255
7256  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
7257    DetectedIssue res = new DetectedIssue();
7258    parseDetectedIssueProperties(json, res);
7259    return res;
7260  }
7261
7262  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
7263    parseDomainResourceProperties(json, res);
7264    if (json.has("identifier")) {
7265      JsonArray array = json.getAsJsonArray("identifier");
7266      for (int i = 0; i < array.size(); i++) {
7267        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7268      }
7269    };
7270    if (json.has("status"))
7271      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
7272    if (json.has("_status"))
7273      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7274    if (json.has("category"))
7275      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
7276    if (json.has("severity"))
7277      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
7278    if (json.has("_severity"))
7279      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
7280    if (json.has("patient"))
7281      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7282    if (json.has("date"))
7283      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7284    if (json.has("_date"))
7285      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7286    if (json.has("author"))
7287      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7288    if (json.has("implicated")) {
7289      JsonArray array = json.getAsJsonArray("implicated");
7290      for (int i = 0; i < array.size(); i++) {
7291        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
7292      }
7293    };
7294    if (json.has("detail"))
7295      res.setDetailElement(parseString(json.get("detail").getAsString()));
7296    if (json.has("_detail"))
7297      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
7298    if (json.has("reference"))
7299      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
7300    if (json.has("_reference"))
7301      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
7302    if (json.has("mitigation")) {
7303      JsonArray array = json.getAsJsonArray("mitigation");
7304      for (int i = 0; i < array.size(); i++) {
7305        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
7306      }
7307    };
7308  }
7309
7310  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
7311    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
7312    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
7313    return res;
7314  }
7315
7316  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
7317    parseBackboneElementProperties(json, res);
7318    if (json.has("action"))
7319      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
7320    if (json.has("date"))
7321      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7322    if (json.has("_date"))
7323      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7324    if (json.has("author"))
7325      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7326  }
7327
7328  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
7329    Device res = new Device();
7330    parseDeviceProperties(json, res);
7331    return res;
7332  }
7333
7334  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
7335    parseDomainResourceProperties(json, res);
7336    if (json.has("identifier")) {
7337      JsonArray array = json.getAsJsonArray("identifier");
7338      for (int i = 0; i < array.size(); i++) {
7339        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7340      }
7341    };
7342    if (json.has("udi"))
7343      res.setUdi(parseDeviceDeviceUdiComponent(json.getAsJsonObject("udi"), res));
7344    if (json.has("status"))
7345      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
7346    if (json.has("_status"))
7347      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7348    if (json.has("type"))
7349      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7350    if (json.has("lotNumber"))
7351      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
7352    if (json.has("_lotNumber"))
7353      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
7354    if (json.has("manufacturer"))
7355      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
7356    if (json.has("_manufacturer"))
7357      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
7358    if (json.has("manufactureDate"))
7359      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
7360    if (json.has("_manufactureDate"))
7361      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
7362    if (json.has("expirationDate"))
7363      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
7364    if (json.has("_expirationDate"))
7365      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
7366    if (json.has("model"))
7367      res.setModelElement(parseString(json.get("model").getAsString()));
7368    if (json.has("_model"))
7369      parseElementProperties(json.getAsJsonObject("_model"), res.getModelElement());
7370    if (json.has("version"))
7371      res.setVersionElement(parseString(json.get("version").getAsString()));
7372    if (json.has("_version"))
7373      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7374    if (json.has("patient"))
7375      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7376    if (json.has("owner"))
7377      res.setOwner(parseReference(json.getAsJsonObject("owner")));
7378    if (json.has("contact")) {
7379      JsonArray array = json.getAsJsonArray("contact");
7380      for (int i = 0; i < array.size(); i++) {
7381        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
7382      }
7383    };
7384    if (json.has("location"))
7385      res.setLocation(parseReference(json.getAsJsonObject("location")));
7386    if (json.has("url"))
7387      res.setUrlElement(parseUri(json.get("url").getAsString()));
7388    if (json.has("_url"))
7389      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7390    if (json.has("note")) {
7391      JsonArray array = json.getAsJsonArray("note");
7392      for (int i = 0; i < array.size(); i++) {
7393        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7394      }
7395    };
7396    if (json.has("safety")) {
7397      JsonArray array = json.getAsJsonArray("safety");
7398      for (int i = 0; i < array.size(); i++) {
7399        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7400      }
7401    };
7402  }
7403
7404  protected Device.DeviceUdiComponent parseDeviceDeviceUdiComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
7405    Device.DeviceUdiComponent res = new Device.DeviceUdiComponent();
7406    parseDeviceDeviceUdiComponentProperties(json, owner, res);
7407    return res;
7408  }
7409
7410  protected void parseDeviceDeviceUdiComponentProperties(JsonObject json, Device owner, Device.DeviceUdiComponent res) throws IOException, FHIRFormatError {
7411    parseBackboneElementProperties(json, res);
7412    if (json.has("deviceIdentifier"))
7413      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
7414    if (json.has("_deviceIdentifier"))
7415      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
7416    if (json.has("name"))
7417      res.setNameElement(parseString(json.get("name").getAsString()));
7418    if (json.has("_name"))
7419      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7420    if (json.has("jurisdiction"))
7421      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
7422    if (json.has("_jurisdiction"))
7423      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
7424    if (json.has("carrierHRF"))
7425      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
7426    if (json.has("_carrierHRF"))
7427      parseElementProperties(json.getAsJsonObject("_carrierHRF"), res.getCarrierHRFElement());
7428    if (json.has("carrierAIDC"))
7429      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
7430    if (json.has("_carrierAIDC"))
7431      parseElementProperties(json.getAsJsonObject("_carrierAIDC"), res.getCarrierAIDCElement());
7432    if (json.has("issuer"))
7433      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
7434    if (json.has("_issuer"))
7435      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
7436    if (json.has("entryType"))
7437      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
7438    if (json.has("_entryType"))
7439      parseElementProperties(json.getAsJsonObject("_entryType"), res.getEntryTypeElement());
7440  }
7441
7442  protected DeviceComponent parseDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
7443    DeviceComponent res = new DeviceComponent();
7444    parseDeviceComponentProperties(json, res);
7445    return res;
7446  }
7447
7448  protected void parseDeviceComponentProperties(JsonObject json, DeviceComponent res) throws IOException, FHIRFormatError {
7449    parseDomainResourceProperties(json, res);
7450    if (json.has("identifier")) {
7451      JsonArray array = json.getAsJsonArray("identifier");
7452      for (int i = 0; i < array.size(); i++) {
7453        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7454      }
7455    };
7456    if (json.has("type"))
7457      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7458    if (json.has("lastSystemChange"))
7459      res.setLastSystemChangeElement(parseInstant(json.get("lastSystemChange").getAsString()));
7460    if (json.has("_lastSystemChange"))
7461      parseElementProperties(json.getAsJsonObject("_lastSystemChange"), res.getLastSystemChangeElement());
7462    if (json.has("source"))
7463      res.setSource(parseReference(json.getAsJsonObject("source")));
7464    if (json.has("parent"))
7465      res.setParent(parseReference(json.getAsJsonObject("parent")));
7466    if (json.has("operationalStatus")) {
7467      JsonArray array = json.getAsJsonArray("operationalStatus");
7468      for (int i = 0; i < array.size(); i++) {
7469        res.getOperationalStatus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7470      }
7471    };
7472    if (json.has("parameterGroup"))
7473      res.setParameterGroup(parseCodeableConcept(json.getAsJsonObject("parameterGroup")));
7474    if (json.has("measurementPrinciple"))
7475      res.setMeasurementPrincipleElement(parseEnumeration(json.get("measurementPrinciple").getAsString(), DeviceComponent.MeasmntPrinciple.NULL, new DeviceComponent.MeasmntPrincipleEnumFactory()));
7476    if (json.has("_measurementPrinciple"))
7477      parseElementProperties(json.getAsJsonObject("_measurementPrinciple"), res.getMeasurementPrincipleElement());
7478    if (json.has("productionSpecification")) {
7479      JsonArray array = json.getAsJsonArray("productionSpecification");
7480      for (int i = 0; i < array.size(); i++) {
7481        res.getProductionSpecification().add(parseDeviceComponentDeviceComponentProductionSpecificationComponent(array.get(i).getAsJsonObject(), res));
7482      }
7483    };
7484    if (json.has("languageCode"))
7485      res.setLanguageCode(parseCodeableConcept(json.getAsJsonObject("languageCode")));
7486    if (json.has("property")) {
7487      JsonArray array = json.getAsJsonArray("property");
7488      for (int i = 0; i < array.size(); i++) {
7489        res.getProperty().add(parseDeviceComponentDeviceComponentPropertyComponent(array.get(i).getAsJsonObject(), res));
7490      }
7491    };
7492  }
7493
7494  protected DeviceComponent.DeviceComponentProductionSpecificationComponent parseDeviceComponentDeviceComponentProductionSpecificationComponent(JsonObject json, DeviceComponent owner) throws IOException, FHIRFormatError {
7495    DeviceComponent.DeviceComponentProductionSpecificationComponent res = new DeviceComponent.DeviceComponentProductionSpecificationComponent();
7496    parseDeviceComponentDeviceComponentProductionSpecificationComponentProperties(json, owner, res);
7497    return res;
7498  }
7499
7500  protected void parseDeviceComponentDeviceComponentProductionSpecificationComponentProperties(JsonObject json, DeviceComponent owner, DeviceComponent.DeviceComponentProductionSpecificationComponent res) throws IOException, FHIRFormatError {
7501    parseBackboneElementProperties(json, res);
7502    if (json.has("specType"))
7503      res.setSpecType(parseCodeableConcept(json.getAsJsonObject("specType")));
7504    if (json.has("componentId"))
7505      res.setComponentId(parseIdentifier(json.getAsJsonObject("componentId")));
7506    if (json.has("productionSpec"))
7507      res.setProductionSpecElement(parseString(json.get("productionSpec").getAsString()));
7508    if (json.has("_productionSpec"))
7509      parseElementProperties(json.getAsJsonObject("_productionSpec"), res.getProductionSpecElement());
7510  }
7511
7512  protected DeviceComponent.DeviceComponentPropertyComponent parseDeviceComponentDeviceComponentPropertyComponent(JsonObject json, DeviceComponent owner) throws IOException, FHIRFormatError {
7513    DeviceComponent.DeviceComponentPropertyComponent res = new DeviceComponent.DeviceComponentPropertyComponent();
7514    parseDeviceComponentDeviceComponentPropertyComponentProperties(json, owner, res);
7515    return res;
7516  }
7517
7518  protected void parseDeviceComponentDeviceComponentPropertyComponentProperties(JsonObject json, DeviceComponent owner, DeviceComponent.DeviceComponentPropertyComponent res) throws IOException, FHIRFormatError {
7519    parseBackboneElementProperties(json, res);
7520    if (json.has("type"))
7521      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7522    if (json.has("valueQuantity")) {
7523      JsonArray array = json.getAsJsonArray("valueQuantity");
7524      for (int i = 0; i < array.size(); i++) {
7525        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
7526      }
7527    };
7528    if (json.has("valueCode")) {
7529      JsonArray array = json.getAsJsonArray("valueCode");
7530      for (int i = 0; i < array.size(); i++) {
7531        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7532      }
7533    };
7534  }
7535
7536  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
7537    DeviceMetric res = new DeviceMetric();
7538    parseDeviceMetricProperties(json, res);
7539    return res;
7540  }
7541
7542  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
7543    parseDomainResourceProperties(json, res);
7544    if (json.has("identifier")) {
7545      JsonArray array = json.getAsJsonArray("identifier");
7546      for (int i = 0; i < array.size(); i++) {
7547        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7548      }
7549    };
7550    if (json.has("type"))
7551      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7552    if (json.has("unit"))
7553      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
7554    if (json.has("source"))
7555      res.setSource(parseReference(json.getAsJsonObject("source")));
7556    if (json.has("parent"))
7557      res.setParent(parseReference(json.getAsJsonObject("parent")));
7558    if (json.has("operationalStatus"))
7559      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
7560    if (json.has("_operationalStatus"))
7561      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
7562    if (json.has("color"))
7563      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
7564    if (json.has("_color"))
7565      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
7566    if (json.has("category"))
7567      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
7568    if (json.has("_category"))
7569      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
7570    if (json.has("measurementPeriod"))
7571      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
7572    if (json.has("calibration")) {
7573      JsonArray array = json.getAsJsonArray("calibration");
7574      for (int i = 0; i < array.size(); i++) {
7575        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
7576      }
7577    };
7578  }
7579
7580  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
7581    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
7582    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
7583    return res;
7584  }
7585
7586  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
7587    parseBackboneElementProperties(json, res);
7588    if (json.has("type"))
7589      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
7590    if (json.has("_type"))
7591      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7592    if (json.has("state"))
7593      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
7594    if (json.has("_state"))
7595      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
7596    if (json.has("time"))
7597      res.setTimeElement(parseInstant(json.get("time").getAsString()));
7598    if (json.has("_time"))
7599      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
7600  }
7601
7602  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
7603    DeviceRequest res = new DeviceRequest();
7604    parseDeviceRequestProperties(json, res);
7605    return res;
7606  }
7607
7608  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
7609    parseDomainResourceProperties(json, res);
7610    if (json.has("identifier")) {
7611      JsonArray array = json.getAsJsonArray("identifier");
7612      for (int i = 0; i < array.size(); i++) {
7613        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7614      }
7615    };
7616    if (json.has("instantiates")) {
7617      JsonArray array = json.getAsJsonArray("instantiates");
7618      for (int i = 0; i < array.size(); i++) {
7619        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
7620      }
7621    };
7622    if (json.has("_instantiates")) {
7623      JsonArray array = json.getAsJsonArray("_instantiates");
7624      for (int i = 0; i < array.size(); i++) {
7625        if (i == res.getInstantiates().size())
7626          res.getInstantiates().add(parseUri(null));
7627        if (array.get(i) instanceof JsonObject) 
7628          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
7629      }
7630    };
7631    if (json.has("basedOn")) {
7632      JsonArray array = json.getAsJsonArray("basedOn");
7633      for (int i = 0; i < array.size(); i++) {
7634        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7635      }
7636    };
7637    if (json.has("priorRequest")) {
7638      JsonArray array = json.getAsJsonArray("priorRequest");
7639      for (int i = 0; i < array.size(); i++) {
7640        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
7641      }
7642    };
7643    if (json.has("groupIdentifier"))
7644      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
7645    if (json.has("status"))
7646      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
7647    if (json.has("_status"))
7648      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7649    if (json.has("intent"))
7650      res.setIntent(parseCodeableConcept(json.getAsJsonObject("intent")));
7651    if (json.has("priority"))
7652      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
7653    if (json.has("_priority"))
7654      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
7655    Type code = parseType("code", json);
7656    if (code != null)
7657      res.setCode(code);
7658    if (json.has("parameter")) {
7659      JsonArray array = json.getAsJsonArray("parameter");
7660      for (int i = 0; i < array.size(); i++) {
7661        res.getParameter().add(parseDeviceRequestDeviceRequestParameterComponent(array.get(i).getAsJsonObject(), res));
7662      }
7663    };
7664    if (json.has("subject"))
7665      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7666    if (json.has("context"))
7667      res.setContext(parseReference(json.getAsJsonObject("context")));
7668    Type occurrence = parseType("occurrence", json);
7669    if (occurrence != null)
7670      res.setOccurrence(occurrence);
7671    if (json.has("authoredOn"))
7672      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
7673    if (json.has("_authoredOn"))
7674      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
7675    if (json.has("requester"))
7676      res.setRequester(parseReference(json.getAsJsonObject("requester")));
7677    if (json.has("performerType"))
7678      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
7679    if (json.has("performer"))
7680      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
7681    if (json.has("reasonCode")) {
7682      JsonArray array = json.getAsJsonArray("reasonCode");
7683      for (int i = 0; i < array.size(); i++) {
7684        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7685      }
7686    };
7687    if (json.has("reasonReference")) {
7688      JsonArray array = json.getAsJsonArray("reasonReference");
7689      for (int i = 0; i < array.size(); i++) {
7690        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7691      }
7692    };
7693    if (json.has("insurance")) {
7694      JsonArray array = json.getAsJsonArray("insurance");
7695      for (int i = 0; i < array.size(); i++) {
7696        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
7697      }
7698    };
7699    if (json.has("supportingInfo")) {
7700      JsonArray array = json.getAsJsonArray("supportingInfo");
7701      for (int i = 0; i < array.size(); i++) {
7702        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7703      }
7704    };
7705    if (json.has("note")) {
7706      JsonArray array = json.getAsJsonArray("note");
7707      for (int i = 0; i < array.size(); i++) {
7708        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7709      }
7710    };
7711    if (json.has("relevantHistory")) {
7712      JsonArray array = json.getAsJsonArray("relevantHistory");
7713      for (int i = 0; i < array.size(); i++) {
7714        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
7715      }
7716    };
7717  }
7718
7719  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestDeviceRequestParameterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
7720    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
7721    parseDeviceRequestDeviceRequestParameterComponentProperties(json, owner, res);
7722    return res;
7723  }
7724
7725  protected void parseDeviceRequestDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
7726    parseBackboneElementProperties(json, res);
7727    if (json.has("code"))
7728      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7729    Type value = parseType("value", json);
7730    if (value != null)
7731      res.setValue(value);
7732  }
7733
7734  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
7735    DeviceUseStatement res = new DeviceUseStatement();
7736    parseDeviceUseStatementProperties(json, res);
7737    return res;
7738  }
7739
7740  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
7741    parseDomainResourceProperties(json, res);
7742    if (json.has("identifier")) {
7743      JsonArray array = json.getAsJsonArray("identifier");
7744      for (int i = 0; i < array.size(); i++) {
7745        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7746      }
7747    };
7748    if (json.has("basedOn")) {
7749      JsonArray array = json.getAsJsonArray("basedOn");
7750      for (int i = 0; i < array.size(); i++) {
7751        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7752      }
7753    };
7754    if (json.has("status"))
7755      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
7756    if (json.has("_status"))
7757      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7758    if (json.has("subject"))
7759      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7760    if (json.has("derivedFrom")) {
7761      JsonArray array = json.getAsJsonArray("derivedFrom");
7762      for (int i = 0; i < array.size(); i++) {
7763        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
7764      }
7765    };
7766    Type timing = parseType("timing", json);
7767    if (timing != null)
7768      res.setTiming(timing);
7769    if (json.has("recordedOn"))
7770      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
7771    if (json.has("_recordedOn"))
7772      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
7773    if (json.has("source"))
7774      res.setSource(parseReference(json.getAsJsonObject("source")));
7775    if (json.has("device"))
7776      res.setDevice(parseReference(json.getAsJsonObject("device")));
7777    if (json.has("reasonCode")) {
7778      JsonArray array = json.getAsJsonArray("reasonCode");
7779      for (int i = 0; i < array.size(); i++) {
7780        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7781      }
7782    };
7783    if (json.has("reasonReference")) {
7784      JsonArray array = json.getAsJsonArray("reasonReference");
7785      for (int i = 0; i < array.size(); i++) {
7786        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7787      }
7788    };
7789    if (json.has("bodySite"))
7790      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
7791    if (json.has("note")) {
7792      JsonArray array = json.getAsJsonArray("note");
7793      for (int i = 0; i < array.size(); i++) {
7794        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7795      }
7796    };
7797  }
7798
7799  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
7800    DiagnosticReport res = new DiagnosticReport();
7801    parseDiagnosticReportProperties(json, res);
7802    return res;
7803  }
7804
7805  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
7806    parseDomainResourceProperties(json, res);
7807    if (json.has("identifier")) {
7808      JsonArray array = json.getAsJsonArray("identifier");
7809      for (int i = 0; i < array.size(); i++) {
7810        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7811      }
7812    };
7813    if (json.has("basedOn")) {
7814      JsonArray array = json.getAsJsonArray("basedOn");
7815      for (int i = 0; i < array.size(); i++) {
7816        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7817      }
7818    };
7819    if (json.has("status"))
7820      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
7821    if (json.has("_status"))
7822      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7823    if (json.has("category"))
7824      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
7825    if (json.has("code"))
7826      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7827    if (json.has("subject"))
7828      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7829    if (json.has("context"))
7830      res.setContext(parseReference(json.getAsJsonObject("context")));
7831    Type effective = parseType("effective", json);
7832    if (effective != null)
7833      res.setEffective(effective);
7834    if (json.has("issued"))
7835      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
7836    if (json.has("_issued"))
7837      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7838    if (json.has("performer")) {
7839      JsonArray array = json.getAsJsonArray("performer");
7840      for (int i = 0; i < array.size(); i++) {
7841        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
7842      }
7843    };
7844    if (json.has("resultsInterpreter")) {
7845      JsonArray array = json.getAsJsonArray("resultsInterpreter");
7846      for (int i = 0; i < array.size(); i++) {
7847        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
7848      }
7849    };
7850    if (json.has("specimen")) {
7851      JsonArray array = json.getAsJsonArray("specimen");
7852      for (int i = 0; i < array.size(); i++) {
7853        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
7854      }
7855    };
7856    if (json.has("result")) {
7857      JsonArray array = json.getAsJsonArray("result");
7858      for (int i = 0; i < array.size(); i++) {
7859        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
7860      }
7861    };
7862    if (json.has("imagingStudy")) {
7863      JsonArray array = json.getAsJsonArray("imagingStudy");
7864      for (int i = 0; i < array.size(); i++) {
7865        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
7866      }
7867    };
7868    if (json.has("media")) {
7869      JsonArray array = json.getAsJsonArray("media");
7870      for (int i = 0; i < array.size(); i++) {
7871        res.getMedia().add(parseDiagnosticReportDiagnosticReportMediaComponent(array.get(i).getAsJsonObject(), res));
7872      }
7873    };
7874    if (json.has("conclusion"))
7875      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
7876    if (json.has("_conclusion"))
7877      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
7878    if (json.has("codedDiagnosis")) {
7879      JsonArray array = json.getAsJsonArray("codedDiagnosis");
7880      for (int i = 0; i < array.size(); i++) {
7881        res.getCodedDiagnosis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7882      }
7883    };
7884    if (json.has("presentedForm")) {
7885      JsonArray array = json.getAsJsonArray("presentedForm");
7886      for (int i = 0; i < array.size(); i++) {
7887        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
7888      }
7889    };
7890  }
7891
7892  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportDiagnosticReportMediaComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
7893    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
7894    parseDiagnosticReportDiagnosticReportMediaComponentProperties(json, owner, res);
7895    return res;
7896  }
7897
7898  protected void parseDiagnosticReportDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
7899    parseBackboneElementProperties(json, res);
7900    if (json.has("comment"))
7901      res.setCommentElement(parseString(json.get("comment").getAsString()));
7902    if (json.has("_comment"))
7903      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
7904    if (json.has("link"))
7905      res.setLink(parseReference(json.getAsJsonObject("link")));
7906  }
7907
7908  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
7909    DocumentManifest res = new DocumentManifest();
7910    parseDocumentManifestProperties(json, res);
7911    return res;
7912  }
7913
7914  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
7915    parseDomainResourceProperties(json, res);
7916    if (json.has("masterIdentifier"))
7917      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
7918    if (json.has("identifier")) {
7919      JsonArray array = json.getAsJsonArray("identifier");
7920      for (int i = 0; i < array.size(); i++) {
7921        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7922      }
7923    };
7924    if (json.has("status"))
7925      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
7926    if (json.has("_status"))
7927      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7928    if (json.has("type"))
7929      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7930    if (json.has("subject"))
7931      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7932    if (json.has("created"))
7933      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7934    if (json.has("_created"))
7935      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
7936    if (json.has("agent")) {
7937      JsonArray array = json.getAsJsonArray("agent");
7938      for (int i = 0; i < array.size(); i++) {
7939        res.getAgent().add(parseDocumentManifestDocumentManifestAgentComponent(array.get(i).getAsJsonObject(), res));
7940      }
7941    };
7942    if (json.has("recipient")) {
7943      JsonArray array = json.getAsJsonArray("recipient");
7944      for (int i = 0; i < array.size(); i++) {
7945        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7946      }
7947    };
7948    if (json.has("source"))
7949      res.setSourceElement(parseUri(json.get("source").getAsString()));
7950    if (json.has("_source"))
7951      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
7952    if (json.has("description"))
7953      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7954    if (json.has("_description"))
7955      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7956    if (json.has("content")) {
7957      JsonArray array = json.getAsJsonArray("content");
7958      for (int i = 0; i < array.size(); i++) {
7959        res.getContent().add(parseReference(array.get(i).getAsJsonObject()));
7960      }
7961    };
7962    if (json.has("related")) {
7963      JsonArray array = json.getAsJsonArray("related");
7964      for (int i = 0; i < array.size(); i++) {
7965        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
7966      }
7967    };
7968  }
7969
7970  protected DocumentManifest.DocumentManifestAgentComponent parseDocumentManifestDocumentManifestAgentComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
7971    DocumentManifest.DocumentManifestAgentComponent res = new DocumentManifest.DocumentManifestAgentComponent();
7972    parseDocumentManifestDocumentManifestAgentComponentProperties(json, owner, res);
7973    return res;
7974  }
7975
7976  protected void parseDocumentManifestDocumentManifestAgentComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestAgentComponent res) throws IOException, FHIRFormatError {
7977    parseBackboneElementProperties(json, res);
7978    if (json.has("type"))
7979      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7980    if (json.has("who"))
7981      res.setWho(parseReference(json.getAsJsonObject("who")));
7982  }
7983
7984  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
7985    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
7986    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
7987    return res;
7988  }
7989
7990  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
7991    parseBackboneElementProperties(json, res);
7992    if (json.has("identifier"))
7993      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7994    if (json.has("ref"))
7995      res.setRef(parseReference(json.getAsJsonObject("ref")));
7996  }
7997
7998  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
7999    DocumentReference res = new DocumentReference();
8000    parseDocumentReferenceProperties(json, res);
8001    return res;
8002  }
8003
8004  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
8005    parseDomainResourceProperties(json, res);
8006    if (json.has("masterIdentifier"))
8007      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
8008    if (json.has("identifier")) {
8009      JsonArray array = json.getAsJsonArray("identifier");
8010      for (int i = 0; i < array.size(); i++) {
8011        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8012      }
8013    };
8014    if (json.has("status"))
8015      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
8016    if (json.has("_status"))
8017      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8018    if (json.has("docStatus"))
8019      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
8020    if (json.has("_docStatus"))
8021      parseElementProperties(json.getAsJsonObject("_docStatus"), res.getDocStatusElement());
8022    if (json.has("type"))
8023      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8024    if (json.has("class"))
8025      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
8026    if (json.has("subject"))
8027      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8028    if (json.has("created"))
8029      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8030    if (json.has("_created"))
8031      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8032    if (json.has("date"))
8033      res.setDateElement(parseInstant(json.get("date").getAsString()));
8034    if (json.has("_date"))
8035      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8036    if (json.has("agent")) {
8037      JsonArray array = json.getAsJsonArray("agent");
8038      for (int i = 0; i < array.size(); i++) {
8039        res.getAgent().add(parseDocumentReferenceDocumentReferenceAgentComponent(array.get(i).getAsJsonObject(), res));
8040      }
8041    };
8042    if (json.has("authenticator"))
8043      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
8044    if (json.has("custodian"))
8045      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
8046    if (json.has("relatesTo")) {
8047      JsonArray array = json.getAsJsonArray("relatesTo");
8048      for (int i = 0; i < array.size(); i++) {
8049        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
8050      }
8051    };
8052    if (json.has("description"))
8053      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8054    if (json.has("_description"))
8055      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8056    if (json.has("securityLabel")) {
8057      JsonArray array = json.getAsJsonArray("securityLabel");
8058      for (int i = 0; i < array.size(); i++) {
8059        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8060      }
8061    };
8062    if (json.has("content")) {
8063      JsonArray array = json.getAsJsonArray("content");
8064      for (int i = 0; i < array.size(); i++) {
8065        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
8066      }
8067    };
8068    if (json.has("context"))
8069      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(json.getAsJsonObject("context"), res));
8070  }
8071
8072  protected DocumentReference.DocumentReferenceAgentComponent parseDocumentReferenceDocumentReferenceAgentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
8073    DocumentReference.DocumentReferenceAgentComponent res = new DocumentReference.DocumentReferenceAgentComponent();
8074    parseDocumentReferenceDocumentReferenceAgentComponentProperties(json, owner, res);
8075    return res;
8076  }
8077
8078  protected void parseDocumentReferenceDocumentReferenceAgentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceAgentComponent res) throws IOException, FHIRFormatError {
8079    parseBackboneElementProperties(json, res);
8080    if (json.has("type"))
8081      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8082    if (json.has("who"))
8083      res.setWho(parseReference(json.getAsJsonObject("who")));
8084  }
8085
8086  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
8087    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
8088    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
8089    return res;
8090  }
8091
8092  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
8093    parseBackboneElementProperties(json, res);
8094    if (json.has("code"))
8095      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
8096    if (json.has("_code"))
8097      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
8098    if (json.has("target"))
8099      res.setTarget(parseReference(json.getAsJsonObject("target")));
8100  }
8101
8102  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
8103    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
8104    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
8105    return res;
8106  }
8107
8108  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
8109    parseBackboneElementProperties(json, res);
8110    if (json.has("attachment"))
8111      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
8112    if (json.has("format"))
8113      res.setFormat(parseCoding(json.getAsJsonObject("format")));
8114  }
8115
8116  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
8117    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
8118    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
8119    return res;
8120  }
8121
8122  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
8123    parseBackboneElementProperties(json, res);
8124    if (json.has("encounter"))
8125      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
8126    if (json.has("event")) {
8127      JsonArray array = json.getAsJsonArray("event");
8128      for (int i = 0; i < array.size(); i++) {
8129        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8130      }
8131    };
8132    if (json.has("period"))
8133      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8134    if (json.has("facilityType"))
8135      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
8136    if (json.has("practiceSetting"))
8137      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
8138    if (json.has("sourcePatientInfo"))
8139      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
8140    if (json.has("related")) {
8141      JsonArray array = json.getAsJsonArray("related");
8142      for (int i = 0; i < array.size(); i++) {
8143        res.getRelated().add(parseDocumentReferenceDocumentReferenceContextRelatedComponent(array.get(i).getAsJsonObject(), owner));
8144      }
8145    };
8146  }
8147
8148  protected DocumentReference.DocumentReferenceContextRelatedComponent parseDocumentReferenceDocumentReferenceContextRelatedComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
8149    DocumentReference.DocumentReferenceContextRelatedComponent res = new DocumentReference.DocumentReferenceContextRelatedComponent();
8150    parseDocumentReferenceDocumentReferenceContextRelatedComponentProperties(json, owner, res);
8151    return res;
8152  }
8153
8154  protected void parseDocumentReferenceDocumentReferenceContextRelatedComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextRelatedComponent res) throws IOException, FHIRFormatError {
8155    parseBackboneElementProperties(json, res);
8156    if (json.has("identifier"))
8157      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
8158    if (json.has("ref"))
8159      res.setRef(parseReference(json.getAsJsonObject("ref")));
8160  }
8161
8162  protected EligibilityRequest parseEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
8163    EligibilityRequest res = new EligibilityRequest();
8164    parseEligibilityRequestProperties(json, res);
8165    return res;
8166  }
8167
8168  protected void parseEligibilityRequestProperties(JsonObject json, EligibilityRequest res) throws IOException, FHIRFormatError {
8169    parseDomainResourceProperties(json, res);
8170    if (json.has("identifier")) {
8171      JsonArray array = json.getAsJsonArray("identifier");
8172      for (int i = 0; i < array.size(); i++) {
8173        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8174      }
8175    };
8176    if (json.has("status"))
8177      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EligibilityRequest.EligibilityRequestStatus.NULL, new EligibilityRequest.EligibilityRequestStatusEnumFactory()));
8178    if (json.has("_status"))
8179      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8180    if (json.has("priority"))
8181      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
8182    if (json.has("patient"))
8183      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8184    Type serviced = parseType("serviced", json);
8185    if (serviced != null)
8186      res.setServiced(serviced);
8187    if (json.has("created"))
8188      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8189    if (json.has("_created"))
8190      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8191    if (json.has("enterer"))
8192      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
8193    if (json.has("provider"))
8194      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8195    if (json.has("insurer"))
8196      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8197    if (json.has("facility"))
8198      res.setFacility(parseReference(json.getAsJsonObject("facility")));
8199    if (json.has("coverage"))
8200      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8201    if (json.has("businessArrangement"))
8202      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
8203    if (json.has("_businessArrangement"))
8204      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
8205    if (json.has("benefitCategory"))
8206      res.setBenefitCategory(parseCodeableConcept(json.getAsJsonObject("benefitCategory")));
8207    if (json.has("benefitSubCategory"))
8208      res.setBenefitSubCategory(parseCodeableConcept(json.getAsJsonObject("benefitSubCategory")));
8209    if (json.has("authorization")) {
8210      JsonArray array = json.getAsJsonArray("authorization");
8211      for (int i = 0; i < array.size(); i++) {
8212        res.getAuthorization().add(parseEligibilityRequestAuthorizationComponent(array.get(i).getAsJsonObject(), res));
8213      }
8214    };
8215  }
8216
8217  protected EligibilityRequest.AuthorizationComponent parseEligibilityRequestAuthorizationComponent(JsonObject json, EligibilityRequest owner) throws IOException, FHIRFormatError {
8218    EligibilityRequest.AuthorizationComponent res = new EligibilityRequest.AuthorizationComponent();
8219    parseEligibilityRequestAuthorizationComponentProperties(json, owner, res);
8220    return res;
8221  }
8222
8223  protected void parseEligibilityRequestAuthorizationComponentProperties(JsonObject json, EligibilityRequest owner, EligibilityRequest.AuthorizationComponent res) throws IOException, FHIRFormatError {
8224    parseBackboneElementProperties(json, res);
8225    if (json.has("sequence"))
8226      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8227    if (json.has("_sequence"))
8228      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8229    if (json.has("service"))
8230      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
8231    if (json.has("modifier")) {
8232      JsonArray array = json.getAsJsonArray("modifier");
8233      for (int i = 0; i < array.size(); i++) {
8234        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8235      }
8236    };
8237    if (json.has("quantity"))
8238      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
8239    if (json.has("unitPrice"))
8240      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
8241    if (json.has("facility"))
8242      res.setFacility(parseReference(json.getAsJsonObject("facility")));
8243    if (json.has("diagnosis")) {
8244      JsonArray array = json.getAsJsonArray("diagnosis");
8245      for (int i = 0; i < array.size(); i++) {
8246        res.getDiagnosis().add(parseEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject(), owner));
8247      }
8248    };
8249  }
8250
8251  protected EligibilityRequest.DiagnosisComponent parseEligibilityRequestDiagnosisComponent(JsonObject json, EligibilityRequest owner) throws IOException, FHIRFormatError {
8252    EligibilityRequest.DiagnosisComponent res = new EligibilityRequest.DiagnosisComponent();
8253    parseEligibilityRequestDiagnosisComponentProperties(json, owner, res);
8254    return res;
8255  }
8256
8257  protected void parseEligibilityRequestDiagnosisComponentProperties(JsonObject json, EligibilityRequest owner, EligibilityRequest.DiagnosisComponent res) throws IOException, FHIRFormatError {
8258    parseBackboneElementProperties(json, res);
8259    Type diagnosis = parseType("diagnosis", json);
8260    if (diagnosis != null)
8261      res.setDiagnosis(diagnosis);
8262  }
8263
8264  protected EligibilityResponse parseEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
8265    EligibilityResponse res = new EligibilityResponse();
8266    parseEligibilityResponseProperties(json, res);
8267    return res;
8268  }
8269
8270  protected void parseEligibilityResponseProperties(JsonObject json, EligibilityResponse res) throws IOException, FHIRFormatError {
8271    parseDomainResourceProperties(json, res);
8272    if (json.has("identifier")) {
8273      JsonArray array = json.getAsJsonArray("identifier");
8274      for (int i = 0; i < array.size(); i++) {
8275        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8276      }
8277    };
8278    if (json.has("status"))
8279      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EligibilityResponse.EligibilityResponseStatus.NULL, new EligibilityResponse.EligibilityResponseStatusEnumFactory()));
8280    if (json.has("_status"))
8281      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8282    if (json.has("created"))
8283      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8284    if (json.has("_created"))
8285      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8286    if (json.has("requestProvider"))
8287      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
8288    if (json.has("request"))
8289      res.setRequest(parseReference(json.getAsJsonObject("request")));
8290    if (json.has("outcome"))
8291      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
8292    if (json.has("_outcome"))
8293      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
8294    if (json.has("disposition"))
8295      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8296    if (json.has("_disposition"))
8297      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8298    if (json.has("insurer"))
8299      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8300    if (json.has("inforce"))
8301      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
8302    if (json.has("_inforce"))
8303      parseElementProperties(json.getAsJsonObject("_inforce"), res.getInforceElement());
8304    if (json.has("insurance")) {
8305      JsonArray array = json.getAsJsonArray("insurance");
8306      for (int i = 0; i < array.size(); i++) {
8307        res.getInsurance().add(parseEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
8308      }
8309    };
8310    if (json.has("preAuthRef"))
8311      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
8312    if (json.has("_preAuthRef"))
8313      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
8314    if (json.has("authorization")) {
8315      JsonArray array = json.getAsJsonArray("authorization");
8316      for (int i = 0; i < array.size(); i++) {
8317        res.getAuthorization().add(parseEligibilityResponseAuthorizationComponent(array.get(i).getAsJsonObject(), res));
8318      }
8319    };
8320    if (json.has("form"))
8321      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
8322    if (json.has("error")) {
8323      JsonArray array = json.getAsJsonArray("error");
8324      for (int i = 0; i < array.size(); i++) {
8325        res.getError().add(parseEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
8326      }
8327    };
8328  }
8329
8330  protected EligibilityResponse.InsuranceComponent parseEligibilityResponseInsuranceComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8331    EligibilityResponse.InsuranceComponent res = new EligibilityResponse.InsuranceComponent();
8332    parseEligibilityResponseInsuranceComponentProperties(json, owner, res);
8333    return res;
8334  }
8335
8336  protected void parseEligibilityResponseInsuranceComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
8337    parseBackboneElementProperties(json, res);
8338    if (json.has("coverage"))
8339      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8340    if (json.has("contract"))
8341      res.setContract(parseReference(json.getAsJsonObject("contract")));
8342    if (json.has("benefitBalance")) {
8343      JsonArray array = json.getAsJsonArray("benefitBalance");
8344      for (int i = 0; i < array.size(); i++) {
8345        res.getBenefitBalance().add(parseEligibilityResponseBenefitsComponent(array.get(i).getAsJsonObject(), owner));
8346      }
8347    };
8348  }
8349
8350  protected EligibilityResponse.BenefitsComponent parseEligibilityResponseBenefitsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8351    EligibilityResponse.BenefitsComponent res = new EligibilityResponse.BenefitsComponent();
8352    parseEligibilityResponseBenefitsComponentProperties(json, owner, res);
8353    return res;
8354  }
8355
8356  protected void parseEligibilityResponseBenefitsComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.BenefitsComponent res) throws IOException, FHIRFormatError {
8357    parseBackboneElementProperties(json, res);
8358    if (json.has("category"))
8359      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8360    if (json.has("subCategory"))
8361      res.setSubCategory(parseCodeableConcept(json.getAsJsonObject("subCategory")));
8362    if (json.has("excluded"))
8363      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
8364    if (json.has("_excluded"))
8365      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
8366    if (json.has("name"))
8367      res.setNameElement(parseString(json.get("name").getAsString()));
8368    if (json.has("_name"))
8369      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8370    if (json.has("description"))
8371      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8372    if (json.has("_description"))
8373      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8374    if (json.has("network"))
8375      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
8376    if (json.has("unit"))
8377      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
8378    if (json.has("term"))
8379      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
8380    if (json.has("financial")) {
8381      JsonArray array = json.getAsJsonArray("financial");
8382      for (int i = 0; i < array.size(); i++) {
8383        res.getFinancial().add(parseEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
8384      }
8385    };
8386  }
8387
8388  protected EligibilityResponse.BenefitComponent parseEligibilityResponseBenefitComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8389    EligibilityResponse.BenefitComponent res = new EligibilityResponse.BenefitComponent();
8390    parseEligibilityResponseBenefitComponentProperties(json, owner, res);
8391    return res;
8392  }
8393
8394  protected void parseEligibilityResponseBenefitComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
8395    parseBackboneElementProperties(json, res);
8396    if (json.has("type"))
8397      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8398    Type allowed = parseType("allowed", json);
8399    if (allowed != null)
8400      res.setAllowed(allowed);
8401    Type used = parseType("used", json);
8402    if (used != null)
8403      res.setUsed(used);
8404  }
8405
8406  protected EligibilityResponse.AuthorizationComponent parseEligibilityResponseAuthorizationComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8407    EligibilityResponse.AuthorizationComponent res = new EligibilityResponse.AuthorizationComponent();
8408    parseEligibilityResponseAuthorizationComponentProperties(json, owner, res);
8409    return res;
8410  }
8411
8412  protected void parseEligibilityResponseAuthorizationComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.AuthorizationComponent res) throws IOException, FHIRFormatError {
8413    parseBackboneElementProperties(json, res);
8414    if (json.has("authorizationSequence"))
8415      res.setAuthorizationSequenceElement(parsePositiveInt(json.get("authorizationSequence").getAsString()));
8416    if (json.has("_authorizationSequence"))
8417      parseElementProperties(json.getAsJsonObject("_authorizationSequence"), res.getAuthorizationSequenceElement());
8418    if (json.has("required"))
8419      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
8420    if (json.has("_required"))
8421      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
8422    if (json.has("note")) {
8423      JsonArray array = json.getAsJsonArray("note");
8424      for (int i = 0; i < array.size(); i++) {
8425        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8426      }
8427    };
8428  }
8429
8430  protected EligibilityResponse.ErrorsComponent parseEligibilityResponseErrorsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8431    EligibilityResponse.ErrorsComponent res = new EligibilityResponse.ErrorsComponent();
8432    parseEligibilityResponseErrorsComponentProperties(json, owner, res);
8433    return res;
8434  }
8435
8436  protected void parseEligibilityResponseErrorsComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
8437    parseBackboneElementProperties(json, res);
8438    if (json.has("code"))
8439      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8440  }
8441
8442  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
8443    Encounter res = new Encounter();
8444    parseEncounterProperties(json, res);
8445    return res;
8446  }
8447
8448  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
8449    parseDomainResourceProperties(json, res);
8450    if (json.has("identifier")) {
8451      JsonArray array = json.getAsJsonArray("identifier");
8452      for (int i = 0; i < array.size(); i++) {
8453        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8454      }
8455    };
8456    if (json.has("status"))
8457      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
8458    if (json.has("_status"))
8459      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8460    if (json.has("statusHistory")) {
8461      JsonArray array = json.getAsJsonArray("statusHistory");
8462      for (int i = 0; i < array.size(); i++) {
8463        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
8464      }
8465    };
8466    if (json.has("class"))
8467      res.setClass_(parseCoding(json.getAsJsonObject("class")));
8468    if (json.has("classHistory")) {
8469      JsonArray array = json.getAsJsonArray("classHistory");
8470      for (int i = 0; i < array.size(); i++) {
8471        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
8472      }
8473    };
8474    if (json.has("type")) {
8475      JsonArray array = json.getAsJsonArray("type");
8476      for (int i = 0; i < array.size(); i++) {
8477        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8478      }
8479    };
8480    if (json.has("serviceType"))
8481      res.setServiceType(parseCodeableConcept(json.getAsJsonObject("serviceType")));
8482    if (json.has("priority"))
8483      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
8484    if (json.has("subject"))
8485      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8486    if (json.has("episodeOfCare")) {
8487      JsonArray array = json.getAsJsonArray("episodeOfCare");
8488      for (int i = 0; i < array.size(); i++) {
8489        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
8490      }
8491    };
8492    if (json.has("basedOn")) {
8493      JsonArray array = json.getAsJsonArray("basedOn");
8494      for (int i = 0; i < array.size(); i++) {
8495        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
8496      }
8497    };
8498    if (json.has("participant")) {
8499      JsonArray array = json.getAsJsonArray("participant");
8500      for (int i = 0; i < array.size(); i++) {
8501        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
8502      }
8503    };
8504    if (json.has("appointment"))
8505      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
8506    if (json.has("period"))
8507      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8508    if (json.has("length"))
8509      res.setLength(parseDuration(json.getAsJsonObject("length")));
8510    if (json.has("reason")) {
8511      JsonArray array = json.getAsJsonArray("reason");
8512      for (int i = 0; i < array.size(); i++) {
8513        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8514      }
8515    };
8516    if (json.has("diagnosis")) {
8517      JsonArray array = json.getAsJsonArray("diagnosis");
8518      for (int i = 0; i < array.size(); i++) {
8519        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8520      }
8521    };
8522    if (json.has("account")) {
8523      JsonArray array = json.getAsJsonArray("account");
8524      for (int i = 0; i < array.size(); i++) {
8525        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
8526      }
8527    };
8528    if (json.has("hospitalization"))
8529      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization"), res));
8530    if (json.has("location")) {
8531      JsonArray array = json.getAsJsonArray("location");
8532      for (int i = 0; i < array.size(); i++) {
8533        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
8534      }
8535    };
8536    if (json.has("serviceProvider"))
8537      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
8538    if (json.has("partOf"))
8539      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
8540  }
8541
8542  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8543    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
8544    parseEncounterStatusHistoryComponentProperties(json, owner, res);
8545    return res;
8546  }
8547
8548  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
8549    parseBackboneElementProperties(json, res);
8550    if (json.has("status"))
8551      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
8552    if (json.has("_status"))
8553      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8554    if (json.has("period"))
8555      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8556  }
8557
8558  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8559    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
8560    parseEncounterClassHistoryComponentProperties(json, owner, res);
8561    return res;
8562  }
8563
8564  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
8565    parseBackboneElementProperties(json, res);
8566    if (json.has("class"))
8567      res.setClass_(parseCoding(json.getAsJsonObject("class")));
8568    if (json.has("period"))
8569      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8570  }
8571
8572  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8573    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
8574    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
8575    return res;
8576  }
8577
8578  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
8579    parseBackboneElementProperties(json, res);
8580    if (json.has("type")) {
8581      JsonArray array = json.getAsJsonArray("type");
8582      for (int i = 0; i < array.size(); i++) {
8583        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8584      }
8585    };
8586    if (json.has("period"))
8587      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8588    if (json.has("individual"))
8589      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
8590  }
8591
8592  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8593    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
8594    parseEncounterDiagnosisComponentProperties(json, owner, res);
8595    return res;
8596  }
8597
8598  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
8599    parseBackboneElementProperties(json, res);
8600    if (json.has("condition"))
8601      res.setCondition(parseReference(json.getAsJsonObject("condition")));
8602    if (json.has("role"))
8603      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8604    if (json.has("rank"))
8605      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
8606    if (json.has("_rank"))
8607      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
8608  }
8609
8610  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8611    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
8612    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
8613    return res;
8614  }
8615
8616  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
8617    parseBackboneElementProperties(json, res);
8618    if (json.has("preAdmissionIdentifier"))
8619      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
8620    if (json.has("origin"))
8621      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
8622    if (json.has("admitSource"))
8623      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
8624    if (json.has("reAdmission"))
8625      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
8626    if (json.has("dietPreference")) {
8627      JsonArray array = json.getAsJsonArray("dietPreference");
8628      for (int i = 0; i < array.size(); i++) {
8629        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8630      }
8631    };
8632    if (json.has("specialCourtesy")) {
8633      JsonArray array = json.getAsJsonArray("specialCourtesy");
8634      for (int i = 0; i < array.size(); i++) {
8635        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8636      }
8637    };
8638    if (json.has("specialArrangement")) {
8639      JsonArray array = json.getAsJsonArray("specialArrangement");
8640      for (int i = 0; i < array.size(); i++) {
8641        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8642      }
8643    };
8644    if (json.has("destination"))
8645      res.setDestination(parseReference(json.getAsJsonObject("destination")));
8646    if (json.has("dischargeDisposition"))
8647      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
8648  }
8649
8650  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8651    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
8652    parseEncounterEncounterLocationComponentProperties(json, owner, res);
8653    return res;
8654  }
8655
8656  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
8657    parseBackboneElementProperties(json, res);
8658    if (json.has("location"))
8659      res.setLocation(parseReference(json.getAsJsonObject("location")));
8660    if (json.has("status"))
8661      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
8662    if (json.has("_status"))
8663      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8664    if (json.has("period"))
8665      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8666  }
8667
8668  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
8669    Endpoint res = new Endpoint();
8670    parseEndpointProperties(json, res);
8671    return res;
8672  }
8673
8674  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
8675    parseDomainResourceProperties(json, res);
8676    if (json.has("identifier")) {
8677      JsonArray array = json.getAsJsonArray("identifier");
8678      for (int i = 0; i < array.size(); i++) {
8679        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8680      }
8681    };
8682    if (json.has("status"))
8683      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
8684    if (json.has("_status"))
8685      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8686    if (json.has("connectionType"))
8687      res.setConnectionType(parseCoding(json.getAsJsonObject("connectionType")));
8688    if (json.has("name"))
8689      res.setNameElement(parseString(json.get("name").getAsString()));
8690    if (json.has("_name"))
8691      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8692    if (json.has("managingOrganization"))
8693      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8694    if (json.has("contact")) {
8695      JsonArray array = json.getAsJsonArray("contact");
8696      for (int i = 0; i < array.size(); i++) {
8697        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
8698      }
8699    };
8700    if (json.has("period"))
8701      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8702    if (json.has("payloadType")) {
8703      JsonArray array = json.getAsJsonArray("payloadType");
8704      for (int i = 0; i < array.size(); i++) {
8705        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8706      }
8707    };
8708    if (json.has("payloadMimeType")) {
8709      JsonArray array = json.getAsJsonArray("payloadMimeType");
8710      for (int i = 0; i < array.size(); i++) {
8711        res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
8712      }
8713    };
8714    if (json.has("_payloadMimeType")) {
8715      JsonArray array = json.getAsJsonArray("_payloadMimeType");
8716      for (int i = 0; i < array.size(); i++) {
8717        if (i == res.getPayloadMimeType().size())
8718          res.getPayloadMimeType().add(parseCode(null));
8719        if (array.get(i) instanceof JsonObject) 
8720          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
8721      }
8722    };
8723    if (json.has("address"))
8724      res.setAddressElement(parseUrl(json.get("address").getAsString()));
8725    if (json.has("_address"))
8726      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
8727    if (json.has("header")) {
8728      JsonArray array = json.getAsJsonArray("header");
8729      for (int i = 0; i < array.size(); i++) {
8730        res.getHeader().add(parseString(array.get(i).getAsString()));
8731      }
8732    };
8733    if (json.has("_header")) {
8734      JsonArray array = json.getAsJsonArray("_header");
8735      for (int i = 0; i < array.size(); i++) {
8736        if (i == res.getHeader().size())
8737          res.getHeader().add(parseString(null));
8738        if (array.get(i) instanceof JsonObject) 
8739          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
8740      }
8741    };
8742  }
8743
8744  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
8745    EnrollmentRequest res = new EnrollmentRequest();
8746    parseEnrollmentRequestProperties(json, res);
8747    return res;
8748  }
8749
8750  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
8751    parseDomainResourceProperties(json, res);
8752    if (json.has("identifier")) {
8753      JsonArray array = json.getAsJsonArray("identifier");
8754      for (int i = 0; i < array.size(); i++) {
8755        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8756      }
8757    };
8758    if (json.has("status"))
8759      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
8760    if (json.has("_status"))
8761      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8762    if (json.has("created"))
8763      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8764    if (json.has("_created"))
8765      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8766    if (json.has("insurer"))
8767      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8768    if (json.has("provider"))
8769      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8770    if (json.has("candidate"))
8771      res.setCandidate(parseReference(json.getAsJsonObject("candidate")));
8772    if (json.has("coverage"))
8773      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8774  }
8775
8776  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
8777    EnrollmentResponse res = new EnrollmentResponse();
8778    parseEnrollmentResponseProperties(json, res);
8779    return res;
8780  }
8781
8782  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
8783    parseDomainResourceProperties(json, res);
8784    if (json.has("identifier")) {
8785      JsonArray array = json.getAsJsonArray("identifier");
8786      for (int i = 0; i < array.size(); i++) {
8787        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8788      }
8789    };
8790    if (json.has("status"))
8791      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
8792    if (json.has("_status"))
8793      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8794    if (json.has("request"))
8795      res.setRequest(parseReference(json.getAsJsonObject("request")));
8796    if (json.has("outcome"))
8797      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
8798    if (json.has("_outcome"))
8799      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
8800    if (json.has("disposition"))
8801      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8802    if (json.has("_disposition"))
8803      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8804    if (json.has("created"))
8805      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8806    if (json.has("_created"))
8807      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8808    if (json.has("organization"))
8809      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8810    if (json.has("requestProvider"))
8811      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
8812  }
8813
8814  protected EntryDefinition parseEntryDefinition(JsonObject json) throws IOException, FHIRFormatError {
8815    EntryDefinition res = new EntryDefinition();
8816    parseEntryDefinitionProperties(json, res);
8817    return res;
8818  }
8819
8820  protected void parseEntryDefinitionProperties(JsonObject json, EntryDefinition res) throws IOException, FHIRFormatError {
8821    parseDomainResourceProperties(json, res);
8822    if (json.has("type"))
8823      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8824    if (json.has("purpose"))
8825      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
8826    if (json.has("referencedItem"))
8827      res.setReferencedItem(parseReference(json.getAsJsonObject("referencedItem")));
8828    if (json.has("identifier"))
8829      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
8830    if (json.has("additionalIdentifier")) {
8831      JsonArray array = json.getAsJsonArray("additionalIdentifier");
8832      for (int i = 0; i < array.size(); i++) {
8833        res.getAdditionalIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8834      }
8835    };
8836    if (json.has("classification")) {
8837      JsonArray array = json.getAsJsonArray("classification");
8838      for (int i = 0; i < array.size(); i++) {
8839        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8840      }
8841    };
8842    if (json.has("status"))
8843      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
8844    if (json.has("validityPeriod"))
8845      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
8846    if (json.has("lastUpdated"))
8847      res.setLastUpdatedElement(parseDateTime(json.get("lastUpdated").getAsString()));
8848    if (json.has("_lastUpdated"))
8849      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
8850    if (json.has("additionalCharacteristic")) {
8851      JsonArray array = json.getAsJsonArray("additionalCharacteristic");
8852      for (int i = 0; i < array.size(); i++) {
8853        res.getAdditionalCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8854      }
8855    };
8856    if (json.has("additionalClassification")) {
8857      JsonArray array = json.getAsJsonArray("additionalClassification");
8858      for (int i = 0; i < array.size(); i++) {
8859        res.getAdditionalClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8860      }
8861    };
8862    if (json.has("relatedEntry")) {
8863      JsonArray array = json.getAsJsonArray("relatedEntry");
8864      for (int i = 0; i < array.size(); i++) {
8865        res.getRelatedEntry().add(parseEntryDefinitionEntryDefinitionRelatedEntryComponent(array.get(i).getAsJsonObject(), res));
8866      }
8867    };
8868  }
8869
8870  protected EntryDefinition.EntryDefinitionRelatedEntryComponent parseEntryDefinitionEntryDefinitionRelatedEntryComponent(JsonObject json, EntryDefinition owner) throws IOException, FHIRFormatError {
8871    EntryDefinition.EntryDefinitionRelatedEntryComponent res = new EntryDefinition.EntryDefinitionRelatedEntryComponent();
8872    parseEntryDefinitionEntryDefinitionRelatedEntryComponentProperties(json, owner, res);
8873    return res;
8874  }
8875
8876  protected void parseEntryDefinitionEntryDefinitionRelatedEntryComponentProperties(JsonObject json, EntryDefinition owner, EntryDefinition.EntryDefinitionRelatedEntryComponent res) throws IOException, FHIRFormatError {
8877    parseBackboneElementProperties(json, res);
8878    if (json.has("relationtype"))
8879      res.setRelationtype(parseCodeableConcept(json.getAsJsonObject("relationtype")));
8880    if (json.has("item"))
8881      res.setItem(parseReference(json.getAsJsonObject("item")));
8882  }
8883
8884  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
8885    EpisodeOfCare res = new EpisodeOfCare();
8886    parseEpisodeOfCareProperties(json, res);
8887    return res;
8888  }
8889
8890  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
8891    parseDomainResourceProperties(json, res);
8892    if (json.has("identifier")) {
8893      JsonArray array = json.getAsJsonArray("identifier");
8894      for (int i = 0; i < array.size(); i++) {
8895        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8896      }
8897    };
8898    if (json.has("status"))
8899      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
8900    if (json.has("_status"))
8901      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8902    if (json.has("statusHistory")) {
8903      JsonArray array = json.getAsJsonArray("statusHistory");
8904      for (int i = 0; i < array.size(); i++) {
8905        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
8906      }
8907    };
8908    if (json.has("type")) {
8909      JsonArray array = json.getAsJsonArray("type");
8910      for (int i = 0; i < array.size(); i++) {
8911        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8912      }
8913    };
8914    if (json.has("diagnosis")) {
8915      JsonArray array = json.getAsJsonArray("diagnosis");
8916      for (int i = 0; i < array.size(); i++) {
8917        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8918      }
8919    };
8920    if (json.has("patient"))
8921      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8922    if (json.has("managingOrganization"))
8923      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8924    if (json.has("period"))
8925      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8926    if (json.has("referralRequest")) {
8927      JsonArray array = json.getAsJsonArray("referralRequest");
8928      for (int i = 0; i < array.size(); i++) {
8929        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
8930      }
8931    };
8932    if (json.has("careManager"))
8933      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
8934    if (json.has("team")) {
8935      JsonArray array = json.getAsJsonArray("team");
8936      for (int i = 0; i < array.size(); i++) {
8937        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
8938      }
8939    };
8940    if (json.has("account")) {
8941      JsonArray array = json.getAsJsonArray("account");
8942      for (int i = 0; i < array.size(); i++) {
8943        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
8944      }
8945    };
8946  }
8947
8948  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
8949    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
8950    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
8951    return res;
8952  }
8953
8954  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
8955    parseBackboneElementProperties(json, res);
8956    if (json.has("status"))
8957      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
8958    if (json.has("_status"))
8959      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8960    if (json.has("period"))
8961      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8962  }
8963
8964  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
8965    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
8966    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
8967    return res;
8968  }
8969
8970  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
8971    parseBackboneElementProperties(json, res);
8972    if (json.has("condition"))
8973      res.setCondition(parseReference(json.getAsJsonObject("condition")));
8974    if (json.has("role"))
8975      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8976    if (json.has("rank"))
8977      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
8978    if (json.has("_rank"))
8979      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
8980  }
8981
8982  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
8983    EventDefinition res = new EventDefinition();
8984    parseEventDefinitionProperties(json, res);
8985    return res;
8986  }
8987
8988  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res) throws IOException, FHIRFormatError {
8989    parseDomainResourceProperties(json, res);
8990    if (json.has("url"))
8991      res.setUrlElement(parseUri(json.get("url").getAsString()));
8992    if (json.has("_url"))
8993      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8994    if (json.has("identifier")) {
8995      JsonArray array = json.getAsJsonArray("identifier");
8996      for (int i = 0; i < array.size(); i++) {
8997        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8998      }
8999    };
9000    if (json.has("version"))
9001      res.setVersionElement(parseString(json.get("version").getAsString()));
9002    if (json.has("_version"))
9003      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9004    if (json.has("name"))
9005      res.setNameElement(parseString(json.get("name").getAsString()));
9006    if (json.has("_name"))
9007      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9008    if (json.has("title"))
9009      res.setTitleElement(parseString(json.get("title").getAsString()));
9010    if (json.has("_title"))
9011      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
9012    if (json.has("subtitle"))
9013      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
9014    if (json.has("_subtitle"))
9015      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
9016    if (json.has("status"))
9017      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9018    if (json.has("_status"))
9019      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9020    if (json.has("experimental"))
9021      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9022    if (json.has("_experimental"))
9023      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
9024    Type subject = parseType("subject", json);
9025    if (subject != null)
9026      res.setSubject(subject);
9027    if (json.has("date"))
9028      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9029    if (json.has("_date"))
9030      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9031    if (json.has("publisher"))
9032      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9033    if (json.has("_publisher"))
9034      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9035    if (json.has("contact")) {
9036      JsonArray array = json.getAsJsonArray("contact");
9037      for (int i = 0; i < array.size(); i++) {
9038        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9039      }
9040    };
9041    if (json.has("description"))
9042      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9043    if (json.has("_description"))
9044      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9045    if (json.has("useContext")) {
9046      JsonArray array = json.getAsJsonArray("useContext");
9047      for (int i = 0; i < array.size(); i++) {
9048        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
9049      }
9050    };
9051    if (json.has("jurisdiction")) {
9052      JsonArray array = json.getAsJsonArray("jurisdiction");
9053      for (int i = 0; i < array.size(); i++) {
9054        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9055      }
9056    };
9057    if (json.has("purpose"))
9058      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
9059    if (json.has("_purpose"))
9060      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
9061    if (json.has("usage"))
9062      res.setUsageElement(parseString(json.get("usage").getAsString()));
9063    if (json.has("_usage"))
9064      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
9065    if (json.has("copyright"))
9066      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
9067    if (json.has("_copyright"))
9068      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
9069    if (json.has("approvalDate"))
9070      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
9071    if (json.has("_approvalDate"))
9072      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
9073    if (json.has("lastReviewDate"))
9074      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
9075    if (json.has("_lastReviewDate"))
9076      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
9077    if (json.has("effectivePeriod"))
9078      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
9079    if (json.has("topic")) {
9080      JsonArray array = json.getAsJsonArray("topic");
9081      for (int i = 0; i < array.size(); i++) {
9082        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9083      }
9084    };
9085    if (json.has("contributor")) {
9086      JsonArray array = json.getAsJsonArray("contributor");
9087      for (int i = 0; i < array.size(); i++) {
9088        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
9089      }
9090    };
9091    if (json.has("relatedArtifact")) {
9092      JsonArray array = json.getAsJsonArray("relatedArtifact");
9093      for (int i = 0; i < array.size(); i++) {
9094        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
9095      }
9096    };
9097    if (json.has("trigger"))
9098      res.setTrigger(parseTriggerDefinition(json.getAsJsonObject("trigger")));
9099  }
9100
9101  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
9102    ExampleScenario res = new ExampleScenario();
9103    parseExampleScenarioProperties(json, res);
9104    return res;
9105  }
9106
9107  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res) throws IOException, FHIRFormatError {
9108    parseDomainResourceProperties(json, res);
9109    if (json.has("url"))
9110      res.setUrlElement(parseUri(json.get("url").getAsString()));
9111    if (json.has("_url"))
9112      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9113    if (json.has("identifier")) {
9114      JsonArray array = json.getAsJsonArray("identifier");
9115      for (int i = 0; i < array.size(); i++) {
9116        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9117      }
9118    };
9119    if (json.has("version"))
9120      res.setVersionElement(parseString(json.get("version").getAsString()));
9121    if (json.has("_version"))
9122      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9123    if (json.has("name"))
9124      res.setNameElement(parseString(json.get("name").getAsString()));
9125    if (json.has("_name"))
9126      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9127    if (json.has("status"))
9128      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9129    if (json.has("_status"))
9130      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9131    if (json.has("experimental"))
9132      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9133    if (json.has("_experimental"))
9134      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
9135    if (json.has("date"))
9136      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9137    if (json.has("_date"))
9138      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9139    if (json.has("publisher"))
9140      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9141    if (json.has("_publisher"))
9142      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9143    if (json.has("contact")) {
9144      JsonArray array = json.getAsJsonArray("contact");
9145      for (int i = 0; i < array.size(); i++) {
9146        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9147      }
9148    };
9149    if (json.has("useContext")) {
9150      JsonArray array = json.getAsJsonArray("useContext");
9151      for (int i = 0; i < array.size(); i++) {
9152        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
9153      }
9154    };
9155    if (json.has("jurisdiction")) {
9156      JsonArray array = json.getAsJsonArray("jurisdiction");
9157      for (int i = 0; i < array.size(); i++) {
9158        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9159      }
9160    };
9161    if (json.has("copyright"))
9162      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
9163    if (json.has("_copyright"))
9164      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
9165    if (json.has("purpose"))
9166      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
9167    if (json.has("_purpose"))
9168      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
9169    if (json.has("actor")) {
9170      JsonArray array = json.getAsJsonArray("actor");
9171      for (int i = 0; i < array.size(); i++) {
9172        res.getActor().add(parseExampleScenarioExampleScenarioActorComponent(array.get(i).getAsJsonObject(), res));
9173      }
9174    };
9175    if (json.has("instance")) {
9176      JsonArray array = json.getAsJsonArray("instance");
9177      for (int i = 0; i < array.size(); i++) {
9178        res.getInstance().add(parseExampleScenarioExampleScenarioInstanceComponent(array.get(i).getAsJsonObject(), res));
9179      }
9180    };
9181    if (json.has("process")) {
9182      JsonArray array = json.getAsJsonArray("process");
9183      for (int i = 0; i < array.size(); i++) {
9184        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), res));
9185      }
9186    };
9187    if (json.has("workflow")) {
9188      JsonArray array = json.getAsJsonArray("workflow");
9189      for (int i = 0; i < array.size(); i++) {
9190        res.getWorkflow().add(parseCanonical(array.get(i).getAsString()));
9191      }
9192    };
9193    if (json.has("_workflow")) {
9194      JsonArray array = json.getAsJsonArray("_workflow");
9195      for (int i = 0; i < array.size(); i++) {
9196        if (i == res.getWorkflow().size())
9197          res.getWorkflow().add(parseCanonical(null));
9198        if (array.get(i) instanceof JsonObject) 
9199          parseElementProperties(array.get(i).getAsJsonObject(), res.getWorkflow().get(i));
9200      }
9201    };
9202  }
9203
9204  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioExampleScenarioActorComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
9205    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
9206    parseExampleScenarioExampleScenarioActorComponentProperties(json, owner, res);
9207    return res;
9208  }
9209
9210  protected void parseExampleScenarioExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
9211    parseBackboneElementProperties(json, res);
9212    if (json.has("actorId"))
9213      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
9214    if (json.has("_actorId"))
9215      parseElementProperties(json.getAsJsonObject("_actorId"), res.getActorIdElement());
9216    if (json.has("type"))
9217      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ExampleScenario.ExampleScenarioActorType.NULL, new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
9218    if (json.has("_type"))
9219      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9220    if (json.has("name"))
9221      res.setNameElement(parseString(json.get("name").getAsString()));
9222    if (json.has("_name"))
9223      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9224    if (json.has("description"))
9225      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9226    if (json.has("_description"))
9227      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9228  }
9229
9230  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioExampleScenarioInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
9231    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
9232    parseExampleScenarioExampleScenarioInstanceComponentProperties(json, owner, res);
9233    return res;
9234  }
9235
9236  protected void parseExampleScenarioExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
9237    parseBackboneElementProperties(json, res);
9238    if (json.has("resourceId"))
9239      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
9240    if (json.has("_resourceId"))
9241      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
9242    if (json.has("resourceType"))
9243      res.setResourceTypeElement(parseEnumeration(json.get("resourceType").getAsString(), ExampleScenario.FHIRResourceType.NULL, new ExampleScenario.FHIRResourceTypeEnumFactory()));
9244    if (json.has("_resourceType"))
9245      parseElementProperties(json.getAsJsonObject("_resourceType"), res.getResourceTypeElement());
9246    if (json.has("name"))
9247      res.setNameElement(parseString(json.get("name").getAsString()));
9248    if (json.has("_name"))
9249      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9250    if (json.has("description"))
9251      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9252    if (json.has("_description"))
9253      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9254    if (json.has("version")) {
9255      JsonArray array = json.getAsJsonArray("version");
9256      for (int i = 0; i < array.size(); i++) {
9257        res.getVersion().add(parseExampleScenarioExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject(), owner));
9258      }
9259    };
9260    if (json.has("containedInstance")) {
9261      JsonArray array = json.getAsJsonArray("containedInstance");
9262      for (int i = 0; i < array.size(); i++) {
9263        res.getContainedInstance().add(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(array.get(i).getAsJsonObject(), owner));
9264      }
9265    };
9266  }
9267
9268  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioExampleScenarioInstanceVersionComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
9269    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
9270    parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(json, owner, res);
9271    return res;
9272  }
9273
9274  protected void parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceVersionComponent res) throws IOException, FHIRFormatError {
9275    parseBackboneElementProperties(json, res);
9276    if (json.has("versionId"))
9277      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
9278    if (json.has("_versionId"))
9279      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
9280    if (json.has("description"))
9281      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9282    if (json.has("_description"))
9283      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9284  }
9285
9286  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
9287    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
9288    parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(json, owner, res);
9289    return res;
9290  }
9291
9292  protected void parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res) throws IOException, FHIRFormatError {
9293    parseBackboneElementProperties(json, res);
9294    if (json.has("resourceId"))
9295      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
9296    if (json.has("_resourceId"))
9297      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
9298    if (json.has("versionId"))
9299      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
9300    if (json.has("_versionId"))
9301      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
9302  }
9303
9304  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioExampleScenarioProcessComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
9305    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
9306    parseExampleScenarioExampleScenarioProcessComponentProperties(json, owner, res);
9307    return res;
9308  }
9309
9310  protected void parseExampleScenarioExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
9311    parseBackboneElementProperties(json, res);
9312    if (json.has("title"))
9313      res.setTitleElement(parseString(json.get("title").getAsString()));
9314    if (json.has("_title"))
9315      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
9316    if (json.has("description"))
9317      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9318    if (json.has("_description"))
9319      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9320    if (json.has("preConditions"))
9321      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
9322    if (json.has("_preConditions"))
9323      parseElementProperties(json.getAsJsonObject("_preConditions"), res.getPreConditionsElement());
9324    if (json.has("postConditions"))
9325      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
9326    if (json.has("_postConditions"))
9327      parseElementProperties(json.getAsJsonObject("_postConditions"), res.getPostConditionsElement());
9328    if (json.has("step")) {
9329      JsonArray array = json.getAsJsonArray("step");
9330      for (int i = 0; i < array.size(); i++) {
9331        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
9332      }
9333    };
9334  }
9335
9336  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioExampleScenarioProcessStepComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
9337    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
9338    parseExampleScenarioExampleScenarioProcessStepComponentProperties(json, owner, res);
9339    return res;
9340  }
9341
9342  protected void parseExampleScenarioExampleScenarioProcessStepComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepComponent res) throws IOException, FHIRFormatError {
9343    parseBackboneElementProperties(json, res);
9344    if (json.has("process")) {
9345      JsonArray array = json.getAsJsonArray("process");
9346      for (int i = 0; i < array.size(); i++) {
9347        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), owner));
9348      }
9349    };
9350    if (json.has("pause"))
9351      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
9352    if (json.has("_pause"))
9353      parseElementProperties(json.getAsJsonObject("_pause"), res.getPauseElement());
9354    if (json.has("operation"))
9355      res.setOperation(parseExampleScenarioExampleScenarioProcessStepOperationComponent(json.getAsJsonObject("operation"), owner));
9356    if (json.has("alternative"))
9357      res.setAlternative(parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(json.getAsJsonObject("alternative"), owner));
9358  }
9359
9360  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioExampleScenarioProcessStepOperationComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
9361    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
9362    parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(json, owner, res);
9363    return res;
9364  }
9365
9366  protected void parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepOperationComponent res) throws IOException, FHIRFormatError {
9367    parseBackboneElementProperties(json, res);
9368    if (json.has("number"))
9369      res.setNumberElement(parseString(json.get("number").getAsString()));
9370    if (json.has("_number"))
9371      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
9372    if (json.has("type"))
9373      res.setTypeElement(parseString(json.get("type").getAsString()));
9374    if (json.has("_type"))
9375      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9376    if (json.has("name"))
9377      res.setNameElement(parseString(json.get("name").getAsString()));
9378    if (json.has("_name"))
9379      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9380    if (json.has("initiator"))
9381      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
9382    if (json.has("_initiator"))
9383      parseElementProperties(json.getAsJsonObject("_initiator"), res.getInitiatorElement());
9384    if (json.has("receiver"))
9385      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
9386    if (json.has("_receiver"))
9387      parseElementProperties(json.getAsJsonObject("_receiver"), res.getReceiverElement());
9388    if (json.has("description"))
9389      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9390    if (json.has("_description"))
9391      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9392    if (json.has("initiatorActive"))
9393      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
9394    if (json.has("_initiatorActive"))
9395      parseElementProperties(json.getAsJsonObject("_initiatorActive"), res.getInitiatorActiveElement());
9396    if (json.has("receiverActive"))
9397      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
9398    if (json.has("_receiverActive"))
9399      parseElementProperties(json.getAsJsonObject("_receiverActive"), res.getReceiverActiveElement());
9400    if (json.has("request"))
9401      res.setRequest(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("request"), owner));
9402    if (json.has("response"))
9403      res.setResponse(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("response"), owner));
9404  }
9405
9406  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
9407    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
9408    parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(json, owner, res);
9409    return res;
9410  }
9411
9412  protected void parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res) throws IOException, FHIRFormatError {
9413    parseBackboneElementProperties(json, res);
9414    if (json.has("name"))
9415      res.setNameElement(parseString(json.get("name").getAsString()));
9416    if (json.has("_name"))
9417      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9418    if (json.has("option")) {
9419      JsonArray array = json.getAsJsonArray("option");
9420      for (int i = 0; i < array.size(); i++) {
9421        res.getOption().add(parseExampleScenarioExampleScenarioProcessStepAlternativeOptionComponent(array.get(i).getAsJsonObject(), owner));
9422      }
9423    };
9424  }
9425
9426  protected ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent parseExampleScenarioExampleScenarioProcessStepAlternativeOptionComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
9427    ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent();
9428    parseExampleScenarioExampleScenarioProcessStepAlternativeOptionComponentProperties(json, owner, res);
9429    return res;
9430  }
9431
9432  protected void parseExampleScenarioExampleScenarioProcessStepAlternativeOptionComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent res) throws IOException, FHIRFormatError {
9433    parseBackboneElementProperties(json, res);
9434    if (json.has("description"))
9435      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9436    if (json.has("_description"))
9437      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9438    if (json.has("step")) {
9439      JsonArray array = json.getAsJsonArray("step");
9440      for (int i = 0; i < array.size(); i++) {
9441        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
9442      }
9443    };
9444    if (json.has("pause")) {
9445      JsonArray array = json.getAsJsonArray("pause");
9446      for (int i = 0; i < array.size(); i++) {
9447        res.getPause().add(parseBoolean(array.get(i).getAsBoolean()));
9448      }
9449    };
9450    if (json.has("_pause")) {
9451      JsonArray array = json.getAsJsonArray("_pause");
9452      for (int i = 0; i < array.size(); i++) {
9453        if (i == res.getPause().size())
9454          res.getPause().add(parseBoolean(null));
9455        if (array.get(i) instanceof JsonObject) 
9456          parseElementProperties(array.get(i).getAsJsonObject(), res.getPause().get(i));
9457      }
9458    };
9459  }
9460
9461  protected ExpansionProfile parseExpansionProfile(JsonObject json) throws IOException, FHIRFormatError {
9462    ExpansionProfile res = new ExpansionProfile();
9463    parseExpansionProfileProperties(json, res);
9464    return res;
9465  }
9466
9467  protected void parseExpansionProfileProperties(JsonObject json, ExpansionProfile res) throws IOException, FHIRFormatError {
9468    parseDomainResourceProperties(json, res);
9469    if (json.has("url"))
9470      res.setUrlElement(parseUri(json.get("url").getAsString()));
9471    if (json.has("_url"))
9472      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9473    if (json.has("identifier"))
9474      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9475    if (json.has("version"))
9476      res.setVersionElement(parseString(json.get("version").getAsString()));
9477    if (json.has("_version"))
9478      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9479    if (json.has("name"))
9480      res.setNameElement(parseString(json.get("name").getAsString()));
9481    if (json.has("_name"))
9482      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9483    if (json.has("status"))
9484      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9485    if (json.has("_status"))
9486      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9487    if (json.has("experimental"))
9488      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9489    if (json.has("_experimental"))
9490      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
9491    if (json.has("date"))
9492      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9493    if (json.has("_date"))
9494      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9495    if (json.has("publisher"))
9496      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9497    if (json.has("_publisher"))
9498      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9499    if (json.has("contact")) {
9500      JsonArray array = json.getAsJsonArray("contact");
9501      for (int i = 0; i < array.size(); i++) {
9502        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9503      }
9504    };
9505    if (json.has("description"))
9506      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9507    if (json.has("_description"))
9508      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9509    if (json.has("useContext")) {
9510      JsonArray array = json.getAsJsonArray("useContext");
9511      for (int i = 0; i < array.size(); i++) {
9512        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
9513      }
9514    };
9515    if (json.has("jurisdiction")) {
9516      JsonArray array = json.getAsJsonArray("jurisdiction");
9517      for (int i = 0; i < array.size(); i++) {
9518        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9519      }
9520    };
9521    if (json.has("fixedVersion")) {
9522      JsonArray array = json.getAsJsonArray("fixedVersion");
9523      for (int i = 0; i < array.size(); i++) {
9524        res.getFixedVersion().add(parseExpansionProfileExpansionProfileFixedVersionComponent(array.get(i).getAsJsonObject(), res));
9525      }
9526    };
9527    if (json.has("excludedSystem"))
9528      res.setExcludedSystem(parseExpansionProfileExpansionProfileExcludedSystemComponent(json.getAsJsonObject("excludedSystem"), res));
9529    if (json.has("includeDesignations"))
9530      res.setIncludeDesignationsElement(parseBoolean(json.get("includeDesignations").getAsBoolean()));
9531    if (json.has("_includeDesignations"))
9532      parseElementProperties(json.getAsJsonObject("_includeDesignations"), res.getIncludeDesignationsElement());
9533    if (json.has("designation"))
9534      res.setDesignation(parseExpansionProfileExpansionProfileDesignationComponent(json.getAsJsonObject("designation"), res));
9535    if (json.has("includeDefinition"))
9536      res.setIncludeDefinitionElement(parseBoolean(json.get("includeDefinition").getAsBoolean()));
9537    if (json.has("_includeDefinition"))
9538      parseElementProperties(json.getAsJsonObject("_includeDefinition"), res.getIncludeDefinitionElement());
9539    if (json.has("activeOnly"))
9540      res.setActiveOnlyElement(parseBoolean(json.get("activeOnly").getAsBoolean()));
9541    if (json.has("_activeOnly"))
9542      parseElementProperties(json.getAsJsonObject("_activeOnly"), res.getActiveOnlyElement());
9543    if (json.has("excludeNested"))
9544      res.setExcludeNestedElement(parseBoolean(json.get("excludeNested").getAsBoolean()));
9545    if (json.has("_excludeNested"))
9546      parseElementProperties(json.getAsJsonObject("_excludeNested"), res.getExcludeNestedElement());
9547    if (json.has("excludeNotForUI"))
9548      res.setExcludeNotForUIElement(parseBoolean(json.get("excludeNotForUI").getAsBoolean()));
9549    if (json.has("_excludeNotForUI"))
9550      parseElementProperties(json.getAsJsonObject("_excludeNotForUI"), res.getExcludeNotForUIElement());
9551    if (json.has("excludePostCoordinated"))
9552      res.setExcludePostCoordinatedElement(parseBoolean(json.get("excludePostCoordinated").getAsBoolean()));
9553    if (json.has("_excludePostCoordinated"))
9554      parseElementProperties(json.getAsJsonObject("_excludePostCoordinated"), res.getExcludePostCoordinatedElement());
9555    if (json.has("displayLanguage"))
9556      res.setDisplayLanguageElement(parseCode(json.get("displayLanguage").getAsString()));
9557    if (json.has("_displayLanguage"))
9558      parseElementProperties(json.getAsJsonObject("_displayLanguage"), res.getDisplayLanguageElement());
9559    if (json.has("limitedExpansion"))
9560      res.setLimitedExpansionElement(parseBoolean(json.get("limitedExpansion").getAsBoolean()));
9561    if (json.has("_limitedExpansion"))
9562      parseElementProperties(json.getAsJsonObject("_limitedExpansion"), res.getLimitedExpansionElement());
9563  }
9564
9565  protected ExpansionProfile.ExpansionProfileFixedVersionComponent parseExpansionProfileExpansionProfileFixedVersionComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
9566    ExpansionProfile.ExpansionProfileFixedVersionComponent res = new ExpansionProfile.ExpansionProfileFixedVersionComponent();
9567    parseExpansionProfileExpansionProfileFixedVersionComponentProperties(json, owner, res);
9568    return res;
9569  }
9570
9571  protected void parseExpansionProfileExpansionProfileFixedVersionComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileFixedVersionComponent res) throws IOException, FHIRFormatError {
9572    parseBackboneElementProperties(json, res);
9573    if (json.has("system"))
9574      res.setSystemElement(parseUri(json.get("system").getAsString()));
9575    if (json.has("_system"))
9576      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
9577    if (json.has("version"))
9578      res.setVersionElement(parseString(json.get("version").getAsString()));
9579    if (json.has("_version"))
9580      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9581    if (json.has("mode"))
9582      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ExpansionProfile.SystemVersionProcessingMode.NULL, new ExpansionProfile.SystemVersionProcessingModeEnumFactory()));
9583    if (json.has("_mode"))
9584      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
9585  }
9586
9587  protected ExpansionProfile.ExpansionProfileExcludedSystemComponent parseExpansionProfileExpansionProfileExcludedSystemComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
9588    ExpansionProfile.ExpansionProfileExcludedSystemComponent res = new ExpansionProfile.ExpansionProfileExcludedSystemComponent();
9589    parseExpansionProfileExpansionProfileExcludedSystemComponentProperties(json, owner, res);
9590    return res;
9591  }
9592
9593  protected void parseExpansionProfileExpansionProfileExcludedSystemComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileExcludedSystemComponent res) throws IOException, FHIRFormatError {
9594    parseBackboneElementProperties(json, res);
9595    if (json.has("system"))
9596      res.setSystemElement(parseUri(json.get("system").getAsString()));
9597    if (json.has("_system"))
9598      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
9599    if (json.has("version"))
9600      res.setVersionElement(parseString(json.get("version").getAsString()));
9601    if (json.has("_version"))
9602      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9603  }
9604
9605  protected ExpansionProfile.ExpansionProfileDesignationComponent parseExpansionProfileExpansionProfileDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
9606    ExpansionProfile.ExpansionProfileDesignationComponent res = new ExpansionProfile.ExpansionProfileDesignationComponent();
9607    parseExpansionProfileExpansionProfileDesignationComponentProperties(json, owner, res);
9608    return res;
9609  }
9610
9611  protected void parseExpansionProfileExpansionProfileDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileDesignationComponent res) throws IOException, FHIRFormatError {
9612    parseBackboneElementProperties(json, res);
9613    if (json.has("include"))
9614      res.setInclude(parseExpansionProfileDesignationIncludeComponent(json.getAsJsonObject("include"), owner));
9615    if (json.has("exclude"))
9616      res.setExclude(parseExpansionProfileDesignationExcludeComponent(json.getAsJsonObject("exclude"), owner));
9617  }
9618
9619  protected ExpansionProfile.DesignationIncludeComponent parseExpansionProfileDesignationIncludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
9620    ExpansionProfile.DesignationIncludeComponent res = new ExpansionProfile.DesignationIncludeComponent();
9621    parseExpansionProfileDesignationIncludeComponentProperties(json, owner, res);
9622    return res;
9623  }
9624
9625  protected void parseExpansionProfileDesignationIncludeComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationIncludeComponent res) throws IOException, FHIRFormatError {
9626    parseBackboneElementProperties(json, res);
9627    if (json.has("designation")) {
9628      JsonArray array = json.getAsJsonArray("designation");
9629      for (int i = 0; i < array.size(); i++) {
9630        res.getDesignation().add(parseExpansionProfileDesignationIncludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
9631      }
9632    };
9633  }
9634
9635  protected ExpansionProfile.DesignationIncludeDesignationComponent parseExpansionProfileDesignationIncludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
9636    ExpansionProfile.DesignationIncludeDesignationComponent res = new ExpansionProfile.DesignationIncludeDesignationComponent();
9637    parseExpansionProfileDesignationIncludeDesignationComponentProperties(json, owner, res);
9638    return res;
9639  }
9640
9641  protected void parseExpansionProfileDesignationIncludeDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationIncludeDesignationComponent res) throws IOException, FHIRFormatError {
9642    parseBackboneElementProperties(json, res);
9643    if (json.has("language"))
9644      res.setLanguageElement(parseCode(json.get("language").getAsString()));
9645    if (json.has("_language"))
9646      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
9647    if (json.has("use"))
9648      res.setUse(parseCoding(json.getAsJsonObject("use")));
9649  }
9650
9651  protected ExpansionProfile.DesignationExcludeComponent parseExpansionProfileDesignationExcludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
9652    ExpansionProfile.DesignationExcludeComponent res = new ExpansionProfile.DesignationExcludeComponent();
9653    parseExpansionProfileDesignationExcludeComponentProperties(json, owner, res);
9654    return res;
9655  }
9656
9657  protected void parseExpansionProfileDesignationExcludeComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationExcludeComponent res) throws IOException, FHIRFormatError {
9658    parseBackboneElementProperties(json, res);
9659    if (json.has("designation")) {
9660      JsonArray array = json.getAsJsonArray("designation");
9661      for (int i = 0; i < array.size(); i++) {
9662        res.getDesignation().add(parseExpansionProfileDesignationExcludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
9663      }
9664    };
9665  }
9666
9667  protected ExpansionProfile.DesignationExcludeDesignationComponent parseExpansionProfileDesignationExcludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
9668    ExpansionProfile.DesignationExcludeDesignationComponent res = new ExpansionProfile.DesignationExcludeDesignationComponent();
9669    parseExpansionProfileDesignationExcludeDesignationComponentProperties(json, owner, res);
9670    return res;
9671  }
9672
9673  protected void parseExpansionProfileDesignationExcludeDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationExcludeDesignationComponent res) throws IOException, FHIRFormatError {
9674    parseBackboneElementProperties(json, res);
9675    if (json.has("language"))
9676      res.setLanguageElement(parseCode(json.get("language").getAsString()));
9677    if (json.has("_language"))
9678      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
9679    if (json.has("use"))
9680      res.setUse(parseCoding(json.getAsJsonObject("use")));
9681  }
9682
9683  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
9684    ExplanationOfBenefit res = new ExplanationOfBenefit();
9685    parseExplanationOfBenefitProperties(json, res);
9686    return res;
9687  }
9688
9689  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
9690    parseDomainResourceProperties(json, res);
9691    if (json.has("identifier")) {
9692      JsonArray array = json.getAsJsonArray("identifier");
9693      for (int i = 0; i < array.size(); i++) {
9694        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9695      }
9696    };
9697    if (json.has("status"))
9698      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
9699    if (json.has("_status"))
9700      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9701    if (json.has("type"))
9702      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9703    if (json.has("subType")) {
9704      JsonArray array = json.getAsJsonArray("subType");
9705      for (int i = 0; i < array.size(); i++) {
9706        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9707      }
9708    };
9709    if (json.has("use"))
9710      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ExplanationOfBenefit.Use.NULL, new ExplanationOfBenefit.UseEnumFactory()));
9711    if (json.has("_use"))
9712      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
9713    if (json.has("patient"))
9714      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9715    if (json.has("billablePeriod"))
9716      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
9717    if (json.has("created"))
9718      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9719    if (json.has("_created"))
9720      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
9721    if (json.has("enterer"))
9722      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
9723    if (json.has("insurer"))
9724      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
9725    if (json.has("provider"))
9726      res.setProvider(parseReference(json.getAsJsonObject("provider")));
9727    if (json.has("referral"))
9728      res.setReferral(parseReference(json.getAsJsonObject("referral")));
9729    if (json.has("facility"))
9730      res.setFacility(parseReference(json.getAsJsonObject("facility")));
9731    if (json.has("claim"))
9732      res.setClaim(parseReference(json.getAsJsonObject("claim")));
9733    if (json.has("claimResponse"))
9734      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
9735    if (json.has("outcome"))
9736      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ExplanationOfBenefit.RemittanceOutcome.NULL, new ExplanationOfBenefit.RemittanceOutcomeEnumFactory()));
9737    if (json.has("_outcome"))
9738      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
9739    if (json.has("disposition"))
9740      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
9741    if (json.has("_disposition"))
9742      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
9743    if (json.has("related")) {
9744      JsonArray array = json.getAsJsonArray("related");
9745      for (int i = 0; i < array.size(); i++) {
9746        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
9747      }
9748    };
9749    if (json.has("prescription"))
9750      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
9751    if (json.has("originalPrescription"))
9752      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
9753    if (json.has("payee"))
9754      res.setPayee(parseExplanationOfBenefitPayeeComponent(json.getAsJsonObject("payee"), res));
9755    if (json.has("information")) {
9756      JsonArray array = json.getAsJsonArray("information");
9757      for (int i = 0; i < array.size(); i++) {
9758        res.getInformation().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
9759      }
9760    };
9761    if (json.has("careTeam")) {
9762      JsonArray array = json.getAsJsonArray("careTeam");
9763      for (int i = 0; i < array.size(); i++) {
9764        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
9765      }
9766    };
9767    if (json.has("diagnosis")) {
9768      JsonArray array = json.getAsJsonArray("diagnosis");
9769      for (int i = 0; i < array.size(); i++) {
9770        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
9771      }
9772    };
9773    if (json.has("procedure")) {
9774      JsonArray array = json.getAsJsonArray("procedure");
9775      for (int i = 0; i < array.size(); i++) {
9776        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
9777      }
9778    };
9779    if (json.has("precedence"))
9780      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
9781    if (json.has("_precedence"))
9782      parseElementProperties(json.getAsJsonObject("_precedence"), res.getPrecedenceElement());
9783    if (json.has("insurance"))
9784      res.setInsurance(parseExplanationOfBenefitInsuranceComponent(json.getAsJsonObject("insurance"), res));
9785    if (json.has("accident"))
9786      res.setAccident(parseExplanationOfBenefitAccidentComponent(json.getAsJsonObject("accident"), res));
9787    if (json.has("item")) {
9788      JsonArray array = json.getAsJsonArray("item");
9789      for (int i = 0; i < array.size(); i++) {
9790        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
9791      }
9792    };
9793    if (json.has("addItem")) {
9794      JsonArray array = json.getAsJsonArray("addItem");
9795      for (int i = 0; i < array.size(); i++) {
9796        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
9797      }
9798    };
9799    if (json.has("total")) {
9800      JsonArray array = json.getAsJsonArray("total");
9801      for (int i = 0; i < array.size(); i++) {
9802        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject(), res));
9803      }
9804    };
9805    if (json.has("payment"))
9806      res.setPayment(parseExplanationOfBenefitPaymentComponent(json.getAsJsonObject("payment"), res));
9807    if (json.has("form"))
9808      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
9809    if (json.has("processNote")) {
9810      JsonArray array = json.getAsJsonArray("processNote");
9811      for (int i = 0; i < array.size(); i++) {
9812        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
9813      }
9814    };
9815    if (json.has("benefitBalance")) {
9816      JsonArray array = json.getAsJsonArray("benefitBalance");
9817      for (int i = 0; i < array.size(); i++) {
9818        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
9819      }
9820    };
9821  }
9822
9823  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9824    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
9825    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
9826    return res;
9827  }
9828
9829  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
9830    parseBackboneElementProperties(json, res);
9831    if (json.has("claim"))
9832      res.setClaim(parseReference(json.getAsJsonObject("claim")));
9833    if (json.has("relationship"))
9834      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
9835    if (json.has("reference"))
9836      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
9837  }
9838
9839  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9840    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
9841    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
9842    return res;
9843  }
9844
9845  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
9846    parseBackboneElementProperties(json, res);
9847    if (json.has("type"))
9848      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9849    if (json.has("resource"))
9850      res.setResource(parseCoding(json.getAsJsonObject("resource")));
9851    if (json.has("party"))
9852      res.setParty(parseReference(json.getAsJsonObject("party")));
9853  }
9854
9855  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9856    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
9857    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
9858    return res;
9859  }
9860
9861  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
9862    parseBackboneElementProperties(json, res);
9863    if (json.has("sequence"))
9864      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9865    if (json.has("_sequence"))
9866      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9867    if (json.has("category"))
9868      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9869    if (json.has("code"))
9870      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9871    Type timing = parseType("timing", json);
9872    if (timing != null)
9873      res.setTiming(timing);
9874    Type value = parseType("value", json);
9875    if (value != null)
9876      res.setValue(value);
9877    if (json.has("reason"))
9878      res.setReason(parseCoding(json.getAsJsonObject("reason")));
9879  }
9880
9881  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9882    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
9883    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
9884    return res;
9885  }
9886
9887  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
9888    parseBackboneElementProperties(json, res);
9889    if (json.has("sequence"))
9890      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9891    if (json.has("_sequence"))
9892      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9893    if (json.has("provider"))
9894      res.setProvider(parseReference(json.getAsJsonObject("provider")));
9895    if (json.has("responsible"))
9896      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
9897    if (json.has("_responsible"))
9898      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
9899    if (json.has("role"))
9900      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
9901    if (json.has("qualification"))
9902      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
9903  }
9904
9905  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9906    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
9907    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
9908    return res;
9909  }
9910
9911  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
9912    parseBackboneElementProperties(json, res);
9913    if (json.has("sequence"))
9914      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9915    if (json.has("_sequence"))
9916      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9917    Type diagnosis = parseType("diagnosis", json);
9918    if (diagnosis != null)
9919      res.setDiagnosis(diagnosis);
9920    if (json.has("type")) {
9921      JsonArray array = json.getAsJsonArray("type");
9922      for (int i = 0; i < array.size(); i++) {
9923        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9924      }
9925    };
9926    if (json.has("packageCode"))
9927      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
9928  }
9929
9930  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9931    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
9932    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
9933    return res;
9934  }
9935
9936  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
9937    parseBackboneElementProperties(json, res);
9938    if (json.has("sequence"))
9939      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9940    if (json.has("_sequence"))
9941      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9942    if (json.has("date"))
9943      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9944    if (json.has("_date"))
9945      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9946    Type procedure = parseType("procedure", json);
9947    if (procedure != null)
9948      res.setProcedure(procedure);
9949  }
9950
9951  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9952    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
9953    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
9954    return res;
9955  }
9956
9957  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
9958    parseBackboneElementProperties(json, res);
9959    if (json.has("coverage"))
9960      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
9961    if (json.has("preAuthRef")) {
9962      JsonArray array = json.getAsJsonArray("preAuthRef");
9963      for (int i = 0; i < array.size(); i++) {
9964        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
9965      }
9966    };
9967    if (json.has("_preAuthRef")) {
9968      JsonArray array = json.getAsJsonArray("_preAuthRef");
9969      for (int i = 0; i < array.size(); i++) {
9970        if (i == res.getPreAuthRef().size())
9971          res.getPreAuthRef().add(parseString(null));
9972        if (array.get(i) instanceof JsonObject) 
9973          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
9974      }
9975    };
9976  }
9977
9978  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9979    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
9980    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
9981    return res;
9982  }
9983
9984  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
9985    parseBackboneElementProperties(json, res);
9986    if (json.has("date"))
9987      res.setDateElement(parseDate(json.get("date").getAsString()));
9988    if (json.has("_date"))
9989      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9990    if (json.has("type"))
9991      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9992    Type location = parseType("location", json);
9993    if (location != null)
9994      res.setLocation(location);
9995  }
9996
9997  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9998    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
9999    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
10000    return res;
10001  }
10002
10003  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
10004    parseBackboneElementProperties(json, res);
10005    if (json.has("sequence"))
10006      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
10007    if (json.has("_sequence"))
10008      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
10009    if (json.has("careTeamSequence")) {
10010      JsonArray array = json.getAsJsonArray("careTeamSequence");
10011      for (int i = 0; i < array.size(); i++) {
10012        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
10013      }
10014    };
10015    if (json.has("_careTeamSequence")) {
10016      JsonArray array = json.getAsJsonArray("_careTeamSequence");
10017      for (int i = 0; i < array.size(); i++) {
10018        if (i == res.getCareTeamSequence().size())
10019          res.getCareTeamSequence().add(parsePositiveInt(null));
10020        if (array.get(i) instanceof JsonObject) 
10021          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
10022      }
10023    };
10024    if (json.has("diagnosisSequence")) {
10025      JsonArray array = json.getAsJsonArray("diagnosisSequence");
10026      for (int i = 0; i < array.size(); i++) {
10027        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
10028      }
10029    };
10030    if (json.has("_diagnosisSequence")) {
10031      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
10032      for (int i = 0; i < array.size(); i++) {
10033        if (i == res.getDiagnosisSequence().size())
10034          res.getDiagnosisSequence().add(parsePositiveInt(null));
10035        if (array.get(i) instanceof JsonObject) 
10036          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
10037      }
10038    };
10039    if (json.has("procedureSequence")) {
10040      JsonArray array = json.getAsJsonArray("procedureSequence");
10041      for (int i = 0; i < array.size(); i++) {
10042        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
10043      }
10044    };
10045    if (json.has("_procedureSequence")) {
10046      JsonArray array = json.getAsJsonArray("_procedureSequence");
10047      for (int i = 0; i < array.size(); i++) {
10048        if (i == res.getProcedureSequence().size())
10049          res.getProcedureSequence().add(parsePositiveInt(null));
10050        if (array.get(i) instanceof JsonObject) 
10051          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
10052      }
10053    };
10054    if (json.has("informationSequence")) {
10055      JsonArray array = json.getAsJsonArray("informationSequence");
10056      for (int i = 0; i < array.size(); i++) {
10057        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
10058      }
10059    };
10060    if (json.has("_informationSequence")) {
10061      JsonArray array = json.getAsJsonArray("_informationSequence");
10062      for (int i = 0; i < array.size(); i++) {
10063        if (i == res.getInformationSequence().size())
10064          res.getInformationSequence().add(parsePositiveInt(null));
10065        if (array.get(i) instanceof JsonObject) 
10066          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
10067      }
10068    };
10069    if (json.has("revenue"))
10070      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
10071    if (json.has("category"))
10072      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10073    if (json.has("service"))
10074      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
10075    if (json.has("modifier")) {
10076      JsonArray array = json.getAsJsonArray("modifier");
10077      for (int i = 0; i < array.size(); i++) {
10078        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10079      }
10080    };
10081    if (json.has("programCode")) {
10082      JsonArray array = json.getAsJsonArray("programCode");
10083      for (int i = 0; i < array.size(); i++) {
10084        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10085      }
10086    };
10087    Type serviced = parseType("serviced", json);
10088    if (serviced != null)
10089      res.setServiced(serviced);
10090    Type location = parseType("location", json);
10091    if (location != null)
10092      res.setLocation(location);
10093    if (json.has("quantity"))
10094      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10095    if (json.has("unitPrice"))
10096      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
10097    if (json.has("factor"))
10098      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
10099    if (json.has("_factor"))
10100      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
10101    if (json.has("net"))
10102      res.setNet(parseMoney(json.getAsJsonObject("net")));
10103    if (json.has("udi")) {
10104      JsonArray array = json.getAsJsonArray("udi");
10105      for (int i = 0; i < array.size(); i++) {
10106        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
10107      }
10108    };
10109    if (json.has("bodySite"))
10110      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
10111    if (json.has("subSite")) {
10112      JsonArray array = json.getAsJsonArray("subSite");
10113      for (int i = 0; i < array.size(); i++) {
10114        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10115      }
10116    };
10117    if (json.has("encounter")) {
10118      JsonArray array = json.getAsJsonArray("encounter");
10119      for (int i = 0; i < array.size(); i++) {
10120        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
10121      }
10122    };
10123    if (json.has("noteNumber")) {
10124      JsonArray array = json.getAsJsonArray("noteNumber");
10125      for (int i = 0; i < array.size(); i++) {
10126        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
10127      }
10128    };
10129    if (json.has("_noteNumber")) {
10130      JsonArray array = json.getAsJsonArray("_noteNumber");
10131      for (int i = 0; i < array.size(); i++) {
10132        if (i == res.getNoteNumber().size())
10133          res.getNoteNumber().add(parsePositiveInt(null));
10134        if (array.get(i) instanceof JsonObject) 
10135          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
10136      }
10137    };
10138    if (json.has("adjudication")) {
10139      JsonArray array = json.getAsJsonArray("adjudication");
10140      for (int i = 0; i < array.size(); i++) {
10141        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
10142      }
10143    };
10144    if (json.has("detail")) {
10145      JsonArray array = json.getAsJsonArray("detail");
10146      for (int i = 0; i < array.size(); i++) {
10147        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
10148      }
10149    };
10150  }
10151
10152  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10153    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
10154    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
10155    return res;
10156  }
10157
10158  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
10159    parseBackboneElementProperties(json, res);
10160    if (json.has("category"))
10161      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10162    if (json.has("reason"))
10163      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
10164    if (json.has("amount"))
10165      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
10166    if (json.has("value"))
10167      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
10168    if (json.has("_value"))
10169      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10170  }
10171
10172  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10173    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
10174    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
10175    return res;
10176  }
10177
10178  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
10179    parseBackboneElementProperties(json, res);
10180    if (json.has("sequence"))
10181      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
10182    if (json.has("_sequence"))
10183      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
10184    if (json.has("revenue"))
10185      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
10186    if (json.has("category"))
10187      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10188    if (json.has("service"))
10189      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
10190    if (json.has("modifier")) {
10191      JsonArray array = json.getAsJsonArray("modifier");
10192      for (int i = 0; i < array.size(); i++) {
10193        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10194      }
10195    };
10196    if (json.has("programCode")) {
10197      JsonArray array = json.getAsJsonArray("programCode");
10198      for (int i = 0; i < array.size(); i++) {
10199        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10200      }
10201    };
10202    if (json.has("quantity"))
10203      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10204    if (json.has("unitPrice"))
10205      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
10206    if (json.has("factor"))
10207      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
10208    if (json.has("_factor"))
10209      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
10210    if (json.has("net"))
10211      res.setNet(parseMoney(json.getAsJsonObject("net")));
10212    if (json.has("udi")) {
10213      JsonArray array = json.getAsJsonArray("udi");
10214      for (int i = 0; i < array.size(); i++) {
10215        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
10216      }
10217    };
10218    if (json.has("noteNumber")) {
10219      JsonArray array = json.getAsJsonArray("noteNumber");
10220      for (int i = 0; i < array.size(); i++) {
10221        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
10222      }
10223    };
10224    if (json.has("_noteNumber")) {
10225      JsonArray array = json.getAsJsonArray("_noteNumber");
10226      for (int i = 0; i < array.size(); i++) {
10227        if (i == res.getNoteNumber().size())
10228          res.getNoteNumber().add(parsePositiveInt(null));
10229        if (array.get(i) instanceof JsonObject) 
10230          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
10231      }
10232    };
10233    if (json.has("adjudication")) {
10234      JsonArray array = json.getAsJsonArray("adjudication");
10235      for (int i = 0; i < array.size(); i++) {
10236        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
10237      }
10238    };
10239    if (json.has("subDetail")) {
10240      JsonArray array = json.getAsJsonArray("subDetail");
10241      for (int i = 0; i < array.size(); i++) {
10242        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
10243      }
10244    };
10245  }
10246
10247  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10248    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
10249    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
10250    return res;
10251  }
10252
10253  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
10254    parseBackboneElementProperties(json, res);
10255    if (json.has("sequence"))
10256      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
10257    if (json.has("_sequence"))
10258      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
10259    if (json.has("revenue"))
10260      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
10261    if (json.has("category"))
10262      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10263    if (json.has("service"))
10264      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
10265    if (json.has("modifier")) {
10266      JsonArray array = json.getAsJsonArray("modifier");
10267      for (int i = 0; i < array.size(); i++) {
10268        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10269      }
10270    };
10271    if (json.has("programCode")) {
10272      JsonArray array = json.getAsJsonArray("programCode");
10273      for (int i = 0; i < array.size(); i++) {
10274        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10275      }
10276    };
10277    if (json.has("quantity"))
10278      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
10279    if (json.has("unitPrice"))
10280      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
10281    if (json.has("factor"))
10282      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
10283    if (json.has("_factor"))
10284      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
10285    if (json.has("net"))
10286      res.setNet(parseMoney(json.getAsJsonObject("net")));
10287    if (json.has("udi")) {
10288      JsonArray array = json.getAsJsonArray("udi");
10289      for (int i = 0; i < array.size(); i++) {
10290        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
10291      }
10292    };
10293    if (json.has("noteNumber")) {
10294      JsonArray array = json.getAsJsonArray("noteNumber");
10295      for (int i = 0; i < array.size(); i++) {
10296        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
10297      }
10298    };
10299    if (json.has("_noteNumber")) {
10300      JsonArray array = json.getAsJsonArray("_noteNumber");
10301      for (int i = 0; i < array.size(); i++) {
10302        if (i == res.getNoteNumber().size())
10303          res.getNoteNumber().add(parsePositiveInt(null));
10304        if (array.get(i) instanceof JsonObject) 
10305          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
10306      }
10307    };
10308    if (json.has("adjudication")) {
10309      JsonArray array = json.getAsJsonArray("adjudication");
10310      for (int i = 0; i < array.size(); i++) {
10311        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
10312      }
10313    };
10314  }
10315
10316  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10317    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
10318    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
10319    return res;
10320  }
10321
10322  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
10323    parseBackboneElementProperties(json, res);
10324    if (json.has("itemSequence")) {
10325      JsonArray array = json.getAsJsonArray("itemSequence");
10326      for (int i = 0; i < array.size(); i++) {
10327        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
10328      }
10329    };
10330    if (json.has("_itemSequence")) {
10331      JsonArray array = json.getAsJsonArray("_itemSequence");
10332      for (int i = 0; i < array.size(); i++) {
10333        if (i == res.getItemSequence().size())
10334          res.getItemSequence().add(parsePositiveInt(null));
10335        if (array.get(i) instanceof JsonObject) 
10336          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
10337      }
10338    };
10339    if (json.has("detailSequence")) {
10340      JsonArray array = json.getAsJsonArray("detailSequence");
10341      for (int i = 0; i < array.size(); i++) {
10342        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
10343      }
10344    };
10345    if (json.has("_detailSequence")) {
10346      JsonArray array = json.getAsJsonArray("_detailSequence");
10347      for (int i = 0; i < array.size(); i++) {
10348        if (i == res.getDetailSequence().size())
10349          res.getDetailSequence().add(parsePositiveInt(null));
10350        if (array.get(i) instanceof JsonObject) 
10351          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
10352      }
10353    };
10354    if (json.has("subDetailSequence")) {
10355      JsonArray array = json.getAsJsonArray("subDetailSequence");
10356      for (int i = 0; i < array.size(); i++) {
10357        res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
10358      }
10359    };
10360    if (json.has("_subDetailSequence")) {
10361      JsonArray array = json.getAsJsonArray("_subDetailSequence");
10362      for (int i = 0; i < array.size(); i++) {
10363        if (i == res.getSubDetailSequence().size())
10364          res.getSubDetailSequence().add(parsePositiveInt(null));
10365        if (array.get(i) instanceof JsonObject) 
10366          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
10367      }
10368    };
10369    if (json.has("service"))
10370      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
10371    if (json.has("modifier")) {
10372      JsonArray array = json.getAsJsonArray("modifier");
10373      for (int i = 0; i < array.size(); i++) {
10374        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10375      }
10376    };
10377    if (json.has("fee"))
10378      res.setFee(parseMoney(json.getAsJsonObject("fee")));
10379    if (json.has("noteNumber")) {
10380      JsonArray array = json.getAsJsonArray("noteNumber");
10381      for (int i = 0; i < array.size(); i++) {
10382        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
10383      }
10384    };
10385    if (json.has("_noteNumber")) {
10386      JsonArray array = json.getAsJsonArray("_noteNumber");
10387      for (int i = 0; i < array.size(); i++) {
10388        if (i == res.getNoteNumber().size())
10389          res.getNoteNumber().add(parsePositiveInt(null));
10390        if (array.get(i) instanceof JsonObject) 
10391          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
10392      }
10393    };
10394    if (json.has("adjudication")) {
10395      JsonArray array = json.getAsJsonArray("adjudication");
10396      for (int i = 0; i < array.size(); i++) {
10397        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
10398      }
10399    };
10400  }
10401
10402  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10403    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
10404    parseExplanationOfBenefitTotalComponentProperties(json, owner, res);
10405    return res;
10406  }
10407
10408  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
10409    parseBackboneElementProperties(json, res);
10410    if (json.has("category"))
10411      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10412    if (json.has("amount"))
10413      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
10414  }
10415
10416  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10417    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
10418    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
10419    return res;
10420  }
10421
10422  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
10423    parseBackboneElementProperties(json, res);
10424    if (json.has("type"))
10425      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10426    if (json.has("adjustment"))
10427      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
10428    if (json.has("adjustmentReason"))
10429      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
10430    if (json.has("date"))
10431      res.setDateElement(parseDate(json.get("date").getAsString()));
10432    if (json.has("_date"))
10433      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10434    if (json.has("amount"))
10435      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
10436    if (json.has("identifier"))
10437      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10438  }
10439
10440  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10441    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
10442    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
10443    return res;
10444  }
10445
10446  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
10447    parseBackboneElementProperties(json, res);
10448    if (json.has("number"))
10449      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
10450    if (json.has("_number"))
10451      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
10452    if (json.has("type"))
10453      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
10454    if (json.has("_type"))
10455      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10456    if (json.has("text"))
10457      res.setTextElement(parseString(json.get("text").getAsString()));
10458    if (json.has("_text"))
10459      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
10460    if (json.has("language"))
10461      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
10462  }
10463
10464  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10465    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
10466    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
10467    return res;
10468  }
10469
10470  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
10471    parseBackboneElementProperties(json, res);
10472    if (json.has("category"))
10473      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10474    if (json.has("subCategory"))
10475      res.setSubCategory(parseCodeableConcept(json.getAsJsonObject("subCategory")));
10476    if (json.has("excluded"))
10477      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
10478    if (json.has("_excluded"))
10479      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
10480    if (json.has("name"))
10481      res.setNameElement(parseString(json.get("name").getAsString()));
10482    if (json.has("_name"))
10483      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10484    if (json.has("description"))
10485      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10486    if (json.has("_description"))
10487      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10488    if (json.has("network"))
10489      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
10490    if (json.has("unit"))
10491      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
10492    if (json.has("term"))
10493      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
10494    if (json.has("financial")) {
10495      JsonArray array = json.getAsJsonArray("financial");
10496      for (int i = 0; i < array.size(); i++) {
10497        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
10498      }
10499    };
10500  }
10501
10502  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10503    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
10504    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
10505    return res;
10506  }
10507
10508  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
10509    parseBackboneElementProperties(json, res);
10510    if (json.has("type"))
10511      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10512    Type allowed = parseType("allowed", json);
10513    if (allowed != null)
10514      res.setAllowed(allowed);
10515    Type used = parseType("used", json);
10516    if (used != null)
10517      res.setUsed(used);
10518  }
10519
10520  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
10521    FamilyMemberHistory res = new FamilyMemberHistory();
10522    parseFamilyMemberHistoryProperties(json, res);
10523    return res;
10524  }
10525
10526  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
10527    parseDomainResourceProperties(json, res);
10528    if (json.has("identifier")) {
10529      JsonArray array = json.getAsJsonArray("identifier");
10530      for (int i = 0; i < array.size(); i++) {
10531        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10532      }
10533    };
10534    if (json.has("instantiates")) {
10535      JsonArray array = json.getAsJsonArray("instantiates");
10536      for (int i = 0; i < array.size(); i++) {
10537        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
10538      }
10539    };
10540    if (json.has("_instantiates")) {
10541      JsonArray array = json.getAsJsonArray("_instantiates");
10542      for (int i = 0; i < array.size(); i++) {
10543        if (i == res.getInstantiates().size())
10544          res.getInstantiates().add(parseUri(null));
10545        if (array.get(i) instanceof JsonObject) 
10546          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
10547      }
10548    };
10549    if (json.has("status"))
10550      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
10551    if (json.has("_status"))
10552      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10553    if (json.has("dataAbsentReason"))
10554      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
10555    if (json.has("patient"))
10556      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10557    if (json.has("date"))
10558      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10559    if (json.has("_date"))
10560      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10561    if (json.has("name"))
10562      res.setNameElement(parseString(json.get("name").getAsString()));
10563    if (json.has("_name"))
10564      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10565    if (json.has("relationship"))
10566      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
10567    if (json.has("gender"))
10568      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
10569    if (json.has("_gender"))
10570      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
10571    Type born = parseType("born", json);
10572    if (born != null)
10573      res.setBorn(born);
10574    Type age = parseType("age", json);
10575    if (age != null)
10576      res.setAge(age);
10577    if (json.has("estimatedAge"))
10578      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
10579    if (json.has("_estimatedAge"))
10580      parseElementProperties(json.getAsJsonObject("_estimatedAge"), res.getEstimatedAgeElement());
10581    Type deceased = parseType("deceased", json);
10582    if (deceased != null)
10583      res.setDeceased(deceased);
10584    if (json.has("reasonCode")) {
10585      JsonArray array = json.getAsJsonArray("reasonCode");
10586      for (int i = 0; i < array.size(); i++) {
10587        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10588      }
10589    };
10590    if (json.has("reasonReference")) {
10591      JsonArray array = json.getAsJsonArray("reasonReference");
10592      for (int i = 0; i < array.size(); i++) {
10593        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10594      }
10595    };
10596    if (json.has("note")) {
10597      JsonArray array = json.getAsJsonArray("note");
10598      for (int i = 0; i < array.size(); i++) {
10599        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10600      }
10601    };
10602    if (json.has("condition")) {
10603      JsonArray array = json.getAsJsonArray("condition");
10604      for (int i = 0; i < array.size(); i++) {
10605        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
10606      }
10607    };
10608  }
10609
10610  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
10611    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
10612    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
10613    return res;
10614  }
10615
10616  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
10617    parseBackboneElementProperties(json, res);
10618    if (json.has("code"))
10619      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10620    if (json.has("outcome"))
10621      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
10622    Type onset = parseType("onset", json);
10623    if (onset != null)
10624      res.setOnset(onset);
10625    if (json.has("note")) {
10626      JsonArray array = json.getAsJsonArray("note");
10627      for (int i = 0; i < array.size(); i++) {
10628        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10629      }
10630    };
10631  }
10632
10633  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
10634    Flag res = new Flag();
10635    parseFlagProperties(json, res);
10636    return res;
10637  }
10638
10639  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
10640    parseDomainResourceProperties(json, res);
10641    if (json.has("identifier")) {
10642      JsonArray array = json.getAsJsonArray("identifier");
10643      for (int i = 0; i < array.size(); i++) {
10644        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10645      }
10646    };
10647    if (json.has("status"))
10648      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
10649    if (json.has("_status"))
10650      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10651    if (json.has("category")) {
10652      JsonArray array = json.getAsJsonArray("category");
10653      for (int i = 0; i < array.size(); i++) {
10654        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10655      }
10656    };
10657    if (json.has("code"))
10658      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10659    if (json.has("subject"))
10660      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10661    if (json.has("period"))
10662      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10663    if (json.has("encounter"))
10664      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
10665    if (json.has("author"))
10666      res.setAuthor(parseReference(json.getAsJsonObject("author")));
10667  }
10668
10669  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
10670    Goal res = new Goal();
10671    parseGoalProperties(json, res);
10672    return res;
10673  }
10674
10675  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
10676    parseDomainResourceProperties(json, res);
10677    if (json.has("identifier")) {
10678      JsonArray array = json.getAsJsonArray("identifier");
10679      for (int i = 0; i < array.size(); i++) {
10680        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10681      }
10682    };
10683    if (json.has("status"))
10684      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Goal.GoalStatus.NULL, new Goal.GoalStatusEnumFactory()));
10685    if (json.has("_status"))
10686      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10687    if (json.has("category")) {
10688      JsonArray array = json.getAsJsonArray("category");
10689      for (int i = 0; i < array.size(); i++) {
10690        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10691      }
10692    };
10693    if (json.has("priority"))
10694      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
10695    if (json.has("description"))
10696      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
10697    if (json.has("subject"))
10698      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10699    Type start = parseType("start", json);
10700    if (start != null)
10701      res.setStart(start);
10702    if (json.has("target"))
10703      res.setTarget(parseGoalGoalTargetComponent(json.getAsJsonObject("target"), res));
10704    if (json.has("statusDate"))
10705      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
10706    if (json.has("_statusDate"))
10707      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
10708    if (json.has("statusReason"))
10709      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
10710    if (json.has("_statusReason"))
10711      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
10712    if (json.has("expressedBy"))
10713      res.setExpressedBy(parseReference(json.getAsJsonObject("expressedBy")));
10714    if (json.has("addresses")) {
10715      JsonArray array = json.getAsJsonArray("addresses");
10716      for (int i = 0; i < array.size(); i++) {
10717        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
10718      }
10719    };
10720    if (json.has("note")) {
10721      JsonArray array = json.getAsJsonArray("note");
10722      for (int i = 0; i < array.size(); i++) {
10723        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10724      }
10725    };
10726    if (json.has("outcomeCode")) {
10727      JsonArray array = json.getAsJsonArray("outcomeCode");
10728      for (int i = 0; i < array.size(); i++) {
10729        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10730      }
10731    };
10732    if (json.has("outcomeReference")) {
10733      JsonArray array = json.getAsJsonArray("outcomeReference");
10734      for (int i = 0; i < array.size(); i++) {
10735        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
10736      }
10737    };
10738  }
10739
10740  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
10741    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
10742    parseGoalGoalTargetComponentProperties(json, owner, res);
10743    return res;
10744  }
10745
10746  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
10747    parseBackboneElementProperties(json, res);
10748    if (json.has("measure"))
10749      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
10750    Type detail = parseType("detail", json);
10751    if (detail != null)
10752      res.setDetail(detail);
10753    Type due = parseType("due", json);
10754    if (due != null)
10755      res.setDue(due);
10756  }
10757
10758  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
10759    GraphDefinition res = new GraphDefinition();
10760    parseGraphDefinitionProperties(json, res);
10761    return res;
10762  }
10763
10764  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
10765    parseDomainResourceProperties(json, res);
10766    if (json.has("url"))
10767      res.setUrlElement(parseUri(json.get("url").getAsString()));
10768    if (json.has("_url"))
10769      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10770    if (json.has("version"))
10771      res.setVersionElement(parseString(json.get("version").getAsString()));
10772    if (json.has("_version"))
10773      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10774    if (json.has("name"))
10775      res.setNameElement(parseString(json.get("name").getAsString()));
10776    if (json.has("_name"))
10777      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10778    if (json.has("status"))
10779      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10780    if (json.has("_status"))
10781      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10782    if (json.has("experimental"))
10783      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10784    if (json.has("_experimental"))
10785      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10786    if (json.has("date"))
10787      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10788    if (json.has("_date"))
10789      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10790    if (json.has("publisher"))
10791      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10792    if (json.has("_publisher"))
10793      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10794    if (json.has("contact")) {
10795      JsonArray array = json.getAsJsonArray("contact");
10796      for (int i = 0; i < array.size(); i++) {
10797        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10798      }
10799    };
10800    if (json.has("description"))
10801      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10802    if (json.has("_description"))
10803      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10804    if (json.has("useContext")) {
10805      JsonArray array = json.getAsJsonArray("useContext");
10806      for (int i = 0; i < array.size(); i++) {
10807        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10808      }
10809    };
10810    if (json.has("jurisdiction")) {
10811      JsonArray array = json.getAsJsonArray("jurisdiction");
10812      for (int i = 0; i < array.size(); i++) {
10813        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10814      }
10815    };
10816    if (json.has("purpose"))
10817      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
10818    if (json.has("_purpose"))
10819      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
10820    if (json.has("start"))
10821      res.setStartElement(parseCode(json.get("start").getAsString()));
10822    if (json.has("_start"))
10823      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
10824    if (json.has("profile"))
10825      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
10826    if (json.has("_profile"))
10827      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
10828    if (json.has("link")) {
10829      JsonArray array = json.getAsJsonArray("link");
10830      for (int i = 0; i < array.size(); i++) {
10831        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
10832      }
10833    };
10834  }
10835
10836  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
10837    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
10838    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
10839    return res;
10840  }
10841
10842  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
10843    parseBackboneElementProperties(json, res);
10844    if (json.has("path"))
10845      res.setPathElement(parseString(json.get("path").getAsString()));
10846    if (json.has("_path"))
10847      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
10848    if (json.has("sliceName"))
10849      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
10850    if (json.has("_sliceName"))
10851      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
10852    if (json.has("min"))
10853      res.setMinElement(parseInteger(json.get("min").getAsLong()));
10854    if (json.has("_min"))
10855      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
10856    if (json.has("max"))
10857      res.setMaxElement(parseString(json.get("max").getAsString()));
10858    if (json.has("_max"))
10859      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
10860    if (json.has("description"))
10861      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10862    if (json.has("_description"))
10863      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10864    if (json.has("target")) {
10865      JsonArray array = json.getAsJsonArray("target");
10866      for (int i = 0; i < array.size(); i++) {
10867        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
10868      }
10869    };
10870  }
10871
10872  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
10873    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
10874    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
10875    return res;
10876  }
10877
10878  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
10879    parseBackboneElementProperties(json, res);
10880    if (json.has("type"))
10881      res.setTypeElement(parseCode(json.get("type").getAsString()));
10882    if (json.has("_type"))
10883      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10884    if (json.has("params"))
10885      res.setParamsElement(parseString(json.get("params").getAsString()));
10886    if (json.has("_params"))
10887      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
10888    if (json.has("profile"))
10889      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
10890    if (json.has("_profile"))
10891      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
10892    if (json.has("compartment")) {
10893      JsonArray array = json.getAsJsonArray("compartment");
10894      for (int i = 0; i < array.size(); i++) {
10895        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
10896      }
10897    };
10898    if (json.has("link")) {
10899      JsonArray array = json.getAsJsonArray("link");
10900      for (int i = 0; i < array.size(); i++) {
10901        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
10902      }
10903    };
10904  }
10905
10906  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
10907    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
10908    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
10909    return res;
10910  }
10911
10912  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
10913    parseBackboneElementProperties(json, res);
10914    if (json.has("use"))
10915      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL, new GraphDefinition.GraphCompartmentUseEnumFactory()));
10916    if (json.has("_use"))
10917      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
10918    if (json.has("code"))
10919      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
10920    if (json.has("_code"))
10921      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
10922    if (json.has("rule"))
10923      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
10924    if (json.has("_rule"))
10925      parseElementProperties(json.getAsJsonObject("_rule"), res.getRuleElement());
10926    if (json.has("expression"))
10927      res.setExpressionElement(parseString(json.get("expression").getAsString()));
10928    if (json.has("_expression"))
10929      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
10930    if (json.has("description"))
10931      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10932    if (json.has("_description"))
10933      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10934  }
10935
10936  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
10937    Group res = new Group();
10938    parseGroupProperties(json, res);
10939    return res;
10940  }
10941
10942  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
10943    parseDomainResourceProperties(json, res);
10944    if (json.has("identifier")) {
10945      JsonArray array = json.getAsJsonArray("identifier");
10946      for (int i = 0; i < array.size(); i++) {
10947        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10948      }
10949    };
10950    if (json.has("active"))
10951      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
10952    if (json.has("_active"))
10953      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
10954    if (json.has("type"))
10955      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
10956    if (json.has("_type"))
10957      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10958    if (json.has("actual"))
10959      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
10960    if (json.has("_actual"))
10961      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
10962    if (json.has("code"))
10963      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10964    if (json.has("name"))
10965      res.setNameElement(parseString(json.get("name").getAsString()));
10966    if (json.has("_name"))
10967      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10968    if (json.has("quantity"))
10969      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
10970    if (json.has("_quantity"))
10971      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
10972    if (json.has("characteristic")) {
10973      JsonArray array = json.getAsJsonArray("characteristic");
10974      for (int i = 0; i < array.size(); i++) {
10975        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
10976      }
10977    };
10978    if (json.has("member")) {
10979      JsonArray array = json.getAsJsonArray("member");
10980      for (int i = 0; i < array.size(); i++) {
10981        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
10982      }
10983    };
10984  }
10985
10986  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
10987    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
10988    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
10989    return res;
10990  }
10991
10992  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
10993    parseBackboneElementProperties(json, res);
10994    if (json.has("code"))
10995      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10996    Type value = parseType("value", json);
10997    if (value != null)
10998      res.setValue(value);
10999    if (json.has("exclude"))
11000      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
11001    if (json.has("_exclude"))
11002      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
11003    if (json.has("period"))
11004      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11005  }
11006
11007  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
11008    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
11009    parseGroupGroupMemberComponentProperties(json, owner, res);
11010    return res;
11011  }
11012
11013  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
11014    parseBackboneElementProperties(json, res);
11015    if (json.has("entity"))
11016      res.setEntity(parseReference(json.getAsJsonObject("entity")));
11017    if (json.has("period"))
11018      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11019    if (json.has("inactive"))
11020      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
11021    if (json.has("_inactive"))
11022      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
11023  }
11024
11025  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
11026    GuidanceResponse res = new GuidanceResponse();
11027    parseGuidanceResponseProperties(json, res);
11028    return res;
11029  }
11030
11031  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
11032    parseDomainResourceProperties(json, res);
11033    if (json.has("requestId"))
11034      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
11035    if (json.has("_requestId"))
11036      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
11037    if (json.has("identifier")) {
11038      JsonArray array = json.getAsJsonArray("identifier");
11039      for (int i = 0; i < array.size(); i++) {
11040        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11041      }
11042    };
11043    Type module = parseType("module", json);
11044    if (module != null)
11045      res.setModule(module);
11046    if (json.has("status"))
11047      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
11048    if (json.has("_status"))
11049      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11050    if (json.has("subject"))
11051      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11052    if (json.has("context"))
11053      res.setContext(parseReference(json.getAsJsonObject("context")));
11054    if (json.has("occurrenceDateTime"))
11055      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
11056    if (json.has("_occurrenceDateTime"))
11057      parseElementProperties(json.getAsJsonObject("_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
11058    if (json.has("performer"))
11059      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
11060    if (json.has("reasonCode")) {
11061      JsonArray array = json.getAsJsonArray("reasonCode");
11062      for (int i = 0; i < array.size(); i++) {
11063        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11064      }
11065    };
11066    if (json.has("reasonReference")) {
11067      JsonArray array = json.getAsJsonArray("reasonReference");
11068      for (int i = 0; i < array.size(); i++) {
11069        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
11070      }
11071    };
11072    if (json.has("note")) {
11073      JsonArray array = json.getAsJsonArray("note");
11074      for (int i = 0; i < array.size(); i++) {
11075        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11076      }
11077    };
11078    if (json.has("evaluationMessage")) {
11079      JsonArray array = json.getAsJsonArray("evaluationMessage");
11080      for (int i = 0; i < array.size(); i++) {
11081        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
11082      }
11083    };
11084    if (json.has("outputParameters"))
11085      res.setOutputParameters(parseReference(json.getAsJsonObject("outputParameters")));
11086    if (json.has("result"))
11087      res.setResult(parseReference(json.getAsJsonObject("result")));
11088    if (json.has("dataRequirement")) {
11089      JsonArray array = json.getAsJsonArray("dataRequirement");
11090      for (int i = 0; i < array.size(); i++) {
11091        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
11092      }
11093    };
11094  }
11095
11096  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
11097    HealthcareService res = new HealthcareService();
11098    parseHealthcareServiceProperties(json, res);
11099    return res;
11100  }
11101
11102  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
11103    parseDomainResourceProperties(json, res);
11104    if (json.has("identifier")) {
11105      JsonArray array = json.getAsJsonArray("identifier");
11106      for (int i = 0; i < array.size(); i++) {
11107        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11108      }
11109    };
11110    if (json.has("active"))
11111      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
11112    if (json.has("_active"))
11113      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
11114    if (json.has("providedBy"))
11115      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
11116    if (json.has("category")) {
11117      JsonArray array = json.getAsJsonArray("category");
11118      for (int i = 0; i < array.size(); i++) {
11119        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11120      }
11121    };
11122    if (json.has("type")) {
11123      JsonArray array = json.getAsJsonArray("type");
11124      for (int i = 0; i < array.size(); i++) {
11125        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11126      }
11127    };
11128    if (json.has("specialty")) {
11129      JsonArray array = json.getAsJsonArray("specialty");
11130      for (int i = 0; i < array.size(); i++) {
11131        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11132      }
11133    };
11134    if (json.has("location")) {
11135      JsonArray array = json.getAsJsonArray("location");
11136      for (int i = 0; i < array.size(); i++) {
11137        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
11138      }
11139    };
11140    if (json.has("name"))
11141      res.setNameElement(parseString(json.get("name").getAsString()));
11142    if (json.has("_name"))
11143      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11144    if (json.has("comment"))
11145      res.setCommentElement(parseString(json.get("comment").getAsString()));
11146    if (json.has("_comment"))
11147      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
11148    if (json.has("extraDetails"))
11149      res.setExtraDetailsElement(parseString(json.get("extraDetails").getAsString()));
11150    if (json.has("_extraDetails"))
11151      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
11152    if (json.has("photo"))
11153      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
11154    if (json.has("telecom")) {
11155      JsonArray array = json.getAsJsonArray("telecom");
11156      for (int i = 0; i < array.size(); i++) {
11157        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11158      }
11159    };
11160    if (json.has("coverageArea")) {
11161      JsonArray array = json.getAsJsonArray("coverageArea");
11162      for (int i = 0; i < array.size(); i++) {
11163        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
11164      }
11165    };
11166    if (json.has("serviceProvisionCode")) {
11167      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
11168      for (int i = 0; i < array.size(); i++) {
11169        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11170      }
11171    };
11172    if (json.has("eligibility"))
11173      res.setEligibility(parseCodeableConcept(json.getAsJsonObject("eligibility")));
11174    if (json.has("eligibilityNote"))
11175      res.setEligibilityNoteElement(parseString(json.get("eligibilityNote").getAsString()));
11176    if (json.has("_eligibilityNote"))
11177      parseElementProperties(json.getAsJsonObject("_eligibilityNote"), res.getEligibilityNoteElement());
11178    if (json.has("programName")) {
11179      JsonArray array = json.getAsJsonArray("programName");
11180      for (int i = 0; i < array.size(); i++) {
11181        res.getProgramName().add(parseString(array.get(i).getAsString()));
11182      }
11183    };
11184    if (json.has("_programName")) {
11185      JsonArray array = json.getAsJsonArray("_programName");
11186      for (int i = 0; i < array.size(); i++) {
11187        if (i == res.getProgramName().size())
11188          res.getProgramName().add(parseString(null));
11189        if (array.get(i) instanceof JsonObject) 
11190          parseElementProperties(array.get(i).getAsJsonObject(), res.getProgramName().get(i));
11191      }
11192    };
11193    if (json.has("characteristic")) {
11194      JsonArray array = json.getAsJsonArray("characteristic");
11195      for (int i = 0; i < array.size(); i++) {
11196        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11197      }
11198    };
11199    if (json.has("referralMethod")) {
11200      JsonArray array = json.getAsJsonArray("referralMethod");
11201      for (int i = 0; i < array.size(); i++) {
11202        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11203      }
11204    };
11205    if (json.has("appointmentRequired"))
11206      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
11207    if (json.has("_appointmentRequired"))
11208      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
11209    if (json.has("availableTime")) {
11210      JsonArray array = json.getAsJsonArray("availableTime");
11211      for (int i = 0; i < array.size(); i++) {
11212        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
11213      }
11214    };
11215    if (json.has("notAvailable")) {
11216      JsonArray array = json.getAsJsonArray("notAvailable");
11217      for (int i = 0; i < array.size(); i++) {
11218        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
11219      }
11220    };
11221    if (json.has("availabilityExceptions"))
11222      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
11223    if (json.has("_availabilityExceptions"))
11224      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
11225    if (json.has("endpoint")) {
11226      JsonArray array = json.getAsJsonArray("endpoint");
11227      for (int i = 0; i < array.size(); i++) {
11228        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
11229      }
11230    };
11231  }
11232
11233  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
11234    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
11235    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
11236    return res;
11237  }
11238
11239  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
11240    parseBackboneElementProperties(json, res);
11241    if (json.has("daysOfWeek")) {
11242      JsonArray array = json.getAsJsonArray("daysOfWeek");
11243      for (int i = 0; i < array.size(); i++) {
11244        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
11245      }
11246    };
11247    if (json.has("_daysOfWeek")) {
11248      JsonArray array = json.getAsJsonArray("_daysOfWeek");
11249      for (int i = 0; i < array.size(); i++) {
11250        if (i == res.getDaysOfWeek().size())
11251          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
11252        if (array.get(i) instanceof JsonObject) 
11253          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
11254      }
11255    };
11256    if (json.has("allDay"))
11257      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
11258    if (json.has("_allDay"))
11259      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
11260    if (json.has("availableStartTime"))
11261      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
11262    if (json.has("_availableStartTime"))
11263      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
11264    if (json.has("availableEndTime"))
11265      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
11266    if (json.has("_availableEndTime"))
11267      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
11268  }
11269
11270  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
11271    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
11272    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
11273    return res;
11274  }
11275
11276  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
11277    parseBackboneElementProperties(json, res);
11278    if (json.has("description"))
11279      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11280    if (json.has("_description"))
11281      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11282    if (json.has("during"))
11283      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
11284  }
11285
11286  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
11287    ImagingStudy res = new ImagingStudy();
11288    parseImagingStudyProperties(json, res);
11289    return res;
11290  }
11291
11292  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
11293    parseDomainResourceProperties(json, res);
11294    if (json.has("identifier")) {
11295      JsonArray array = json.getAsJsonArray("identifier");
11296      for (int i = 0; i < array.size(); i++) {
11297        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11298      }
11299    };
11300    if (json.has("status"))
11301      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL, new ImagingStudy.ImagingStudyStatusEnumFactory()));
11302    if (json.has("_status"))
11303      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11304    if (json.has("modality")) {
11305      JsonArray array = json.getAsJsonArray("modality");
11306      for (int i = 0; i < array.size(); i++) {
11307        res.getModality().add(parseCoding(array.get(i).getAsJsonObject()));
11308      }
11309    };
11310    if (json.has("subject"))
11311      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11312    if (json.has("context"))
11313      res.setContext(parseReference(json.getAsJsonObject("context")));
11314    if (json.has("started"))
11315      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
11316    if (json.has("_started"))
11317      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
11318    if (json.has("basedOn")) {
11319      JsonArray array = json.getAsJsonArray("basedOn");
11320      for (int i = 0; i < array.size(); i++) {
11321        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11322      }
11323    };
11324    if (json.has("referrer"))
11325      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
11326    if (json.has("interpreter")) {
11327      JsonArray array = json.getAsJsonArray("interpreter");
11328      for (int i = 0; i < array.size(); i++) {
11329        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
11330      }
11331    };
11332    if (json.has("endpoint")) {
11333      JsonArray array = json.getAsJsonArray("endpoint");
11334      for (int i = 0; i < array.size(); i++) {
11335        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
11336      }
11337    };
11338    if (json.has("numberOfSeries"))
11339      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
11340    if (json.has("_numberOfSeries"))
11341      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
11342    if (json.has("numberOfInstances"))
11343      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
11344    if (json.has("_numberOfInstances"))
11345      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
11346    if (json.has("procedureReference"))
11347      res.setProcedureReference(parseReference(json.getAsJsonObject("procedureReference")));
11348    if (json.has("procedureCode")) {
11349      JsonArray array = json.getAsJsonArray("procedureCode");
11350      for (int i = 0; i < array.size(); i++) {
11351        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11352      }
11353    };
11354    if (json.has("location"))
11355      res.setLocation(parseReference(json.getAsJsonObject("location")));
11356    if (json.has("reasonCode")) {
11357      JsonArray array = json.getAsJsonArray("reasonCode");
11358      for (int i = 0; i < array.size(); i++) {
11359        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11360      }
11361    };
11362    if (json.has("reasonReference")) {
11363      JsonArray array = json.getAsJsonArray("reasonReference");
11364      for (int i = 0; i < array.size(); i++) {
11365        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
11366      }
11367    };
11368    if (json.has("note")) {
11369      JsonArray array = json.getAsJsonArray("note");
11370      for (int i = 0; i < array.size(); i++) {
11371        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11372      }
11373    };
11374    if (json.has("series")) {
11375      JsonArray array = json.getAsJsonArray("series");
11376      for (int i = 0; i < array.size(); i++) {
11377        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
11378      }
11379    };
11380  }
11381
11382  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
11383    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
11384    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
11385    return res;
11386  }
11387
11388  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
11389    parseBackboneElementProperties(json, res);
11390    if (json.has("identifier"))
11391      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11392    if (json.has("number"))
11393      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
11394    if (json.has("_number"))
11395      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
11396    if (json.has("modality"))
11397      res.setModality(parseCoding(json.getAsJsonObject("modality")));
11398    if (json.has("description"))
11399      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11400    if (json.has("_description"))
11401      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11402    if (json.has("numberOfInstances"))
11403      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
11404    if (json.has("_numberOfInstances"))
11405      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
11406    if (json.has("endpoint")) {
11407      JsonArray array = json.getAsJsonArray("endpoint");
11408      for (int i = 0; i < array.size(); i++) {
11409        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
11410      }
11411    };
11412    if (json.has("bodySite"))
11413      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
11414    if (json.has("laterality"))
11415      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
11416    if (json.has("specimen")) {
11417      JsonArray array = json.getAsJsonArray("specimen");
11418      for (int i = 0; i < array.size(); i++) {
11419        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
11420      }
11421    };
11422    if (json.has("started"))
11423      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
11424    if (json.has("_started"))
11425      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
11426    if (json.has("performer")) {
11427      JsonArray array = json.getAsJsonArray("performer");
11428      for (int i = 0; i < array.size(); i++) {
11429        res.getPerformer().add(parseImagingStudyImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject(), owner));
11430      }
11431    };
11432    if (json.has("instance")) {
11433      JsonArray array = json.getAsJsonArray("instance");
11434      for (int i = 0; i < array.size(); i++) {
11435        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
11436      }
11437    };
11438  }
11439
11440  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudyImagingStudySeriesPerformerComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
11441    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
11442    parseImagingStudyImagingStudySeriesPerformerComponentProperties(json, owner, res);
11443    return res;
11444  }
11445
11446  protected void parseImagingStudyImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
11447    parseBackboneElementProperties(json, res);
11448    if (json.has("function"))
11449      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
11450    if (json.has("actor"))
11451      res.setActor(parseReference(json.getAsJsonObject("actor")));
11452  }
11453
11454  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
11455    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
11456    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
11457    return res;
11458  }
11459
11460  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
11461    parseBackboneElementProperties(json, res);
11462    if (json.has("identifier"))
11463      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11464    if (json.has("number"))
11465      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
11466    if (json.has("_number"))
11467      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
11468    if (json.has("sopClass"))
11469      res.setSopClass(parseCoding(json.getAsJsonObject("sopClass")));
11470    if (json.has("title"))
11471      res.setTitleElement(parseString(json.get("title").getAsString()));
11472    if (json.has("_title"))
11473      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11474  }
11475
11476  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
11477    Immunization res = new Immunization();
11478    parseImmunizationProperties(json, res);
11479    return res;
11480  }
11481
11482  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
11483    parseDomainResourceProperties(json, res);
11484    if (json.has("identifier")) {
11485      JsonArray array = json.getAsJsonArray("identifier");
11486      for (int i = 0; i < array.size(); i++) {
11487        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11488      }
11489    };
11490    if (json.has("status"))
11491      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
11492    if (json.has("_status"))
11493      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11494    if (json.has("statusReason"))
11495      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
11496    if (json.has("vaccineCode"))
11497      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
11498    if (json.has("patient"))
11499      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11500    if (json.has("encounter"))
11501      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
11502    if (json.has("date"))
11503      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11504    if (json.has("_date"))
11505      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11506    if (json.has("primarySource"))
11507      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
11508    if (json.has("_primarySource"))
11509      parseElementProperties(json.getAsJsonObject("_primarySource"), res.getPrimarySourceElement());
11510    if (json.has("reportOrigin"))
11511      res.setReportOrigin(parseCodeableConcept(json.getAsJsonObject("reportOrigin")));
11512    if (json.has("location"))
11513      res.setLocation(parseReference(json.getAsJsonObject("location")));
11514    if (json.has("manufacturer"))
11515      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
11516    if (json.has("lotNumber"))
11517      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
11518    if (json.has("_lotNumber"))
11519      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
11520    if (json.has("expirationDate"))
11521      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
11522    if (json.has("_expirationDate"))
11523      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
11524    if (json.has("site"))
11525      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
11526    if (json.has("route"))
11527      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
11528    if (json.has("doseQuantity"))
11529      res.setDoseQuantity(parseSimpleQuantity(json.getAsJsonObject("doseQuantity")));
11530    if (json.has("performer")) {
11531      JsonArray array = json.getAsJsonArray("performer");
11532      for (int i = 0; i < array.size(); i++) {
11533        res.getPerformer().add(parseImmunizationImmunizationPerformerComponent(array.get(i).getAsJsonObject(), res));
11534      }
11535    };
11536    if (json.has("note")) {
11537      JsonArray array = json.getAsJsonArray("note");
11538      for (int i = 0; i < array.size(); i++) {
11539        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11540      }
11541    };
11542    if (json.has("reasonCode")) {
11543      JsonArray array = json.getAsJsonArray("reasonCode");
11544      for (int i = 0; i < array.size(); i++) {
11545        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11546      }
11547    };
11548    if (json.has("reasonReference")) {
11549      JsonArray array = json.getAsJsonArray("reasonReference");
11550      for (int i = 0; i < array.size(); i++) {
11551        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
11552      }
11553    };
11554    if (json.has("isPotent"))
11555      res.setIsPotentElement(parseBoolean(json.get("isPotent").getAsBoolean()));
11556    if (json.has("_isPotent"))
11557      parseElementProperties(json.getAsJsonObject("_isPotent"), res.getIsPotentElement());
11558    if (json.has("subpotentReason")) {
11559      JsonArray array = json.getAsJsonArray("subpotentReason");
11560      for (int i = 0; i < array.size(); i++) {
11561        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11562      }
11563    };
11564    if (json.has("education")) {
11565      JsonArray array = json.getAsJsonArray("education");
11566      for (int i = 0; i < array.size(); i++) {
11567        res.getEducation().add(parseImmunizationImmunizationEducationComponent(array.get(i).getAsJsonObject(), res));
11568      }
11569    };
11570    if (json.has("programEligibility")) {
11571      JsonArray array = json.getAsJsonArray("programEligibility");
11572      for (int i = 0; i < array.size(); i++) {
11573        res.getProgramEligibility().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11574      }
11575    };
11576    if (json.has("fundingSource"))
11577      res.setFundingSource(parseCodeableConcept(json.getAsJsonObject("fundingSource")));
11578  }
11579
11580  protected Immunization.ImmunizationPerformerComponent parseImmunizationImmunizationPerformerComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
11581    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
11582    parseImmunizationImmunizationPerformerComponentProperties(json, owner, res);
11583    return res;
11584  }
11585
11586  protected void parseImmunizationImmunizationPerformerComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
11587    parseBackboneElementProperties(json, res);
11588    if (json.has("function"))
11589      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
11590    if (json.has("actor"))
11591      res.setActor(parseReference(json.getAsJsonObject("actor")));
11592  }
11593
11594  protected Immunization.ImmunizationEducationComponent parseImmunizationImmunizationEducationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
11595    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
11596    parseImmunizationImmunizationEducationComponentProperties(json, owner, res);
11597    return res;
11598  }
11599
11600  protected void parseImmunizationImmunizationEducationComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationEducationComponent res) throws IOException, FHIRFormatError {
11601    parseBackboneElementProperties(json, res);
11602    if (json.has("documentType"))
11603      res.setDocumentTypeElement(parseString(json.get("documentType").getAsString()));
11604    if (json.has("_documentType"))
11605      parseElementProperties(json.getAsJsonObject("_documentType"), res.getDocumentTypeElement());
11606    if (json.has("reference"))
11607      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
11608    if (json.has("_reference"))
11609      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
11610    if (json.has("publicationDate"))
11611      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
11612    if (json.has("_publicationDate"))
11613      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
11614    if (json.has("presentationDate"))
11615      res.setPresentationDateElement(parseDateTime(json.get("presentationDate").getAsString()));
11616    if (json.has("_presentationDate"))
11617      parseElementProperties(json.getAsJsonObject("_presentationDate"), res.getPresentationDateElement());
11618  }
11619
11620  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
11621    ImmunizationEvaluation res = new ImmunizationEvaluation();
11622    parseImmunizationEvaluationProperties(json, res);
11623    return res;
11624  }
11625
11626  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res) throws IOException, FHIRFormatError {
11627    parseDomainResourceProperties(json, res);
11628    if (json.has("identifier")) {
11629      JsonArray array = json.getAsJsonArray("identifier");
11630      for (int i = 0; i < array.size(); i++) {
11631        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11632      }
11633    };
11634    if (json.has("status"))
11635      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory()));
11636    if (json.has("_status"))
11637      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11638    if (json.has("patient"))
11639      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11640    if (json.has("date"))
11641      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11642    if (json.has("_date"))
11643      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11644    if (json.has("authority"))
11645      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
11646    if (json.has("targetDisease")) {
11647      JsonArray array = json.getAsJsonArray("targetDisease");
11648      for (int i = 0; i < array.size(); i++) {
11649        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11650      }
11651    };
11652    if (json.has("immunizationEvent"))
11653      res.setImmunizationEvent(parseReference(json.getAsJsonObject("immunizationEvent")));
11654    if (json.has("doseStatus"))
11655      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
11656    if (json.has("doseStatusReason")) {
11657      JsonArray array = json.getAsJsonArray("doseStatusReason");
11658      for (int i = 0; i < array.size(); i++) {
11659        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11660      }
11661    };
11662    if (json.has("description"))
11663      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11664    if (json.has("_description"))
11665      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11666    if (json.has("series"))
11667      res.setSeriesElement(parseString(json.get("series").getAsString()));
11668    if (json.has("_series"))
11669      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
11670    Type doseNumber = parseType("doseNumber", json);
11671    if (doseNumber != null)
11672      res.setDoseNumber(doseNumber);
11673    Type seriesDoses = parseType("seriesDoses", json);
11674    if (seriesDoses != null)
11675      res.setSeriesDoses(seriesDoses);
11676  }
11677
11678  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
11679    ImmunizationRecommendation res = new ImmunizationRecommendation();
11680    parseImmunizationRecommendationProperties(json, res);
11681    return res;
11682  }
11683
11684  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
11685    parseDomainResourceProperties(json, res);
11686    if (json.has("identifier")) {
11687      JsonArray array = json.getAsJsonArray("identifier");
11688      for (int i = 0; i < array.size(); i++) {
11689        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11690      }
11691    };
11692    if (json.has("patient"))
11693      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11694    if (json.has("date"))
11695      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11696    if (json.has("_date"))
11697      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11698    if (json.has("authority"))
11699      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
11700    if (json.has("recommendation")) {
11701      JsonArray array = json.getAsJsonArray("recommendation");
11702      for (int i = 0; i < array.size(); i++) {
11703        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
11704      }
11705    };
11706  }
11707
11708  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
11709    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
11710    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
11711    return res;
11712  }
11713
11714  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
11715    parseBackboneElementProperties(json, res);
11716    if (json.has("vaccineCode")) {
11717      JsonArray array = json.getAsJsonArray("vaccineCode");
11718      for (int i = 0; i < array.size(); i++) {
11719        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11720      }
11721    };
11722    if (json.has("targetDisease"))
11723      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
11724    if (json.has("contraindicatedVaccineCode")) {
11725      JsonArray array = json.getAsJsonArray("contraindicatedVaccineCode");
11726      for (int i = 0; i < array.size(); i++) {
11727        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11728      }
11729    };
11730    if (json.has("forecastStatus"))
11731      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
11732    if (json.has("forecastReason")) {
11733      JsonArray array = json.getAsJsonArray("forecastReason");
11734      for (int i = 0; i < array.size(); i++) {
11735        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11736      }
11737    };
11738    if (json.has("dateCriterion")) {
11739      JsonArray array = json.getAsJsonArray("dateCriterion");
11740      for (int i = 0; i < array.size(); i++) {
11741        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
11742      }
11743    };
11744    if (json.has("description"))
11745      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11746    if (json.has("_description"))
11747      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11748    if (json.has("series"))
11749      res.setSeriesElement(parseString(json.get("series").getAsString()));
11750    if (json.has("_series"))
11751      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
11752    Type doseNumber = parseType("doseNumber", json);
11753    if (doseNumber != null)
11754      res.setDoseNumber(doseNumber);
11755    Type seriesDoses = parseType("seriesDoses", json);
11756    if (seriesDoses != null)
11757      res.setSeriesDoses(seriesDoses);
11758    if (json.has("supportingImmunization")) {
11759      JsonArray array = json.getAsJsonArray("supportingImmunization");
11760      for (int i = 0; i < array.size(); i++) {
11761        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
11762      }
11763    };
11764    if (json.has("supportingPatientInformation")) {
11765      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
11766      for (int i = 0; i < array.size(); i++) {
11767        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
11768      }
11769    };
11770  }
11771
11772  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
11773    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
11774    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner, res);
11775    return res;
11776  }
11777
11778  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
11779    parseBackboneElementProperties(json, res);
11780    if (json.has("code"))
11781      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11782    if (json.has("value"))
11783      res.setValueElement(parseDateTime(json.get("value").getAsString()));
11784    if (json.has("_value"))
11785      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
11786  }
11787
11788  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
11789    ImplementationGuide res = new ImplementationGuide();
11790    parseImplementationGuideProperties(json, res);
11791    return res;
11792  }
11793
11794  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
11795    parseDomainResourceProperties(json, res);
11796    if (json.has("url"))
11797      res.setUrlElement(parseUri(json.get("url").getAsString()));
11798    if (json.has("_url"))
11799      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11800    if (json.has("version"))
11801      res.setVersionElement(parseString(json.get("version").getAsString()));
11802    if (json.has("_version"))
11803      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11804    if (json.has("name"))
11805      res.setNameElement(parseString(json.get("name").getAsString()));
11806    if (json.has("_name"))
11807      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11808    if (json.has("status"))
11809      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11810    if (json.has("_status"))
11811      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11812    if (json.has("experimental"))
11813      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11814    if (json.has("_experimental"))
11815      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
11816    if (json.has("date"))
11817      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11818    if (json.has("_date"))
11819      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11820    if (json.has("publisher"))
11821      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11822    if (json.has("_publisher"))
11823      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11824    if (json.has("contact")) {
11825      JsonArray array = json.getAsJsonArray("contact");
11826      for (int i = 0; i < array.size(); i++) {
11827        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11828      }
11829    };
11830    if (json.has("description"))
11831      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11832    if (json.has("_description"))
11833      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11834    if (json.has("useContext")) {
11835      JsonArray array = json.getAsJsonArray("useContext");
11836      for (int i = 0; i < array.size(); i++) {
11837        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11838      }
11839    };
11840    if (json.has("jurisdiction")) {
11841      JsonArray array = json.getAsJsonArray("jurisdiction");
11842      for (int i = 0; i < array.size(); i++) {
11843        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11844      }
11845    };
11846    if (json.has("copyright"))
11847      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11848    if (json.has("_copyright"))
11849      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
11850    if (json.has("fhirVersion"))
11851      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
11852    if (json.has("_fhirVersion"))
11853      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
11854    if (json.has("dependsOn")) {
11855      JsonArray array = json.getAsJsonArray("dependsOn");
11856      for (int i = 0; i < array.size(); i++) {
11857        res.getDependsOn().add(parseImplementationGuideImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject(), res));
11858      }
11859    };
11860    if (json.has("global")) {
11861      JsonArray array = json.getAsJsonArray("global");
11862      for (int i = 0; i < array.size(); i++) {
11863        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
11864      }
11865    };
11866    if (json.has("definition"))
11867      res.setDefinition(parseImplementationGuideImplementationGuideDefinitionComponent(json.getAsJsonObject("definition"), res));
11868    if (json.has("manifest"))
11869      res.setManifest(parseImplementationGuideImplementationGuideManifestComponent(json.getAsJsonObject("manifest"), res));
11870  }
11871
11872  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideImplementationGuideDependsOnComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11873    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
11874    parseImplementationGuideImplementationGuideDependsOnComponentProperties(json, owner, res);
11875    return res;
11876  }
11877
11878  protected void parseImplementationGuideImplementationGuideDependsOnComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependsOnComponent res) throws IOException, FHIRFormatError {
11879    parseBackboneElementProperties(json, res);
11880    if (json.has("uri"))
11881      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
11882    if (json.has("_uri"))
11883      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
11884    if (json.has("version"))
11885      res.setVersionElement(parseString(json.get("version").getAsString()));
11886    if (json.has("_version"))
11887      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11888  }
11889
11890  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11891    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
11892    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
11893    return res;
11894  }
11895
11896  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
11897    parseBackboneElementProperties(json, res);
11898    if (json.has("type"))
11899      res.setTypeElement(parseCode(json.get("type").getAsString()));
11900    if (json.has("_type"))
11901      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11902    if (json.has("profile"))
11903      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
11904    if (json.has("_profile"))
11905      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
11906  }
11907
11908  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideImplementationGuideDefinitionComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11909    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
11910    parseImplementationGuideImplementationGuideDefinitionComponentProperties(json, owner, res);
11911    return res;
11912  }
11913
11914  protected void parseImplementationGuideImplementationGuideDefinitionComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws IOException, FHIRFormatError {
11915    parseBackboneElementProperties(json, res);
11916    if (json.has("package")) {
11917      JsonArray array = json.getAsJsonArray("package");
11918      for (int i = 0; i < array.size(); i++) {
11919        res.getPackage().add(parseImplementationGuideImplementationGuideDefinitionPackageComponent(array.get(i).getAsJsonObject(), owner));
11920      }
11921    };
11922    if (json.has("resource")) {
11923      JsonArray array = json.getAsJsonArray("resource");
11924      for (int i = 0; i < array.size(); i++) {
11925        res.getResource().add(parseImplementationGuideImplementationGuideDefinitionResourceComponent(array.get(i).getAsJsonObject(), owner));
11926      }
11927    };
11928    if (json.has("page"))
11929      res.setPage(parseImplementationGuideImplementationGuideDefinitionPageComponent(json.getAsJsonObject("page"), owner));
11930    if (json.has("parameter")) {
11931      JsonArray array = json.getAsJsonArray("parameter");
11932      for (int i = 0; i < array.size(); i++) {
11933        res.getParameter().add(parseImplementationGuideImplementationGuideDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
11934      }
11935    };
11936    if (json.has("template")) {
11937      JsonArray array = json.getAsJsonArray("template");
11938      for (int i = 0; i < array.size(); i++) {
11939        res.getTemplate().add(parseImplementationGuideImplementationGuideDefinitionTemplateComponent(array.get(i).getAsJsonObject(), owner));
11940      }
11941    };
11942  }
11943
11944  protected ImplementationGuide.ImplementationGuideDefinitionPackageComponent parseImplementationGuideImplementationGuideDefinitionPackageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11945    ImplementationGuide.ImplementationGuideDefinitionPackageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPackageComponent();
11946    parseImplementationGuideImplementationGuideDefinitionPackageComponentProperties(json, owner, res);
11947    return res;
11948  }
11949
11950  protected void parseImplementationGuideImplementationGuideDefinitionPackageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPackageComponent res) throws IOException, FHIRFormatError {
11951    parseBackboneElementProperties(json, res);
11952    if (json.has("name"))
11953      res.setNameElement(parseString(json.get("name").getAsString()));
11954    if (json.has("_name"))
11955      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11956    if (json.has("description"))
11957      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11958    if (json.has("_description"))
11959      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11960  }
11961
11962  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideImplementationGuideDefinitionResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11963    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
11964    parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(json, owner, res);
11965    return res;
11966  }
11967
11968  protected void parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res) throws IOException, FHIRFormatError {
11969    parseBackboneElementProperties(json, res);
11970    if (json.has("reference"))
11971      res.setReference(parseReference(json.getAsJsonObject("reference")));
11972    if (json.has("name"))
11973      res.setNameElement(parseString(json.get("name").getAsString()));
11974    if (json.has("_name"))
11975      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11976    if (json.has("description"))
11977      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11978    if (json.has("_description"))
11979      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11980    Type example = parseType("example", json);
11981    if (example != null)
11982      res.setExample(example);
11983    if (json.has("package"))
11984      res.setPackageElement(parseId(json.get("package").getAsString()));
11985    if (json.has("_package"))
11986      parseElementProperties(json.getAsJsonObject("_package"), res.getPackageElement());
11987  }
11988
11989  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideImplementationGuideDefinitionPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11990    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
11991    parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(json, owner, res);
11992    return res;
11993  }
11994
11995  protected void parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPageComponent res) throws IOException, FHIRFormatError {
11996    parseBackboneElementProperties(json, res);
11997    Type name = parseType("name", json);
11998    if (name != null)
11999      res.setName(name);
12000    if (json.has("title"))
12001      res.setTitleElement(parseString(json.get("title").getAsString()));
12002    if (json.has("_title"))
12003      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12004    if (json.has("generation"))
12005      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(), ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
12006    if (json.has("_generation"))
12007      parseElementProperties(json.getAsJsonObject("_generation"), res.getGenerationElement());
12008    if (json.has("page")) {
12009      JsonArray array = json.getAsJsonArray("page");
12010      for (int i = 0; i < array.size(); i++) {
12011        res.getPage().add(parseImplementationGuideImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject(), owner));
12012      }
12013    };
12014  }
12015
12016  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideImplementationGuideDefinitionParameterComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
12017    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
12018    parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(json, owner, res);
12019    return res;
12020  }
12021
12022  protected void parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
12023    parseBackboneElementProperties(json, res);
12024    if (json.has("code"))
12025      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), ImplementationGuide.GuideParameterCode.NULL, new ImplementationGuide.GuideParameterCodeEnumFactory()));
12026    if (json.has("_code"))
12027      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
12028    if (json.has("value"))
12029      res.setValueElement(parseString(json.get("value").getAsString()));
12030    if (json.has("_value"))
12031      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
12032  }
12033
12034  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideImplementationGuideDefinitionTemplateComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
12035    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
12036    parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(json, owner, res);
12037    return res;
12038  }
12039
12040  protected void parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res) throws IOException, FHIRFormatError {
12041    parseBackboneElementProperties(json, res);
12042    if (json.has("code"))
12043      res.setCodeElement(parseCode(json.get("code").getAsString()));
12044    if (json.has("_code"))
12045      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
12046    if (json.has("source"))
12047      res.setSourceElement(parseString(json.get("source").getAsString()));
12048    if (json.has("_source"))
12049      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
12050    if (json.has("scope"))
12051      res.setScopeElement(parseString(json.get("scope").getAsString()));
12052    if (json.has("_scope"))
12053      parseElementProperties(json.getAsJsonObject("_scope"), res.getScopeElement());
12054  }
12055
12056  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideImplementationGuideManifestComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
12057    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
12058    parseImplementationGuideImplementationGuideManifestComponentProperties(json, owner, res);
12059    return res;
12060  }
12061
12062  protected void parseImplementationGuideImplementationGuideManifestComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestComponent res) throws IOException, FHIRFormatError {
12063    parseBackboneElementProperties(json, res);
12064    if (json.has("rendering"))
12065      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
12066    if (json.has("_rendering"))
12067      parseElementProperties(json.getAsJsonObject("_rendering"), res.getRenderingElement());
12068    if (json.has("resource")) {
12069      JsonArray array = json.getAsJsonArray("resource");
12070      for (int i = 0; i < array.size(); i++) {
12071        res.getResource().add(parseImplementationGuideImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject(), owner));
12072      }
12073    };
12074    if (json.has("page")) {
12075      JsonArray array = json.getAsJsonArray("page");
12076      for (int i = 0; i < array.size(); i++) {
12077        res.getPage().add(parseImplementationGuideImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject(), owner));
12078      }
12079    };
12080    if (json.has("image")) {
12081      JsonArray array = json.getAsJsonArray("image");
12082      for (int i = 0; i < array.size(); i++) {
12083        res.getImage().add(parseString(array.get(i).getAsString()));
12084      }
12085    };
12086    if (json.has("_image")) {
12087      JsonArray array = json.getAsJsonArray("_image");
12088      for (int i = 0; i < array.size(); i++) {
12089        if (i == res.getImage().size())
12090          res.getImage().add(parseString(null));
12091        if (array.get(i) instanceof JsonObject) 
12092          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
12093      }
12094    };
12095    if (json.has("other")) {
12096      JsonArray array = json.getAsJsonArray("other");
12097      for (int i = 0; i < array.size(); i++) {
12098        res.getOther().add(parseString(array.get(i).getAsString()));
12099      }
12100    };
12101    if (json.has("_other")) {
12102      JsonArray array = json.getAsJsonArray("_other");
12103      for (int i = 0; i < array.size(); i++) {
12104        if (i == res.getOther().size())
12105          res.getOther().add(parseString(null));
12106        if (array.get(i) instanceof JsonObject) 
12107          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
12108      }
12109    };
12110  }
12111
12112  protected ImplementationGuide.ImplementationGuideManifestResourceComponent parseImplementationGuideImplementationGuideManifestResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
12113    ImplementationGuide.ImplementationGuideManifestResourceComponent res = new ImplementationGuide.ImplementationGuideManifestResourceComponent();
12114    parseImplementationGuideImplementationGuideManifestResourceComponentProperties(json, owner, res);
12115    return res;
12116  }
12117
12118  protected void parseImplementationGuideImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestResourceComponent res) throws IOException, FHIRFormatError {
12119    parseBackboneElementProperties(json, res);
12120    if (json.has("reference"))
12121      res.setReference(parseReference(json.getAsJsonObject("reference")));
12122    Type example = parseType("example", json);
12123    if (example != null)
12124      res.setExample(example);
12125    if (json.has("relativePath"))
12126      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
12127    if (json.has("_relativePath"))
12128      parseElementProperties(json.getAsJsonObject("_relativePath"), res.getRelativePathElement());
12129  }
12130
12131  protected ImplementationGuide.ImplementationGuideManifestPageComponent parseImplementationGuideImplementationGuideManifestPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
12132    ImplementationGuide.ImplementationGuideManifestPageComponent res = new ImplementationGuide.ImplementationGuideManifestPageComponent();
12133    parseImplementationGuideImplementationGuideManifestPageComponentProperties(json, owner, res);
12134    return res;
12135  }
12136
12137  protected void parseImplementationGuideImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestPageComponent res) throws IOException, FHIRFormatError {
12138    parseBackboneElementProperties(json, res);
12139    if (json.has("name"))
12140      res.setNameElement(parseString(json.get("name").getAsString()));
12141    if (json.has("_name"))
12142      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12143    if (json.has("title"))
12144      res.setTitleElement(parseString(json.get("title").getAsString()));
12145    if (json.has("_title"))
12146      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12147    if (json.has("anchor")) {
12148      JsonArray array = json.getAsJsonArray("anchor");
12149      for (int i = 0; i < array.size(); i++) {
12150        res.getAnchor().add(parseString(array.get(i).getAsString()));
12151      }
12152    };
12153    if (json.has("_anchor")) {
12154      JsonArray array = json.getAsJsonArray("_anchor");
12155      for (int i = 0; i < array.size(); i++) {
12156        if (i == res.getAnchor().size())
12157          res.getAnchor().add(parseString(null));
12158        if (array.get(i) instanceof JsonObject) 
12159          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
12160      }
12161    };
12162  }
12163
12164  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
12165    Invoice res = new Invoice();
12166    parseInvoiceProperties(json, res);
12167    return res;
12168  }
12169
12170  protected void parseInvoiceProperties(JsonObject json, Invoice res) throws IOException, FHIRFormatError {
12171    parseDomainResourceProperties(json, res);
12172    if (json.has("identifier")) {
12173      JsonArray array = json.getAsJsonArray("identifier");
12174      for (int i = 0; i < array.size(); i++) {
12175        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12176      }
12177    };
12178    if (json.has("status"))
12179      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
12180    if (json.has("_status"))
12181      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12182    if (json.has("cancelledReason"))
12183      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
12184    if (json.has("_cancelledReason"))
12185      parseElementProperties(json.getAsJsonObject("_cancelledReason"), res.getCancelledReasonElement());
12186    if (json.has("type"))
12187      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12188    if (json.has("subject"))
12189      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12190    if (json.has("recipient"))
12191      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
12192    if (json.has("date"))
12193      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12194    if (json.has("_date"))
12195      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12196    if (json.has("participant")) {
12197      JsonArray array = json.getAsJsonArray("participant");
12198      for (int i = 0; i < array.size(); i++) {
12199        res.getParticipant().add(parseInvoiceInvoiceParticipantComponent(array.get(i).getAsJsonObject(), res));
12200      }
12201    };
12202    if (json.has("issuer"))
12203      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
12204    if (json.has("account"))
12205      res.setAccount(parseReference(json.getAsJsonObject("account")));
12206    if (json.has("lineItem")) {
12207      JsonArray array = json.getAsJsonArray("lineItem");
12208      for (int i = 0; i < array.size(); i++) {
12209        res.getLineItem().add(parseInvoiceInvoiceLineItemComponent(array.get(i).getAsJsonObject(), res));
12210      }
12211    };
12212    if (json.has("totalPriceComponent")) {
12213      JsonArray array = json.getAsJsonArray("totalPriceComponent");
12214      for (int i = 0; i < array.size(); i++) {
12215        res.getTotalPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), res));
12216      }
12217    };
12218    if (json.has("totalNet"))
12219      res.setTotalNet(parseMoney(json.getAsJsonObject("totalNet")));
12220    if (json.has("totalGross"))
12221      res.setTotalGross(parseMoney(json.getAsJsonObject("totalGross")));
12222    if (json.has("paymentTerms"))
12223      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
12224    if (json.has("_paymentTerms"))
12225      parseElementProperties(json.getAsJsonObject("_paymentTerms"), res.getPaymentTermsElement());
12226    if (json.has("note")) {
12227      JsonArray array = json.getAsJsonArray("note");
12228      for (int i = 0; i < array.size(); i++) {
12229        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12230      }
12231    };
12232  }
12233
12234  protected Invoice.InvoiceParticipantComponent parseInvoiceInvoiceParticipantComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
12235    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
12236    parseInvoiceInvoiceParticipantComponentProperties(json, owner, res);
12237    return res;
12238  }
12239
12240  protected void parseInvoiceInvoiceParticipantComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
12241    parseBackboneElementProperties(json, res);
12242    if (json.has("role"))
12243      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
12244    if (json.has("actor"))
12245      res.setActor(parseReference(json.getAsJsonObject("actor")));
12246  }
12247
12248  protected Invoice.InvoiceLineItemComponent parseInvoiceInvoiceLineItemComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
12249    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
12250    parseInvoiceInvoiceLineItemComponentProperties(json, owner, res);
12251    return res;
12252  }
12253
12254  protected void parseInvoiceInvoiceLineItemComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
12255    parseBackboneElementProperties(json, res);
12256    if (json.has("sequence"))
12257      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12258    if (json.has("_sequence"))
12259      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12260    if (json.has("chargeItem"))
12261      res.setChargeItem(parseReference(json.getAsJsonObject("chargeItem")));
12262    if (json.has("priceComponent")) {
12263      JsonArray array = json.getAsJsonArray("priceComponent");
12264      for (int i = 0; i < array.size(); i++) {
12265        res.getPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
12266      }
12267    };
12268  }
12269
12270  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceInvoiceLineItemPriceComponentComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
12271    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
12272    parseInvoiceInvoiceLineItemPriceComponentComponentProperties(json, owner, res);
12273    return res;
12274  }
12275
12276  protected void parseInvoiceInvoiceLineItemPriceComponentComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemPriceComponentComponent res) throws IOException, FHIRFormatError {
12277    parseBackboneElementProperties(json, res);
12278    if (json.has("type"))
12279      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Invoice.InvoicePriceComponentType.NULL, new Invoice.InvoicePriceComponentTypeEnumFactory()));
12280    if (json.has("_type"))
12281      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12282    if (json.has("code"))
12283      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12284    if (json.has("factor"))
12285      res.setFactor(parseMoney(json.getAsJsonObject("factor")));
12286    if (json.has("amount"))
12287      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
12288    if (json.has("_amount"))
12289      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
12290  }
12291
12292  protected ItemInstance parseItemInstance(JsonObject json) throws IOException, FHIRFormatError {
12293    ItemInstance res = new ItemInstance();
12294    parseItemInstanceProperties(json, res);
12295    return res;
12296  }
12297
12298  protected void parseItemInstanceProperties(JsonObject json, ItemInstance res) throws IOException, FHIRFormatError {
12299    parseDomainResourceProperties(json, res);
12300    if (json.has("count"))
12301      res.setCountElement(parseInteger(json.get("count").getAsLong()));
12302    if (json.has("_count"))
12303      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
12304    if (json.has("location"))
12305      res.setLocation(parseReference(json.getAsJsonObject("location")));
12306    if (json.has("subject"))
12307      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12308    if (json.has("manufactureDate"))
12309      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
12310    if (json.has("_manufactureDate"))
12311      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
12312    if (json.has("expiryDate"))
12313      res.setExpiryDateElement(parseDateTime(json.get("expiryDate").getAsString()));
12314    if (json.has("_expiryDate"))
12315      parseElementProperties(json.getAsJsonObject("_expiryDate"), res.getExpiryDateElement());
12316    if (json.has("currentSWVersion"))
12317      res.setCurrentSWVersionElement(parseString(json.get("currentSWVersion").getAsString()));
12318    if (json.has("_currentSWVersion"))
12319      parseElementProperties(json.getAsJsonObject("_currentSWVersion"), res.getCurrentSWVersionElement());
12320    if (json.has("lotNumber"))
12321      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
12322    if (json.has("_lotNumber"))
12323      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
12324    if (json.has("serialNumber"))
12325      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
12326    if (json.has("_serialNumber"))
12327      parseElementProperties(json.getAsJsonObject("_serialNumber"), res.getSerialNumberElement());
12328    if (json.has("carrierAIDC"))
12329      res.setCarrierAIDCElement(parseString(json.get("carrierAIDC").getAsString()));
12330    if (json.has("_carrierAIDC"))
12331      parseElementProperties(json.getAsJsonObject("_carrierAIDC"), res.getCarrierAIDCElement());
12332    if (json.has("carrierHRF"))
12333      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
12334    if (json.has("_carrierHRF"))
12335      parseElementProperties(json.getAsJsonObject("_carrierHRF"), res.getCarrierHRFElement());
12336  }
12337
12338  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
12339    Library res = new Library();
12340    parseLibraryProperties(json, res);
12341    return res;
12342  }
12343
12344  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
12345    parseDomainResourceProperties(json, res);
12346    if (json.has("url"))
12347      res.setUrlElement(parseUri(json.get("url").getAsString()));
12348    if (json.has("_url"))
12349      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12350    if (json.has("identifier")) {
12351      JsonArray array = json.getAsJsonArray("identifier");
12352      for (int i = 0; i < array.size(); i++) {
12353        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12354      }
12355    };
12356    if (json.has("version"))
12357      res.setVersionElement(parseString(json.get("version").getAsString()));
12358    if (json.has("_version"))
12359      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12360    if (json.has("name"))
12361      res.setNameElement(parseString(json.get("name").getAsString()));
12362    if (json.has("_name"))
12363      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12364    if (json.has("title"))
12365      res.setTitleElement(parseString(json.get("title").getAsString()));
12366    if (json.has("_title"))
12367      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12368    if (json.has("subtitle"))
12369      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
12370    if (json.has("_subtitle"))
12371      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
12372    if (json.has("status"))
12373      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12374    if (json.has("_status"))
12375      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12376    if (json.has("experimental"))
12377      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12378    if (json.has("_experimental"))
12379      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
12380    if (json.has("type"))
12381      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12382    Type subject = parseType("subject", json);
12383    if (subject != null)
12384      res.setSubject(subject);
12385    if (json.has("date"))
12386      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12387    if (json.has("_date"))
12388      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12389    if (json.has("publisher"))
12390      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12391    if (json.has("_publisher"))
12392      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12393    if (json.has("contact")) {
12394      JsonArray array = json.getAsJsonArray("contact");
12395      for (int i = 0; i < array.size(); i++) {
12396        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12397      }
12398    };
12399    if (json.has("description"))
12400      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12401    if (json.has("_description"))
12402      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12403    if (json.has("useContext")) {
12404      JsonArray array = json.getAsJsonArray("useContext");
12405      for (int i = 0; i < array.size(); i++) {
12406        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12407      }
12408    };
12409    if (json.has("jurisdiction")) {
12410      JsonArray array = json.getAsJsonArray("jurisdiction");
12411      for (int i = 0; i < array.size(); i++) {
12412        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12413      }
12414    };
12415    if (json.has("purpose"))
12416      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12417    if (json.has("_purpose"))
12418      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12419    if (json.has("usage"))
12420      res.setUsageElement(parseString(json.get("usage").getAsString()));
12421    if (json.has("_usage"))
12422      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
12423    if (json.has("copyright"))
12424      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12425    if (json.has("_copyright"))
12426      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
12427    if (json.has("approvalDate"))
12428      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
12429    if (json.has("_approvalDate"))
12430      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
12431    if (json.has("lastReviewDate"))
12432      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
12433    if (json.has("_lastReviewDate"))
12434      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
12435    if (json.has("effectivePeriod"))
12436      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
12437    if (json.has("topic")) {
12438      JsonArray array = json.getAsJsonArray("topic");
12439      for (int i = 0; i < array.size(); i++) {
12440        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12441      }
12442    };
12443    if (json.has("contributor")) {
12444      JsonArray array = json.getAsJsonArray("contributor");
12445      for (int i = 0; i < array.size(); i++) {
12446        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
12447      }
12448    };
12449    if (json.has("relatedArtifact")) {
12450      JsonArray array = json.getAsJsonArray("relatedArtifact");
12451      for (int i = 0; i < array.size(); i++) {
12452        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12453      }
12454    };
12455    if (json.has("parameter")) {
12456      JsonArray array = json.getAsJsonArray("parameter");
12457      for (int i = 0; i < array.size(); i++) {
12458        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
12459      }
12460    };
12461    if (json.has("dataRequirement")) {
12462      JsonArray array = json.getAsJsonArray("dataRequirement");
12463      for (int i = 0; i < array.size(); i++) {
12464        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
12465      }
12466    };
12467    if (json.has("content")) {
12468      JsonArray array = json.getAsJsonArray("content");
12469      for (int i = 0; i < array.size(); i++) {
12470        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
12471      }
12472    };
12473  }
12474
12475  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
12476    Linkage res = new Linkage();
12477    parseLinkageProperties(json, res);
12478    return res;
12479  }
12480
12481  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
12482    parseDomainResourceProperties(json, res);
12483    if (json.has("active"))
12484      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
12485    if (json.has("_active"))
12486      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
12487    if (json.has("author"))
12488      res.setAuthor(parseReference(json.getAsJsonObject("author")));
12489    if (json.has("item")) {
12490      JsonArray array = json.getAsJsonArray("item");
12491      for (int i = 0; i < array.size(); i++) {
12492        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
12493      }
12494    };
12495  }
12496
12497  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
12498    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
12499    parseLinkageLinkageItemComponentProperties(json, owner, res);
12500    return res;
12501  }
12502
12503  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
12504    parseBackboneElementProperties(json, res);
12505    if (json.has("type"))
12506      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
12507    if (json.has("_type"))
12508      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12509    if (json.has("resource"))
12510      res.setResource(parseReference(json.getAsJsonObject("resource")));
12511  }
12512
12513  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
12514    ListResource res = new ListResource();
12515    parseListResourceProperties(json, res);
12516    return res;
12517  }
12518
12519  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
12520    parseDomainResourceProperties(json, res);
12521    if (json.has("identifier")) {
12522      JsonArray array = json.getAsJsonArray("identifier");
12523      for (int i = 0; i < array.size(); i++) {
12524        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12525      }
12526    };
12527    if (json.has("status"))
12528      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
12529    if (json.has("_status"))
12530      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12531    if (json.has("mode"))
12532      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
12533    if (json.has("_mode"))
12534      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
12535    if (json.has("title"))
12536      res.setTitleElement(parseString(json.get("title").getAsString()));
12537    if (json.has("_title"))
12538      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12539    if (json.has("code"))
12540      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12541    if (json.has("subject"))
12542      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12543    if (json.has("encounter"))
12544      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
12545    if (json.has("date"))
12546      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12547    if (json.has("_date"))
12548      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12549    if (json.has("source"))
12550      res.setSource(parseReference(json.getAsJsonObject("source")));
12551    if (json.has("orderedBy"))
12552      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
12553    if (json.has("note")) {
12554      JsonArray array = json.getAsJsonArray("note");
12555      for (int i = 0; i < array.size(); i++) {
12556        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12557      }
12558    };
12559    if (json.has("entry")) {
12560      JsonArray array = json.getAsJsonArray("entry");
12561      for (int i = 0; i < array.size(); i++) {
12562        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
12563      }
12564    };
12565    if (json.has("emptyReason"))
12566      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
12567  }
12568
12569  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
12570    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
12571    parseListResourceListEntryComponentProperties(json, owner, res);
12572    return res;
12573  }
12574
12575  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner, ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
12576    parseBackboneElementProperties(json, res);
12577    if (json.has("flag"))
12578      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
12579    if (json.has("deleted"))
12580      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
12581    if (json.has("_deleted"))
12582      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
12583    if (json.has("date"))
12584      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12585    if (json.has("_date"))
12586      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12587    if (json.has("item"))
12588      res.setItem(parseReference(json.getAsJsonObject("item")));
12589  }
12590
12591  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
12592    Location res = new Location();
12593    parseLocationProperties(json, res);
12594    return res;
12595  }
12596
12597  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
12598    parseDomainResourceProperties(json, res);
12599    if (json.has("identifier")) {
12600      JsonArray array = json.getAsJsonArray("identifier");
12601      for (int i = 0; i < array.size(); i++) {
12602        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12603      }
12604    };
12605    if (json.has("status"))
12606      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
12607    if (json.has("_status"))
12608      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12609    if (json.has("operationalStatus"))
12610      res.setOperationalStatus(parseCoding(json.getAsJsonObject("operationalStatus")));
12611    if (json.has("name"))
12612      res.setNameElement(parseString(json.get("name").getAsString()));
12613    if (json.has("_name"))
12614      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12615    if (json.has("alias")) {
12616      JsonArray array = json.getAsJsonArray("alias");
12617      for (int i = 0; i < array.size(); i++) {
12618        res.getAlias().add(parseString(array.get(i).getAsString()));
12619      }
12620    };
12621    if (json.has("_alias")) {
12622      JsonArray array = json.getAsJsonArray("_alias");
12623      for (int i = 0; i < array.size(); i++) {
12624        if (i == res.getAlias().size())
12625          res.getAlias().add(parseString(null));
12626        if (array.get(i) instanceof JsonObject) 
12627          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
12628      }
12629    };
12630    if (json.has("description"))
12631      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12632    if (json.has("_description"))
12633      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12634    if (json.has("mode"))
12635      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
12636    if (json.has("_mode"))
12637      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
12638    if (json.has("type")) {
12639      JsonArray array = json.getAsJsonArray("type");
12640      for (int i = 0; i < array.size(); i++) {
12641        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12642      }
12643    };
12644    if (json.has("telecom")) {
12645      JsonArray array = json.getAsJsonArray("telecom");
12646      for (int i = 0; i < array.size(); i++) {
12647        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
12648      }
12649    };
12650    if (json.has("address"))
12651      res.setAddress(parseAddress(json.getAsJsonObject("address")));
12652    if (json.has("physicalType"))
12653      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
12654    if (json.has("position"))
12655      res.setPosition(parseLocationLocationPositionComponent(json.getAsJsonObject("position"), res));
12656    if (json.has("managingOrganization"))
12657      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
12658    if (json.has("partOf"))
12659      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
12660    if (json.has("hoursOfOperation")) {
12661      JsonArray array = json.getAsJsonArray("hoursOfOperation");
12662      for (int i = 0; i < array.size(); i++) {
12663        res.getHoursOfOperation().add(parseLocationLocationHoursOfOperationComponent(array.get(i).getAsJsonObject(), res));
12664      }
12665    };
12666    if (json.has("availabilityExceptions"))
12667      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
12668    if (json.has("_availabilityExceptions"))
12669      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
12670    if (json.has("endpoint")) {
12671      JsonArray array = json.getAsJsonArray("endpoint");
12672      for (int i = 0; i < array.size(); i++) {
12673        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
12674      }
12675    };
12676  }
12677
12678  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
12679    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
12680    parseLocationLocationPositionComponentProperties(json, owner, res);
12681    return res;
12682  }
12683
12684  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
12685    parseBackboneElementProperties(json, res);
12686    if (json.has("longitude"))
12687      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
12688    if (json.has("_longitude"))
12689      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
12690    if (json.has("latitude"))
12691      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
12692    if (json.has("_latitude"))
12693      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
12694    if (json.has("altitude"))
12695      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
12696    if (json.has("_altitude"))
12697      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
12698  }
12699
12700  protected Location.LocationHoursOfOperationComponent parseLocationLocationHoursOfOperationComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
12701    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
12702    parseLocationLocationHoursOfOperationComponentProperties(json, owner, res);
12703    return res;
12704  }
12705
12706  protected void parseLocationLocationHoursOfOperationComponentProperties(JsonObject json, Location owner, Location.LocationHoursOfOperationComponent res) throws IOException, FHIRFormatError {
12707    parseBackboneElementProperties(json, res);
12708    if (json.has("daysOfWeek")) {
12709      JsonArray array = json.getAsJsonArray("daysOfWeek");
12710      for (int i = 0; i < array.size(); i++) {
12711        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
12712      }
12713    };
12714    if (json.has("_daysOfWeek")) {
12715      JsonArray array = json.getAsJsonArray("_daysOfWeek");
12716      for (int i = 0; i < array.size(); i++) {
12717        if (i == res.getDaysOfWeek().size())
12718          res.getDaysOfWeek().add(parseEnumeration(null, Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
12719        if (array.get(i) instanceof JsonObject) 
12720          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
12721      }
12722    };
12723    if (json.has("allDay"))
12724      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
12725    if (json.has("_allDay"))
12726      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
12727    if (json.has("openingTime"))
12728      res.setOpeningTimeElement(parseTime(json.get("openingTime").getAsString()));
12729    if (json.has("_openingTime"))
12730      parseElementProperties(json.getAsJsonObject("_openingTime"), res.getOpeningTimeElement());
12731    if (json.has("closingTime"))
12732      res.setClosingTimeElement(parseTime(json.get("closingTime").getAsString()));
12733    if (json.has("_closingTime"))
12734      parseElementProperties(json.getAsJsonObject("_closingTime"), res.getClosingTimeElement());
12735  }
12736
12737  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
12738    Measure res = new Measure();
12739    parseMeasureProperties(json, res);
12740    return res;
12741  }
12742
12743  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
12744    parseDomainResourceProperties(json, res);
12745    if (json.has("url"))
12746      res.setUrlElement(parseUri(json.get("url").getAsString()));
12747    if (json.has("_url"))
12748      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12749    if (json.has("identifier")) {
12750      JsonArray array = json.getAsJsonArray("identifier");
12751      for (int i = 0; i < array.size(); i++) {
12752        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12753      }
12754    };
12755    if (json.has("version"))
12756      res.setVersionElement(parseString(json.get("version").getAsString()));
12757    if (json.has("_version"))
12758      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12759    if (json.has("name"))
12760      res.setNameElement(parseString(json.get("name").getAsString()));
12761    if (json.has("_name"))
12762      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12763    if (json.has("title"))
12764      res.setTitleElement(parseString(json.get("title").getAsString()));
12765    if (json.has("_title"))
12766      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12767    if (json.has("subtitle"))
12768      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
12769    if (json.has("_subtitle"))
12770      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
12771    if (json.has("status"))
12772      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12773    if (json.has("_status"))
12774      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12775    if (json.has("experimental"))
12776      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12777    if (json.has("_experimental"))
12778      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
12779    Type subject = parseType("subject", json);
12780    if (subject != null)
12781      res.setSubject(subject);
12782    if (json.has("date"))
12783      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12784    if (json.has("_date"))
12785      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12786    if (json.has("publisher"))
12787      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12788    if (json.has("_publisher"))
12789      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12790    if (json.has("contact")) {
12791      JsonArray array = json.getAsJsonArray("contact");
12792      for (int i = 0; i < array.size(); i++) {
12793        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12794      }
12795    };
12796    if (json.has("description"))
12797      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12798    if (json.has("_description"))
12799      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12800    if (json.has("useContext")) {
12801      JsonArray array = json.getAsJsonArray("useContext");
12802      for (int i = 0; i < array.size(); i++) {
12803        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12804      }
12805    };
12806    if (json.has("jurisdiction")) {
12807      JsonArray array = json.getAsJsonArray("jurisdiction");
12808      for (int i = 0; i < array.size(); i++) {
12809        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12810      }
12811    };
12812    if (json.has("purpose"))
12813      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12814    if (json.has("_purpose"))
12815      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12816    if (json.has("usage"))
12817      res.setUsageElement(parseString(json.get("usage").getAsString()));
12818    if (json.has("_usage"))
12819      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
12820    if (json.has("copyright"))
12821      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12822    if (json.has("_copyright"))
12823      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
12824    if (json.has("approvalDate"))
12825      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
12826    if (json.has("_approvalDate"))
12827      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
12828    if (json.has("lastReviewDate"))
12829      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
12830    if (json.has("_lastReviewDate"))
12831      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
12832    if (json.has("effectivePeriod"))
12833      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
12834    if (json.has("topic")) {
12835      JsonArray array = json.getAsJsonArray("topic");
12836      for (int i = 0; i < array.size(); i++) {
12837        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12838      }
12839    };
12840    if (json.has("contributor")) {
12841      JsonArray array = json.getAsJsonArray("contributor");
12842      for (int i = 0; i < array.size(); i++) {
12843        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
12844      }
12845    };
12846    if (json.has("relatedArtifact")) {
12847      JsonArray array = json.getAsJsonArray("relatedArtifact");
12848      for (int i = 0; i < array.size(); i++) {
12849        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
12850      }
12851    };
12852    if (json.has("library")) {
12853      JsonArray array = json.getAsJsonArray("library");
12854      for (int i = 0; i < array.size(); i++) {
12855        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
12856      }
12857    };
12858    if (json.has("_library")) {
12859      JsonArray array = json.getAsJsonArray("_library");
12860      for (int i = 0; i < array.size(); i++) {
12861        if (i == res.getLibrary().size())
12862          res.getLibrary().add(parseCanonical(null));
12863        if (array.get(i) instanceof JsonObject) 
12864          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
12865      }
12866    };
12867    if (json.has("disclaimer"))
12868      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
12869    if (json.has("_disclaimer"))
12870      parseElementProperties(json.getAsJsonObject("_disclaimer"), res.getDisclaimerElement());
12871    if (json.has("scoring"))
12872      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
12873    if (json.has("compositeScoring"))
12874      res.setCompositeScoring(parseCodeableConcept(json.getAsJsonObject("compositeScoring")));
12875    if (json.has("type")) {
12876      JsonArray array = json.getAsJsonArray("type");
12877      for (int i = 0; i < array.size(); i++) {
12878        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12879      }
12880    };
12881    if (json.has("riskAdjustment"))
12882      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
12883    if (json.has("_riskAdjustment"))
12884      parseElementProperties(json.getAsJsonObject("_riskAdjustment"), res.getRiskAdjustmentElement());
12885    if (json.has("rateAggregation"))
12886      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
12887    if (json.has("_rateAggregation"))
12888      parseElementProperties(json.getAsJsonObject("_rateAggregation"), res.getRateAggregationElement());
12889    if (json.has("rationale"))
12890      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
12891    if (json.has("_rationale"))
12892      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
12893    if (json.has("clinicalRecommendationStatement"))
12894      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
12895    if (json.has("_clinicalRecommendationStatement"))
12896      parseElementProperties(json.getAsJsonObject("_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
12897    if (json.has("improvementNotation"))
12898      res.setImprovementNotationElement(parseString(json.get("improvementNotation").getAsString()));
12899    if (json.has("_improvementNotation"))
12900      parseElementProperties(json.getAsJsonObject("_improvementNotation"), res.getImprovementNotationElement());
12901    if (json.has("definition")) {
12902      JsonArray array = json.getAsJsonArray("definition");
12903      for (int i = 0; i < array.size(); i++) {
12904        res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
12905      }
12906    };
12907    if (json.has("_definition")) {
12908      JsonArray array = json.getAsJsonArray("_definition");
12909      for (int i = 0; i < array.size(); i++) {
12910        if (i == res.getDefinition().size())
12911          res.getDefinition().add(parseMarkdown(null));
12912        if (array.get(i) instanceof JsonObject) 
12913          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
12914      }
12915    };
12916    if (json.has("guidance"))
12917      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
12918    if (json.has("_guidance"))
12919      parseElementProperties(json.getAsJsonObject("_guidance"), res.getGuidanceElement());
12920    if (json.has("set"))
12921      res.setSetElement(parseString(json.get("set").getAsString()));
12922    if (json.has("_set"))
12923      parseElementProperties(json.getAsJsonObject("_set"), res.getSetElement());
12924    if (json.has("group")) {
12925      JsonArray array = json.getAsJsonArray("group");
12926      for (int i = 0; i < array.size(); i++) {
12927        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
12928      }
12929    };
12930    if (json.has("supplementalData")) {
12931      JsonArray array = json.getAsJsonArray("supplementalData");
12932      for (int i = 0; i < array.size(); i++) {
12933        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
12934      }
12935    };
12936  }
12937
12938  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
12939    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
12940    parseMeasureMeasureGroupComponentProperties(json, owner, res);
12941    return res;
12942  }
12943
12944  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
12945    parseBackboneElementProperties(json, res);
12946    if (json.has("code"))
12947      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12948    if (json.has("description"))
12949      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12950    if (json.has("_description"))
12951      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12952    if (json.has("population")) {
12953      JsonArray array = json.getAsJsonArray("population");
12954      for (int i = 0; i < array.size(); i++) {
12955        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
12956      }
12957    };
12958    if (json.has("stratifier")) {
12959      JsonArray array = json.getAsJsonArray("stratifier");
12960      for (int i = 0; i < array.size(); i++) {
12961        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
12962      }
12963    };
12964  }
12965
12966  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
12967    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
12968    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
12969    return res;
12970  }
12971
12972  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
12973    parseBackboneElementProperties(json, res);
12974    if (json.has("code"))
12975      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12976    if (json.has("description"))
12977      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12978    if (json.has("_description"))
12979      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12980    if (json.has("criteria"))
12981      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
12982    if (json.has("_criteria"))
12983      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
12984  }
12985
12986  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
12987    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
12988    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
12989    return res;
12990  }
12991
12992  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
12993    parseBackboneElementProperties(json, res);
12994    if (json.has("code"))
12995      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12996    if (json.has("description"))
12997      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12998    if (json.has("_description"))
12999      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13000    if (json.has("criteria"))
13001      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
13002    if (json.has("_criteria"))
13003      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
13004    if (json.has("path"))
13005      res.setPathElement(parseString(json.get("path").getAsString()));
13006    if (json.has("_path"))
13007      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
13008  }
13009
13010  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
13011    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
13012    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
13013    return res;
13014  }
13015
13016  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
13017    parseBackboneElementProperties(json, res);
13018    if (json.has("code"))
13019      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13020    if (json.has("usage")) {
13021      JsonArray array = json.getAsJsonArray("usage");
13022      for (int i = 0; i < array.size(); i++) {
13023        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13024      }
13025    };
13026    if (json.has("description"))
13027      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13028    if (json.has("_description"))
13029      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13030    if (json.has("criteria"))
13031      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
13032    if (json.has("_criteria"))
13033      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
13034    if (json.has("path"))
13035      res.setPathElement(parseString(json.get("path").getAsString()));
13036    if (json.has("_path"))
13037      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
13038  }
13039
13040  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
13041    MeasureReport res = new MeasureReport();
13042    parseMeasureReportProperties(json, res);
13043    return res;
13044  }
13045
13046  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
13047    parseDomainResourceProperties(json, res);
13048    if (json.has("identifier")) {
13049      JsonArray array = json.getAsJsonArray("identifier");
13050      for (int i = 0; i < array.size(); i++) {
13051        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13052      }
13053    };
13054    if (json.has("status"))
13055      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
13056    if (json.has("_status"))
13057      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13058    if (json.has("type"))
13059      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
13060    if (json.has("_type"))
13061      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13062    if (json.has("measure"))
13063      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
13064    if (json.has("_measure"))
13065      parseElementProperties(json.getAsJsonObject("_measure"), res.getMeasureElement());
13066    if (json.has("subject"))
13067      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13068    if (json.has("date"))
13069      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13070    if (json.has("_date"))
13071      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13072    if (json.has("reporter"))
13073      res.setReporter(parseReference(json.getAsJsonObject("reporter")));
13074    if (json.has("period"))
13075      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13076    if (json.has("group")) {
13077      JsonArray array = json.getAsJsonArray("group");
13078      for (int i = 0; i < array.size(); i++) {
13079        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
13080      }
13081    };
13082    if (json.has("evaluatedResources"))
13083      res.setEvaluatedResources(parseReference(json.getAsJsonObject("evaluatedResources")));
13084  }
13085
13086  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
13087    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
13088    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
13089    return res;
13090  }
13091
13092  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
13093    parseBackboneElementProperties(json, res);
13094    if (json.has("code"))
13095      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13096    if (json.has("population")) {
13097      JsonArray array = json.getAsJsonArray("population");
13098      for (int i = 0; i < array.size(); i++) {
13099        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
13100      }
13101    };
13102    if (json.has("measureScore"))
13103      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
13104    if (json.has("stratifier")) {
13105      JsonArray array = json.getAsJsonArray("stratifier");
13106      for (int i = 0; i < array.size(); i++) {
13107        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
13108      }
13109    };
13110  }
13111
13112  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
13113    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
13114    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
13115    return res;
13116  }
13117
13118  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
13119    parseBackboneElementProperties(json, res);
13120    if (json.has("code"))
13121      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13122    if (json.has("count"))
13123      res.setCountElement(parseInteger(json.get("count").getAsLong()));
13124    if (json.has("_count"))
13125      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
13126    if (json.has("subjects"))
13127      res.setSubjects(parseReference(json.getAsJsonObject("subjects")));
13128  }
13129
13130  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
13131    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
13132    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
13133    return res;
13134  }
13135
13136  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
13137    parseBackboneElementProperties(json, res);
13138    if (json.has("code"))
13139      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13140    if (json.has("stratum")) {
13141      JsonArray array = json.getAsJsonArray("stratum");
13142      for (int i = 0; i < array.size(); i++) {
13143        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
13144      }
13145    };
13146  }
13147
13148  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
13149    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
13150    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
13151    return res;
13152  }
13153
13154  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
13155    parseBackboneElementProperties(json, res);
13156    if (json.has("value"))
13157      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
13158    if (json.has("population")) {
13159      JsonArray array = json.getAsJsonArray("population");
13160      for (int i = 0; i < array.size(); i++) {
13161        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
13162      }
13163    };
13164    if (json.has("measureScore"))
13165      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
13166  }
13167
13168  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
13169    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
13170    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
13171    return res;
13172  }
13173
13174  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
13175    parseBackboneElementProperties(json, res);
13176    if (json.has("code"))
13177      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13178    if (json.has("count"))
13179      res.setCountElement(parseInteger(json.get("count").getAsLong()));
13180    if (json.has("_count"))
13181      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
13182    if (json.has("subjects"))
13183      res.setSubjects(parseReference(json.getAsJsonObject("subjects")));
13184  }
13185
13186  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
13187    Media res = new Media();
13188    parseMediaProperties(json, res);
13189    return res;
13190  }
13191
13192  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
13193    parseDomainResourceProperties(json, res);
13194    if (json.has("identifier")) {
13195      JsonArray array = json.getAsJsonArray("identifier");
13196      for (int i = 0; i < array.size(); i++) {
13197        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13198      }
13199    };
13200    if (json.has("basedOn")) {
13201      JsonArray array = json.getAsJsonArray("basedOn");
13202      for (int i = 0; i < array.size(); i++) {
13203        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13204      }
13205    };
13206    if (json.has("partOf")) {
13207      JsonArray array = json.getAsJsonArray("partOf");
13208      for (int i = 0; i < array.size(); i++) {
13209        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
13210      }
13211    };
13212    if (json.has("status"))
13213      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Media.MediaStatus.NULL, new Media.MediaStatusEnumFactory()));
13214    if (json.has("_status"))
13215      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13216    if (json.has("type"))
13217      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13218    if (json.has("modality"))
13219      res.setModality(parseCodeableConcept(json.getAsJsonObject("modality")));
13220    if (json.has("view"))
13221      res.setView(parseCodeableConcept(json.getAsJsonObject("view")));
13222    if (json.has("subject"))
13223      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13224    if (json.has("context"))
13225      res.setContext(parseReference(json.getAsJsonObject("context")));
13226    Type created = parseType("created", json);
13227    if (created != null)
13228      res.setCreated(created);
13229    if (json.has("issued"))
13230      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
13231    if (json.has("_issued"))
13232      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
13233    if (json.has("operator"))
13234      res.setOperator(parseReference(json.getAsJsonObject("operator")));
13235    if (json.has("reasonCode")) {
13236      JsonArray array = json.getAsJsonArray("reasonCode");
13237      for (int i = 0; i < array.size(); i++) {
13238        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13239      }
13240    };
13241    if (json.has("bodySite"))
13242      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
13243    if (json.has("deviceName"))
13244      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
13245    if (json.has("_deviceName"))
13246      parseElementProperties(json.getAsJsonObject("_deviceName"), res.getDeviceNameElement());
13247    if (json.has("device"))
13248      res.setDevice(parseReference(json.getAsJsonObject("device")));
13249    if (json.has("height"))
13250      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
13251    if (json.has("_height"))
13252      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
13253    if (json.has("width"))
13254      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
13255    if (json.has("_width"))
13256      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
13257    if (json.has("frames"))
13258      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
13259    if (json.has("_frames"))
13260      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
13261    if (json.has("duration"))
13262      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
13263    if (json.has("_duration"))
13264      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
13265    if (json.has("content"))
13266      res.setContent(parseAttachment(json.getAsJsonObject("content")));
13267    if (json.has("note")) {
13268      JsonArray array = json.getAsJsonArray("note");
13269      for (int i = 0; i < array.size(); i++) {
13270        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13271      }
13272    };
13273  }
13274
13275  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
13276    Medication res = new Medication();
13277    parseMedicationProperties(json, res);
13278    return res;
13279  }
13280
13281  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
13282    parseDomainResourceProperties(json, res);
13283    if (json.has("code"))
13284      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13285    if (json.has("status"))
13286      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
13287    if (json.has("_status"))
13288      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13289    if (json.has("manufacturer"))
13290      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
13291    if (json.has("form"))
13292      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
13293    if (json.has("amount"))
13294      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
13295    if (json.has("ingredient")) {
13296      JsonArray array = json.getAsJsonArray("ingredient");
13297      for (int i = 0; i < array.size(); i++) {
13298        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
13299      }
13300    };
13301    if (json.has("batch"))
13302      res.setBatch(parseMedicationMedicationBatchComponent(json.getAsJsonObject("batch"), res));
13303  }
13304
13305  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
13306    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
13307    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
13308    return res;
13309  }
13310
13311  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
13312    parseBackboneElementProperties(json, res);
13313    Type item = parseType("item", json);
13314    if (item != null)
13315      res.setItem(item);
13316    if (json.has("isActive"))
13317      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
13318    if (json.has("_isActive"))
13319      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
13320    if (json.has("amount"))
13321      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
13322  }
13323
13324  protected Medication.MedicationBatchComponent parseMedicationMedicationBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
13325    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
13326    parseMedicationMedicationBatchComponentProperties(json, owner, res);
13327    return res;
13328  }
13329
13330  protected void parseMedicationMedicationBatchComponentProperties(JsonObject json, Medication owner, Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
13331    parseBackboneElementProperties(json, res);
13332    if (json.has("lotNumber"))
13333      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
13334    if (json.has("_lotNumber"))
13335      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
13336    if (json.has("expirationDate"))
13337      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
13338    if (json.has("_expirationDate"))
13339      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
13340    if (json.has("serialNumber"))
13341      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
13342    if (json.has("_serialNumber"))
13343      parseElementProperties(json.getAsJsonObject("_serialNumber"), res.getSerialNumberElement());
13344  }
13345
13346  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
13347    MedicationAdministration res = new MedicationAdministration();
13348    parseMedicationAdministrationProperties(json, res);
13349    return res;
13350  }
13351
13352  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
13353    parseDomainResourceProperties(json, res);
13354    if (json.has("identifier")) {
13355      JsonArray array = json.getAsJsonArray("identifier");
13356      for (int i = 0; i < array.size(); i++) {
13357        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13358      }
13359    };
13360    if (json.has("instantiates")) {
13361      JsonArray array = json.getAsJsonArray("instantiates");
13362      for (int i = 0; i < array.size(); i++) {
13363        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
13364      }
13365    };
13366    if (json.has("_instantiates")) {
13367      JsonArray array = json.getAsJsonArray("_instantiates");
13368      for (int i = 0; i < array.size(); i++) {
13369        if (i == res.getInstantiates().size())
13370          res.getInstantiates().add(parseUri(null));
13371        if (array.get(i) instanceof JsonObject) 
13372          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
13373      }
13374    };
13375    if (json.has("partOf")) {
13376      JsonArray array = json.getAsJsonArray("partOf");
13377      for (int i = 0; i < array.size(); i++) {
13378        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
13379      }
13380    };
13381    if (json.has("status"))
13382      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
13383    if (json.has("_status"))
13384      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13385    if (json.has("category"))
13386      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13387    Type medication = parseType("medication", json);
13388    if (medication != null)
13389      res.setMedication(medication);
13390    if (json.has("subject"))
13391      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13392    if (json.has("context"))
13393      res.setContext(parseReference(json.getAsJsonObject("context")));
13394    if (json.has("supportingInformation")) {
13395      JsonArray array = json.getAsJsonArray("supportingInformation");
13396      for (int i = 0; i < array.size(); i++) {
13397        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
13398      }
13399    };
13400    Type effective = parseType("effective", json);
13401    if (effective != null)
13402      res.setEffective(effective);
13403    if (json.has("performer")) {
13404      JsonArray array = json.getAsJsonArray("performer");
13405      for (int i = 0; i < array.size(); i++) {
13406        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject(), res));
13407      }
13408    };
13409    if (json.has("statusReason")) {
13410      JsonArray array = json.getAsJsonArray("statusReason");
13411      for (int i = 0; i < array.size(); i++) {
13412        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13413      }
13414    };
13415    if (json.has("reasonCode")) {
13416      JsonArray array = json.getAsJsonArray("reasonCode");
13417      for (int i = 0; i < array.size(); i++) {
13418        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13419      }
13420    };
13421    if (json.has("reasonReference")) {
13422      JsonArray array = json.getAsJsonArray("reasonReference");
13423      for (int i = 0; i < array.size(); i++) {
13424        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13425      }
13426    };
13427    if (json.has("request"))
13428      res.setRequest(parseReference(json.getAsJsonObject("request")));
13429    if (json.has("device")) {
13430      JsonArray array = json.getAsJsonArray("device");
13431      for (int i = 0; i < array.size(); i++) {
13432        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
13433      }
13434    };
13435    if (json.has("note")) {
13436      JsonArray array = json.getAsJsonArray("note");
13437      for (int i = 0; i < array.size(); i++) {
13438        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13439      }
13440    };
13441    if (json.has("dosage"))
13442      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage"), res));
13443    if (json.has("eventHistory")) {
13444      JsonArray array = json.getAsJsonArray("eventHistory");
13445      for (int i = 0; i < array.size(); i++) {
13446        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
13447      }
13448    };
13449  }
13450
13451  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
13452    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
13453    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
13454    return res;
13455  }
13456
13457  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
13458    parseBackboneElementProperties(json, res);
13459    if (json.has("function"))
13460      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
13461    if (json.has("actor"))
13462      res.setActor(parseReference(json.getAsJsonObject("actor")));
13463  }
13464
13465  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
13466    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
13467    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
13468    return res;
13469  }
13470
13471  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
13472    parseBackboneElementProperties(json, res);
13473    if (json.has("text"))
13474      res.setTextElement(parseString(json.get("text").getAsString()));
13475    if (json.has("_text"))
13476      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
13477    if (json.has("site"))
13478      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
13479    if (json.has("route"))
13480      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
13481    if (json.has("method"))
13482      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
13483    if (json.has("dose"))
13484      res.setDose(parseSimpleQuantity(json.getAsJsonObject("dose")));
13485    Type rate = parseType("rate", json);
13486    if (rate != null)
13487      res.setRate(rate);
13488  }
13489
13490  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
13491    MedicationDispense res = new MedicationDispense();
13492    parseMedicationDispenseProperties(json, res);
13493    return res;
13494  }
13495
13496  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
13497    parseDomainResourceProperties(json, res);
13498    if (json.has("identifier")) {
13499      JsonArray array = json.getAsJsonArray("identifier");
13500      for (int i = 0; i < array.size(); i++) {
13501        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13502      }
13503    };
13504    if (json.has("partOf")) {
13505      JsonArray array = json.getAsJsonArray("partOf");
13506      for (int i = 0; i < array.size(); i++) {
13507        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
13508      }
13509    };
13510    if (json.has("status"))
13511      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
13512    if (json.has("_status"))
13513      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13514    if (json.has("category"))
13515      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13516    Type medication = parseType("medication", json);
13517    if (medication != null)
13518      res.setMedication(medication);
13519    if (json.has("subject"))
13520      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13521    if (json.has("context"))
13522      res.setContext(parseReference(json.getAsJsonObject("context")));
13523    if (json.has("supportingInformation")) {
13524      JsonArray array = json.getAsJsonArray("supportingInformation");
13525      for (int i = 0; i < array.size(); i++) {
13526        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
13527      }
13528    };
13529    if (json.has("performer")) {
13530      JsonArray array = json.getAsJsonArray("performer");
13531      for (int i = 0; i < array.size(); i++) {
13532        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
13533      }
13534    };
13535    if (json.has("location"))
13536      res.setLocation(parseReference(json.getAsJsonObject("location")));
13537    if (json.has("authorizingPrescription")) {
13538      JsonArray array = json.getAsJsonArray("authorizingPrescription");
13539      for (int i = 0; i < array.size(); i++) {
13540        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
13541      }
13542    };
13543    if (json.has("type"))
13544      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13545    if (json.has("quantity"))
13546      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
13547    if (json.has("daysSupply"))
13548      res.setDaysSupply(parseSimpleQuantity(json.getAsJsonObject("daysSupply")));
13549    if (json.has("whenPrepared"))
13550      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
13551    if (json.has("_whenPrepared"))
13552      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
13553    if (json.has("whenHandedOver"))
13554      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
13555    if (json.has("_whenHandedOver"))
13556      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
13557    if (json.has("destination"))
13558      res.setDestination(parseReference(json.getAsJsonObject("destination")));
13559    if (json.has("receiver")) {
13560      JsonArray array = json.getAsJsonArray("receiver");
13561      for (int i = 0; i < array.size(); i++) {
13562        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
13563      }
13564    };
13565    if (json.has("note")) {
13566      JsonArray array = json.getAsJsonArray("note");
13567      for (int i = 0; i < array.size(); i++) {
13568        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13569      }
13570    };
13571    if (json.has("dosageInstruction")) {
13572      JsonArray array = json.getAsJsonArray("dosageInstruction");
13573      for (int i = 0; i < array.size(); i++) {
13574        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
13575      }
13576    };
13577    if (json.has("substitution"))
13578      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution"), res));
13579    if (json.has("detectedIssue")) {
13580      JsonArray array = json.getAsJsonArray("detectedIssue");
13581      for (int i = 0; i < array.size(); i++) {
13582        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
13583      }
13584    };
13585    Type statusReason = parseType("statusReason", json);
13586    if (statusReason != null)
13587      res.setStatusReason(statusReason);
13588    if (json.has("eventHistory")) {
13589      JsonArray array = json.getAsJsonArray("eventHistory");
13590      for (int i = 0; i < array.size(); i++) {
13591        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
13592      }
13593    };
13594  }
13595
13596  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
13597    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
13598    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
13599    return res;
13600  }
13601
13602  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
13603    parseBackboneElementProperties(json, res);
13604    if (json.has("function"))
13605      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
13606    if (json.has("actor"))
13607      res.setActor(parseReference(json.getAsJsonObject("actor")));
13608  }
13609
13610  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
13611    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
13612    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
13613    return res;
13614  }
13615
13616  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
13617    parseBackboneElementProperties(json, res);
13618    if (json.has("wasSubstituted"))
13619      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
13620    if (json.has("_wasSubstituted"))
13621      parseElementProperties(json.getAsJsonObject("_wasSubstituted"), res.getWasSubstitutedElement());
13622    if (json.has("type"))
13623      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13624    if (json.has("reason")) {
13625      JsonArray array = json.getAsJsonArray("reason");
13626      for (int i = 0; i < array.size(); i++) {
13627        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13628      }
13629    };
13630    if (json.has("responsibleParty")) {
13631      JsonArray array = json.getAsJsonArray("responsibleParty");
13632      for (int i = 0; i < array.size(); i++) {
13633        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
13634      }
13635    };
13636  }
13637
13638  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
13639    MedicationKnowledge res = new MedicationKnowledge();
13640    parseMedicationKnowledgeProperties(json, res);
13641    return res;
13642  }
13643
13644  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res) throws IOException, FHIRFormatError {
13645    parseDomainResourceProperties(json, res);
13646    if (json.has("code"))
13647      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13648    if (json.has("status"))
13649      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationKnowledge.MedicationKnowledgeStatus.NULL, new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory()));
13650    if (json.has("_status"))
13651      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13652    if (json.has("manufacturer"))
13653      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
13654    if (json.has("form"))
13655      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
13656    if (json.has("amount"))
13657      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
13658    if (json.has("synonym")) {
13659      JsonArray array = json.getAsJsonArray("synonym");
13660      for (int i = 0; i < array.size(); i++) {
13661        res.getSynonym().add(parseString(array.get(i).getAsString()));
13662      }
13663    };
13664    if (json.has("_synonym")) {
13665      JsonArray array = json.getAsJsonArray("_synonym");
13666      for (int i = 0; i < array.size(); i++) {
13667        if (i == res.getSynonym().size())
13668          res.getSynonym().add(parseString(null));
13669        if (array.get(i) instanceof JsonObject) 
13670          parseElementProperties(array.get(i).getAsJsonObject(), res.getSynonym().get(i));
13671      }
13672    };
13673    if (json.has("relatedMedicationKnowledge")) {
13674      JsonArray array = json.getAsJsonArray("relatedMedicationKnowledge");
13675      for (int i = 0; i < array.size(); i++) {
13676        res.getRelatedMedicationKnowledge().add(parseReference(array.get(i).getAsJsonObject()));
13677      }
13678    };
13679    if (json.has("associatedMedication"))
13680      res.setAssociatedMedication(parseReference(json.getAsJsonObject("associatedMedication")));
13681    if (json.has("productType")) {
13682      JsonArray array = json.getAsJsonArray("productType");
13683      for (int i = 0; i < array.size(); i++) {
13684        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13685      }
13686    };
13687    if (json.has("monograph")) {
13688      JsonArray array = json.getAsJsonArray("monograph");
13689      for (int i = 0; i < array.size(); i++) {
13690        res.getMonograph().add(parseMedicationKnowledgeMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject(), res));
13691      }
13692    };
13693    if (json.has("halfLifePeriod"))
13694      res.setHalfLifePeriod(parseDuration(json.getAsJsonObject("halfLifePeriod")));
13695    if (json.has("ingredient")) {
13696      JsonArray array = json.getAsJsonArray("ingredient");
13697      for (int i = 0; i < array.size(); i++) {
13698        res.getIngredient().add(parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(array.get(i).getAsJsonObject(), res));
13699      }
13700    };
13701    if (json.has("preparationInstruction"))
13702      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
13703    if (json.has("_preparationInstruction"))
13704      parseElementProperties(json.getAsJsonObject("_preparationInstruction"), res.getPreparationInstructionElement());
13705    if (json.has("intendedRoute")) {
13706      JsonArray array = json.getAsJsonArray("intendedRoute");
13707      for (int i = 0; i < array.size(); i++) {
13708        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13709      }
13710    };
13711    if (json.has("cost")) {
13712      JsonArray array = json.getAsJsonArray("cost");
13713      for (int i = 0; i < array.size(); i++) {
13714        res.getCost().add(parseMedicationKnowledgeMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject(), res));
13715      }
13716    };
13717    if (json.has("monitoringProgram")) {
13718      JsonArray array = json.getAsJsonArray("monitoringProgram");
13719      for (int i = 0; i < array.size(); i++) {
13720        res.getMonitoringProgram().add(parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject(), res));
13721      }
13722    };
13723    if (json.has("administrationGuidelines")) {
13724      JsonArray array = json.getAsJsonArray("administrationGuidelines");
13725      for (int i = 0; i < array.size(); i++) {
13726        res.getAdministrationGuidelines().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(array.get(i).getAsJsonObject(), res));
13727      }
13728    };
13729    if (json.has("medicineClassification")) {
13730      JsonArray array = json.getAsJsonArray("medicineClassification");
13731      for (int i = 0; i < array.size(); i++) {
13732        res.getMedicineClassification().add(parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(array.get(i).getAsJsonObject(), res));
13733      }
13734    };
13735    if (json.has("packaging"))
13736      res.setPackaging(parseMedicationKnowledgeMedicationKnowledgePackagingComponent(json.getAsJsonObject("packaging"), res));
13737    if (json.has("drugCharacteristic")) {
13738      JsonArray array = json.getAsJsonArray("drugCharacteristic");
13739      for (int i = 0; i < array.size(); i++) {
13740        res.getDrugCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(array.get(i).getAsJsonObject(), res));
13741      }
13742    };
13743    if (json.has("contraindication")) {
13744      JsonArray array = json.getAsJsonArray("contraindication");
13745      for (int i = 0; i < array.size(); i++) {
13746        res.getContraindication().add(parseReference(array.get(i).getAsJsonObject()));
13747      }
13748    };
13749  }
13750
13751  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMedicationKnowledgeMonographComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
13752    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
13753    parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(json, owner, res);
13754    return res;
13755  }
13756
13757  protected void parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonographComponent res) throws IOException, FHIRFormatError {
13758    parseBackboneElementProperties(json, res);
13759    if (json.has("type"))
13760      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13761    if (json.has("document"))
13762      res.setDocument(parseReference(json.getAsJsonObject("document")));
13763  }
13764
13765  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
13766    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
13767    parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(json, owner, res);
13768    return res;
13769  }
13770
13771  protected void parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeIngredientComponent res) throws IOException, FHIRFormatError {
13772    parseBackboneElementProperties(json, res);
13773    Type item = parseType("item", json);
13774    if (item != null)
13775      res.setItem(item);
13776    if (json.has("isActive"))
13777      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
13778    if (json.has("_isActive"))
13779      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
13780    if (json.has("strength"))
13781      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
13782  }
13783
13784  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeMedicationKnowledgeCostComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
13785    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
13786    parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(json, owner, res);
13787    return res;
13788  }
13789
13790  protected void parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeCostComponent res) throws IOException, FHIRFormatError {
13791    parseBackboneElementProperties(json, res);
13792    if (json.has("type"))
13793      res.setTypeElement(parseString(json.get("type").getAsString()));
13794    if (json.has("_type"))
13795      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13796    if (json.has("source"))
13797      res.setSourceElement(parseString(json.get("source").getAsString()));
13798    if (json.has("_source"))
13799      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
13800    if (json.has("cost"))
13801      res.setCost(parseMoney(json.getAsJsonObject("cost")));
13802  }
13803
13804  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
13805    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
13806    parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(json, owner, res);
13807    return res;
13808  }
13809
13810  protected void parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res) throws IOException, FHIRFormatError {
13811    parseBackboneElementProperties(json, res);
13812    if (json.has("type"))
13813      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13814    if (json.has("name"))
13815      res.setNameElement(parseString(json.get("name").getAsString()));
13816    if (json.has("_name"))
13817      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13818  }
13819
13820  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
13821    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent();
13822    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(json, owner, res);
13823    return res;
13824  }
13825
13826  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res) throws IOException, FHIRFormatError {
13827    parseBackboneElementProperties(json, res);
13828    if (json.has("dosage")) {
13829      JsonArray array = json.getAsJsonArray("dosage");
13830      for (int i = 0; i < array.size(); i++) {
13831        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
13832      }
13833    };
13834    Type indication = parseType("indication", json);
13835    if (indication != null)
13836      res.setIndication(indication);
13837    if (json.has("patientCharacteristics")) {
13838      JsonArray array = json.getAsJsonArray("patientCharacteristics");
13839      for (int i = 0; i < array.size(); i++) {
13840        res.getPatientCharacteristics().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(array.get(i).getAsJsonObject(), owner));
13841      }
13842    };
13843  }
13844
13845  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
13846    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
13847    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(json, owner, res);
13848    return res;
13849  }
13850
13851  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res) throws IOException, FHIRFormatError {
13852    parseBackboneElementProperties(json, res);
13853    Type characteristic = parseType("characteristic", json);
13854    if (characteristic != null)
13855      res.setCharacteristic(characteristic);
13856    if (json.has("value")) {
13857      JsonArray array = json.getAsJsonArray("value");
13858      for (int i = 0; i < array.size(); i++) {
13859        res.getValue().add(parseString(array.get(i).getAsString()));
13860      }
13861    };
13862    if (json.has("_value")) {
13863      JsonArray array = json.getAsJsonArray("_value");
13864      for (int i = 0; i < array.size(); i++) {
13865        if (i == res.getValue().size())
13866          res.getValue().add(parseString(null));
13867        if (array.get(i) instanceof JsonObject) 
13868          parseElementProperties(array.get(i).getAsJsonObject(), res.getValue().get(i));
13869      }
13870    };
13871  }
13872
13873  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
13874    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
13875    parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(json, owner, res);
13876    return res;
13877  }
13878
13879  protected void parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res) throws IOException, FHIRFormatError {
13880    parseBackboneElementProperties(json, res);
13881    if (json.has("type"))
13882      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13883    if (json.has("classification")) {
13884      JsonArray array = json.getAsJsonArray("classification");
13885      for (int i = 0; i < array.size(); i++) {
13886        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13887      }
13888    };
13889  }
13890
13891  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgeMedicationKnowledgePackagingComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
13892    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
13893    parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(json, owner, res);
13894    return res;
13895  }
13896
13897  protected void parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgePackagingComponent res) throws IOException, FHIRFormatError {
13898    parseBackboneElementProperties(json, res);
13899    if (json.has("type"))
13900      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13901    if (json.has("quantity"))
13902      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
13903  }
13904
13905  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
13906    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
13907    parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(json, owner, res);
13908    return res;
13909  }
13910
13911  protected void parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res) throws IOException, FHIRFormatError {
13912    parseBackboneElementProperties(json, res);
13913    if (json.has("type"))
13914      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13915    Type value = parseType("value", json);
13916    if (value != null)
13917      res.setValue(value);
13918  }
13919
13920  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
13921    MedicationRequest res = new MedicationRequest();
13922    parseMedicationRequestProperties(json, res);
13923    return res;
13924  }
13925
13926  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
13927    parseDomainResourceProperties(json, res);
13928    if (json.has("identifier")) {
13929      JsonArray array = json.getAsJsonArray("identifier");
13930      for (int i = 0; i < array.size(); i++) {
13931        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13932      }
13933    };
13934    if (json.has("status"))
13935      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
13936    if (json.has("_status"))
13937      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13938    if (json.has("intent"))
13939      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
13940    if (json.has("_intent"))
13941      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
13942    if (json.has("category")) {
13943      JsonArray array = json.getAsJsonArray("category");
13944      for (int i = 0; i < array.size(); i++) {
13945        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13946      }
13947    };
13948    if (json.has("priority"))
13949      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
13950    if (json.has("_priority"))
13951      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
13952    Type medication = parseType("medication", json);
13953    if (medication != null)
13954      res.setMedication(medication);
13955    if (json.has("subject"))
13956      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13957    if (json.has("context"))
13958      res.setContext(parseReference(json.getAsJsonObject("context")));
13959    if (json.has("supportingInformation")) {
13960      JsonArray array = json.getAsJsonArray("supportingInformation");
13961      for (int i = 0; i < array.size(); i++) {
13962        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
13963      }
13964    };
13965    if (json.has("authoredOn"))
13966      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
13967    if (json.has("_authoredOn"))
13968      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
13969    if (json.has("requester"))
13970      res.setRequester(parseReference(json.getAsJsonObject("requester")));
13971    if (json.has("performer"))
13972      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
13973    if (json.has("performerType"))
13974      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
13975    if (json.has("recorder"))
13976      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
13977    if (json.has("reasonCode")) {
13978      JsonArray array = json.getAsJsonArray("reasonCode");
13979      for (int i = 0; i < array.size(); i++) {
13980        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13981      }
13982    };
13983    if (json.has("reasonReference")) {
13984      JsonArray array = json.getAsJsonArray("reasonReference");
13985      for (int i = 0; i < array.size(); i++) {
13986        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13987      }
13988    };
13989    if (json.has("instantiates")) {
13990      JsonArray array = json.getAsJsonArray("instantiates");
13991      for (int i = 0; i < array.size(); i++) {
13992        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
13993      }
13994    };
13995    if (json.has("_instantiates")) {
13996      JsonArray array = json.getAsJsonArray("_instantiates");
13997      for (int i = 0; i < array.size(); i++) {
13998        if (i == res.getInstantiates().size())
13999          res.getInstantiates().add(parseUri(null));
14000        if (array.get(i) instanceof JsonObject) 
14001          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
14002      }
14003    };
14004    if (json.has("basedOn")) {
14005      JsonArray array = json.getAsJsonArray("basedOn");
14006      for (int i = 0; i < array.size(); i++) {
14007        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
14008      }
14009    };
14010    if (json.has("groupIdentifier"))
14011      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
14012    if (json.has("statusReason"))
14013      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
14014    if (json.has("insurance")) {
14015      JsonArray array = json.getAsJsonArray("insurance");
14016      for (int i = 0; i < array.size(); i++) {
14017        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
14018      }
14019    };
14020    if (json.has("note")) {
14021      JsonArray array = json.getAsJsonArray("note");
14022      for (int i = 0; i < array.size(); i++) {
14023        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14024      }
14025    };
14026    if (json.has("dosageInstruction")) {
14027      JsonArray array = json.getAsJsonArray("dosageInstruction");
14028      for (int i = 0; i < array.size(); i++) {
14029        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
14030      }
14031    };
14032    if (json.has("dispenseRequest"))
14033      res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(json.getAsJsonObject("dispenseRequest"), res));
14034    if (json.has("substitution"))
14035      res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(json.getAsJsonObject("substitution"), res));
14036    if (json.has("priorPrescription"))
14037      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
14038    if (json.has("detectedIssue")) {
14039      JsonArray array = json.getAsJsonArray("detectedIssue");
14040      for (int i = 0; i < array.size(); i++) {
14041        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
14042      }
14043    };
14044    if (json.has("eventHistory")) {
14045      JsonArray array = json.getAsJsonArray("eventHistory");
14046      for (int i = 0; i < array.size(); i++) {
14047        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
14048      }
14049    };
14050  }
14051
14052  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
14053    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
14054    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
14055    return res;
14056  }
14057
14058  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
14059    parseBackboneElementProperties(json, res);
14060    if (json.has("validityPeriod"))
14061      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
14062    if (json.has("numberOfRepeatsAllowed"))
14063      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
14064    if (json.has("_numberOfRepeatsAllowed"))
14065      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
14066    if (json.has("quantity"))
14067      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
14068    if (json.has("expectedSupplyDuration"))
14069      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
14070    if (json.has("performer"))
14071      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
14072  }
14073
14074  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
14075    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
14076    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
14077    return res;
14078  }
14079
14080  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
14081    parseBackboneElementProperties(json, res);
14082    if (json.has("allowed"))
14083      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
14084    if (json.has("_allowed"))
14085      parseElementProperties(json.getAsJsonObject("_allowed"), res.getAllowedElement());
14086    if (json.has("reason"))
14087      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
14088  }
14089
14090  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
14091    MedicationStatement res = new MedicationStatement();
14092    parseMedicationStatementProperties(json, res);
14093    return res;
14094  }
14095
14096  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
14097    parseDomainResourceProperties(json, res);
14098    if (json.has("identifier")) {
14099      JsonArray array = json.getAsJsonArray("identifier");
14100      for (int i = 0; i < array.size(); i++) {
14101        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14102      }
14103    };
14104    if (json.has("basedOn")) {
14105      JsonArray array = json.getAsJsonArray("basedOn");
14106      for (int i = 0; i < array.size(); i++) {
14107        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
14108      }
14109    };
14110    if (json.has("partOf")) {
14111      JsonArray array = json.getAsJsonArray("partOf");
14112      for (int i = 0; i < array.size(); i++) {
14113        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
14114      }
14115    };
14116    if (json.has("status"))
14117      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
14118    if (json.has("_status"))
14119      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14120    if (json.has("statusReason")) {
14121      JsonArray array = json.getAsJsonArray("statusReason");
14122      for (int i = 0; i < array.size(); i++) {
14123        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14124      }
14125    };
14126    if (json.has("category"))
14127      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
14128    Type medication = parseType("medication", json);
14129    if (medication != null)
14130      res.setMedication(medication);
14131    if (json.has("subject"))
14132      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14133    if (json.has("context"))
14134      res.setContext(parseReference(json.getAsJsonObject("context")));
14135    Type effective = parseType("effective", json);
14136    if (effective != null)
14137      res.setEffective(effective);
14138    if (json.has("dateAsserted"))
14139      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
14140    if (json.has("_dateAsserted"))
14141      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
14142    if (json.has("informationSource"))
14143      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
14144    if (json.has("derivedFrom")) {
14145      JsonArray array = json.getAsJsonArray("derivedFrom");
14146      for (int i = 0; i < array.size(); i++) {
14147        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
14148      }
14149    };
14150    if (json.has("reasonCode")) {
14151      JsonArray array = json.getAsJsonArray("reasonCode");
14152      for (int i = 0; i < array.size(); i++) {
14153        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14154      }
14155    };
14156    if (json.has("reasonReference")) {
14157      JsonArray array = json.getAsJsonArray("reasonReference");
14158      for (int i = 0; i < array.size(); i++) {
14159        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14160      }
14161    };
14162    if (json.has("note")) {
14163      JsonArray array = json.getAsJsonArray("note");
14164      for (int i = 0; i < array.size(); i++) {
14165        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14166      }
14167    };
14168    if (json.has("dosage")) {
14169      JsonArray array = json.getAsJsonArray("dosage");
14170      for (int i = 0; i < array.size(); i++) {
14171        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
14172      }
14173    };
14174  }
14175
14176  protected MedicinalProduct parseMedicinalProduct(JsonObject json) throws IOException, FHIRFormatError {
14177    MedicinalProduct res = new MedicinalProduct();
14178    parseMedicinalProductProperties(json, res);
14179    return res;
14180  }
14181
14182  protected void parseMedicinalProductProperties(JsonObject json, MedicinalProduct res) throws IOException, FHIRFormatError {
14183    parseDomainResourceProperties(json, res);
14184    if (json.has("identifier"))
14185      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
14186    if (json.has("type"))
14187      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14188    if (json.has("combinedPharmaceuticalDoseForm"))
14189      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(json.getAsJsonObject("combinedPharmaceuticalDoseForm")));
14190    if (json.has("additionalMonitoringIndicator"))
14191      res.setAdditionalMonitoringIndicator(parseCodeableConcept(json.getAsJsonObject("additionalMonitoringIndicator")));
14192    if (json.has("specialMeasures")) {
14193      JsonArray array = json.getAsJsonArray("specialMeasures");
14194      for (int i = 0; i < array.size(); i++) {
14195        res.getSpecialMeasures().add(parseString(array.get(i).getAsString()));
14196      }
14197    };
14198    if (json.has("_specialMeasures")) {
14199      JsonArray array = json.getAsJsonArray("_specialMeasures");
14200      for (int i = 0; i < array.size(); i++) {
14201        if (i == res.getSpecialMeasures().size())
14202          res.getSpecialMeasures().add(parseString(null));
14203        if (array.get(i) instanceof JsonObject) 
14204          parseElementProperties(array.get(i).getAsJsonObject(), res.getSpecialMeasures().get(i));
14205      }
14206    };
14207    if (json.has("paediatricUseIndicator"))
14208      res.setPaediatricUseIndicator(parseCodeableConcept(json.getAsJsonObject("paediatricUseIndicator")));
14209    if (json.has("orphanDesignationStatus"))
14210      res.setOrphanDesignationStatus(parseCodeableConcept(json.getAsJsonObject("orphanDesignationStatus")));
14211    if (json.has("productClassification")) {
14212      JsonArray array = json.getAsJsonArray("productClassification");
14213      for (int i = 0; i < array.size(); i++) {
14214        res.getProductClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14215      }
14216    };
14217    if (json.has("marketingAuthorization"))
14218      res.setMarketingAuthorization(parseReference(json.getAsJsonObject("marketingAuthorization")));
14219    if (json.has("packagedMedicinalProduct")) {
14220      JsonArray array = json.getAsJsonArray("packagedMedicinalProduct");
14221      for (int i = 0; i < array.size(); i++) {
14222        res.getPackagedMedicinalProduct().add(parseReference(array.get(i).getAsJsonObject()));
14223      }
14224    };
14225    if (json.has("pharmaceuticalProduct")) {
14226      JsonArray array = json.getAsJsonArray("pharmaceuticalProduct");
14227      for (int i = 0; i < array.size(); i++) {
14228        res.getPharmaceuticalProduct().add(parseReference(array.get(i).getAsJsonObject()));
14229      }
14230    };
14231    if (json.has("clinicalParticulars")) {
14232      JsonArray array = json.getAsJsonArray("clinicalParticulars");
14233      for (int i = 0; i < array.size(); i++) {
14234        res.getClinicalParticulars().add(parseReference(array.get(i).getAsJsonObject()));
14235      }
14236    };
14237    if (json.has("attachedDocument")) {
14238      JsonArray array = json.getAsJsonArray("attachedDocument");
14239      for (int i = 0; i < array.size(); i++) {
14240        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
14241      }
14242    };
14243    if (json.has("masterFile")) {
14244      JsonArray array = json.getAsJsonArray("masterFile");
14245      for (int i = 0; i < array.size(); i++) {
14246        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
14247      }
14248    };
14249    if (json.has("name")) {
14250      JsonArray array = json.getAsJsonArray("name");
14251      for (int i = 0; i < array.size(); i++) {
14252        res.getName().add(parseMedicinalProductMedicinalProductNameComponent(array.get(i).getAsJsonObject(), res));
14253      }
14254    };
14255    if (json.has("crossReference")) {
14256      JsonArray array = json.getAsJsonArray("crossReference");
14257      for (int i = 0; i < array.size(); i++) {
14258        res.getCrossReference().add(parseIdentifier(array.get(i).getAsJsonObject()));
14259      }
14260    };
14261    if (json.has("manufacturingBusinessOperation")) {
14262      JsonArray array = json.getAsJsonArray("manufacturingBusinessOperation");
14263      for (int i = 0; i < array.size(); i++) {
14264        res.getManufacturingBusinessOperation().add(parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(array.get(i).getAsJsonObject(), res));
14265      }
14266    };
14267  }
14268
14269  protected MedicinalProduct.MedicinalProductNameComponent parseMedicinalProductMedicinalProductNameComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
14270    MedicinalProduct.MedicinalProductNameComponent res = new MedicinalProduct.MedicinalProductNameComponent();
14271    parseMedicinalProductMedicinalProductNameComponentProperties(json, owner, res);
14272    return res;
14273  }
14274
14275  protected void parseMedicinalProductMedicinalProductNameComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameComponent res) throws IOException, FHIRFormatError {
14276    parseBackboneElementProperties(json, res);
14277    if (json.has("fullName"))
14278      res.setFullNameElement(parseString(json.get("fullName").getAsString()));
14279    if (json.has("_fullName"))
14280      parseElementProperties(json.getAsJsonObject("_fullName"), res.getFullNameElement());
14281    if (json.has("namePart")) {
14282      JsonArray array = json.getAsJsonArray("namePart");
14283      for (int i = 0; i < array.size(); i++) {
14284        res.getNamePart().add(parseMedicinalProductMedicinalProductNameNamePartComponent(array.get(i).getAsJsonObject(), owner));
14285      }
14286    };
14287    if (json.has("countryLanguage")) {
14288      JsonArray array = json.getAsJsonArray("countryLanguage");
14289      for (int i = 0; i < array.size(); i++) {
14290        res.getCountryLanguage().add(parseMedicinalProductMedicinalProductNameCountryLanguageComponent(array.get(i).getAsJsonObject(), owner));
14291      }
14292    };
14293  }
14294
14295  protected MedicinalProduct.MedicinalProductNameNamePartComponent parseMedicinalProductMedicinalProductNameNamePartComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
14296    MedicinalProduct.MedicinalProductNameNamePartComponent res = new MedicinalProduct.MedicinalProductNameNamePartComponent();
14297    parseMedicinalProductMedicinalProductNameNamePartComponentProperties(json, owner, res);
14298    return res;
14299  }
14300
14301  protected void parseMedicinalProductMedicinalProductNameNamePartComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameNamePartComponent res) throws IOException, FHIRFormatError {
14302    parseBackboneElementProperties(json, res);
14303    if (json.has("part"))
14304      res.setPartElement(parseString(json.get("part").getAsString()));
14305    if (json.has("_part"))
14306      parseElementProperties(json.getAsJsonObject("_part"), res.getPartElement());
14307    if (json.has("type"))
14308      res.setType(parseCoding(json.getAsJsonObject("type")));
14309  }
14310
14311  protected MedicinalProduct.MedicinalProductNameCountryLanguageComponent parseMedicinalProductMedicinalProductNameCountryLanguageComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
14312    MedicinalProduct.MedicinalProductNameCountryLanguageComponent res = new MedicinalProduct.MedicinalProductNameCountryLanguageComponent();
14313    parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(json, owner, res);
14314    return res;
14315  }
14316
14317  protected void parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameCountryLanguageComponent res) throws IOException, FHIRFormatError {
14318    parseBackboneElementProperties(json, res);
14319    if (json.has("country"))
14320      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
14321    if (json.has("jurisdiction"))
14322      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
14323    if (json.has("language"))
14324      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
14325  }
14326
14327  protected MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
14328    MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res = new MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent();
14329    parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(json, owner, res);
14330    return res;
14331  }
14332
14333  protected void parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res) throws IOException, FHIRFormatError {
14334    parseBackboneElementProperties(json, res);
14335    if (json.has("operationType"))
14336      res.setOperationType(parseCodeableConcept(json.getAsJsonObject("operationType")));
14337    if (json.has("authorisationReferenceNumber"))
14338      res.setAuthorisationReferenceNumber(parseIdentifier(json.getAsJsonObject("authorisationReferenceNumber")));
14339    if (json.has("effectiveDate"))
14340      res.setEffectiveDateElement(parseDateTime(json.get("effectiveDate").getAsString()));
14341    if (json.has("_effectiveDate"))
14342      parseElementProperties(json.getAsJsonObject("_effectiveDate"), res.getEffectiveDateElement());
14343    if (json.has("confidentialityIndicator"))
14344      res.setConfidentialityIndicator(parseCodeableConcept(json.getAsJsonObject("confidentialityIndicator")));
14345    if (json.has("manufacturer")) {
14346      JsonArray array = json.getAsJsonArray("manufacturer");
14347      for (int i = 0; i < array.size(); i++) {
14348        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
14349      }
14350    };
14351    if (json.has("regulator"))
14352      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
14353  }
14354
14355  protected MedicinalProductAuthorization parseMedicinalProductAuthorization(JsonObject json) throws IOException, FHIRFormatError {
14356    MedicinalProductAuthorization res = new MedicinalProductAuthorization();
14357    parseMedicinalProductAuthorizationProperties(json, res);
14358    return res;
14359  }
14360
14361  protected void parseMedicinalProductAuthorizationProperties(JsonObject json, MedicinalProductAuthorization res) throws IOException, FHIRFormatError {
14362    parseDomainResourceProperties(json, res);
14363    if (json.has("identifier"))
14364      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
14365    if (json.has("country")) {
14366      JsonArray array = json.getAsJsonArray("country");
14367      for (int i = 0; i < array.size(); i++) {
14368        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14369      }
14370    };
14371    if (json.has("legalStatusOfSupply"))
14372      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
14373    if (json.has("status"))
14374      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
14375    if (json.has("statusDate"))
14376      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
14377    if (json.has("_statusDate"))
14378      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
14379    if (json.has("restoreDate"))
14380      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
14381    if (json.has("_restoreDate"))
14382      parseElementProperties(json.getAsJsonObject("_restoreDate"), res.getRestoreDateElement());
14383    if (json.has("validityPeriod"))
14384      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
14385    if (json.has("dataExclusivityPeriod"))
14386      res.setDataExclusivityPeriod(parsePeriod(json.getAsJsonObject("dataExclusivityPeriod")));
14387    if (json.has("dateOfFirstAuthorization"))
14388      res.setDateOfFirstAuthorizationElement(parseDateTime(json.get("dateOfFirstAuthorization").getAsString()));
14389    if (json.has("_dateOfFirstAuthorization"))
14390      parseElementProperties(json.getAsJsonObject("_dateOfFirstAuthorization"), res.getDateOfFirstAuthorizationElement());
14391    if (json.has("internationalBirthDate"))
14392      res.setInternationalBirthDateElement(parseDateTime(json.get("internationalBirthDate").getAsString()));
14393    if (json.has("_internationalBirthDate"))
14394      parseElementProperties(json.getAsJsonObject("_internationalBirthDate"), res.getInternationalBirthDateElement());
14395    if (json.has("jurisdictionalAuthorization")) {
14396      JsonArray array = json.getAsJsonArray("jurisdictionalAuthorization");
14397      for (int i = 0; i < array.size(); i++) {
14398        res.getJurisdictionalAuthorization().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(array.get(i).getAsJsonObject(), res));
14399      }
14400    };
14401    if (json.has("holder"))
14402      res.setHolder(parseReference(json.getAsJsonObject("holder")));
14403    if (json.has("regulator"))
14404      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
14405    if (json.has("procedure"))
14406      res.setProcedure(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(json.getAsJsonObject("procedure"), res));
14407    if (json.has("marketingStatus")) {
14408      JsonArray array = json.getAsJsonArray("marketingStatus");
14409      for (int i = 0; i < array.size(); i++) {
14410        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
14411      }
14412    };
14413  }
14414
14415  protected MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
14416    MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
14417    parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(json, owner, res);
14418    return res;
14419  }
14420
14421  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res) throws IOException, FHIRFormatError {
14422    parseBackboneElementProperties(json, res);
14423    if (json.has("country"))
14424      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
14425    if (json.has("jurisdiction"))
14426      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
14427    if (json.has("number"))
14428      res.setNumber(parseIdentifier(json.getAsJsonObject("number")));
14429    if (json.has("legalStatusOfSupply"))
14430      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
14431  }
14432
14433  protected MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
14434    MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent();
14435    parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(json, owner, res);
14436    return res;
14437  }
14438
14439  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res) throws IOException, FHIRFormatError {
14440    parseBackboneElementProperties(json, res);
14441    if (json.has("number"))
14442      res.setNumber(parseIdentifier(json.getAsJsonObject("number")));
14443    if (json.has("type"))
14444      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14445    if (json.has("date"))
14446      res.setDate(parsePeriod(json.getAsJsonObject("date")));
14447    if (json.has("application")) {
14448      JsonArray array = json.getAsJsonArray("application");
14449      for (int i = 0; i < array.size(); i++) {
14450        res.getApplication().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureApplicationComponent(array.get(i).getAsJsonObject(), owner));
14451      }
14452    };
14453  }
14454
14455  protected MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureApplicationComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureApplicationComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
14456    MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureApplicationComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureApplicationComponent();
14457    parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureApplicationComponentProperties(json, owner, res);
14458    return res;
14459  }
14460
14461  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureApplicationComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureApplicationComponent res) throws IOException, FHIRFormatError {
14462    parseBackboneElementProperties(json, res);
14463    if (json.has("number"))
14464      res.setNumber(parseIdentifier(json.getAsJsonObject("number")));
14465    if (json.has("type"))
14466      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14467    if (json.has("date"))
14468      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14469    if (json.has("_date"))
14470      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14471  }
14472
14473  protected MedicinalProductClinicals parseMedicinalProductClinicals(JsonObject json) throws IOException, FHIRFormatError {
14474    MedicinalProductClinicals res = new MedicinalProductClinicals();
14475    parseMedicinalProductClinicalsProperties(json, res);
14476    return res;
14477  }
14478
14479  protected void parseMedicinalProductClinicalsProperties(JsonObject json, MedicinalProductClinicals res) throws IOException, FHIRFormatError {
14480    parseDomainResourceProperties(json, res);
14481    if (json.has("undesirableEffects")) {
14482      JsonArray array = json.getAsJsonArray("undesirableEffects");
14483      for (int i = 0; i < array.size(); i++) {
14484        res.getUndesirableEffects().add(parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(array.get(i).getAsJsonObject(), res));
14485      }
14486    };
14487    if (json.has("therapeuticIndication")) {
14488      JsonArray array = json.getAsJsonArray("therapeuticIndication");
14489      for (int i = 0; i < array.size(); i++) {
14490        res.getTherapeuticIndication().add(parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(array.get(i).getAsJsonObject(), res));
14491      }
14492    };
14493    if (json.has("contraindication")) {
14494      JsonArray array = json.getAsJsonArray("contraindication");
14495      for (int i = 0; i < array.size(); i++) {
14496        res.getContraindication().add(parseMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponent(array.get(i).getAsJsonObject(), res));
14497      }
14498    };
14499    if (json.has("interactions")) {
14500      JsonArray array = json.getAsJsonArray("interactions");
14501      for (int i = 0; i < array.size(); i++) {
14502        res.getInteractions().add(parseMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponent(array.get(i).getAsJsonObject(), res));
14503      }
14504    };
14505  }
14506
14507  protected MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
14508    MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent();
14509    parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponentProperties(json, owner, res);
14510    return res;
14511  }
14512
14513  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent res) throws IOException, FHIRFormatError {
14514    parseBackboneElementProperties(json, res);
14515    if (json.has("symptomConditionEffect"))
14516      res.setSymptomConditionEffect(parseCodeableConcept(json.getAsJsonObject("symptomConditionEffect")));
14517    if (json.has("classification"))
14518      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
14519    if (json.has("frequencyOfOccurrence"))
14520      res.setFrequencyOfOccurrence(parseCodeableConcept(json.getAsJsonObject("frequencyOfOccurrence")));
14521    if (json.has("population")) {
14522      JsonArray array = json.getAsJsonArray("population");
14523      for (int i = 0; i < array.size(); i++) {
14524        res.getPopulation().add(parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(array.get(i).getAsJsonObject(), owner));
14525      }
14526    };
14527  }
14528
14529  protected MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
14530    MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent();
14531    parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponentProperties(json, owner, res);
14532    return res;
14533  }
14534
14535  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent res) throws IOException, FHIRFormatError {
14536    parseBackboneElementProperties(json, res);
14537    Type age = parseType("age", json);
14538    if (age != null)
14539      res.setAge(age);
14540    if (json.has("gender"))
14541      res.setGender(parseCodeableConcept(json.getAsJsonObject("gender")));
14542    if (json.has("race"))
14543      res.setRace(parseCodeableConcept(json.getAsJsonObject("race")));
14544    if (json.has("physiologicalCondition"))
14545      res.setPhysiologicalCondition(parseCodeableConcept(json.getAsJsonObject("physiologicalCondition")));
14546  }
14547
14548  protected MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
14549    MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent();
14550    parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponentProperties(json, owner, res);
14551    return res;
14552  }
14553
14554  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent res) throws IOException, FHIRFormatError {
14555    parseBackboneElementProperties(json, res);
14556    if (json.has("diseaseSymptomProcedure"))
14557      res.setDiseaseSymptomProcedure(parseCodeableConcept(json.getAsJsonObject("diseaseSymptomProcedure")));
14558    if (json.has("diseaseStatus"))
14559      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
14560    if (json.has("comorbidity")) {
14561      JsonArray array = json.getAsJsonArray("comorbidity");
14562      for (int i = 0; i < array.size(); i++) {
14563        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14564      }
14565    };
14566    if (json.has("intendedEffect"))
14567      res.setIntendedEffect(parseCodeableConcept(json.getAsJsonObject("intendedEffect")));
14568    if (json.has("duration"))
14569      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
14570    if (json.has("undesirableEffects")) {
14571      JsonArray array = json.getAsJsonArray("undesirableEffects");
14572      for (int i = 0; i < array.size(); i++) {
14573        res.getUndesirableEffects().add(parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(array.get(i).getAsJsonObject(), owner));
14574      }
14575    };
14576    if (json.has("otherTherapy")) {
14577      JsonArray array = json.getAsJsonArray("otherTherapy");
14578      for (int i = 0; i < array.size(); i++) {
14579        res.getOtherTherapy().add(parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(array.get(i).getAsJsonObject(), owner));
14580      }
14581    };
14582    if (json.has("population")) {
14583      JsonArray array = json.getAsJsonArray("population");
14584      for (int i = 0; i < array.size(); i++) {
14585        res.getPopulation().add(parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(array.get(i).getAsJsonObject(), owner));
14586      }
14587    };
14588  }
14589
14590  protected MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
14591    MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent();
14592    parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponentProperties(json, owner, res);
14593    return res;
14594  }
14595
14596  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
14597    parseBackboneElementProperties(json, res);
14598    if (json.has("therapyRelationshipType"))
14599      res.setTherapyRelationshipType(parseCodeableConcept(json.getAsJsonObject("therapyRelationshipType")));
14600    Type medication = parseType("medication", json);
14601    if (medication != null)
14602      res.setMedication(medication);
14603  }
14604
14605  protected MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent parseMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
14606    MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent();
14607    parseMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponentProperties(json, owner, res);
14608    return res;
14609  }
14610
14611  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent res) throws IOException, FHIRFormatError {
14612    parseBackboneElementProperties(json, res);
14613    if (json.has("disease"))
14614      res.setDisease(parseCodeableConcept(json.getAsJsonObject("disease")));
14615    if (json.has("diseaseStatus"))
14616      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
14617    if (json.has("comorbidity")) {
14618      JsonArray array = json.getAsJsonArray("comorbidity");
14619      for (int i = 0; i < array.size(); i++) {
14620        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14621      }
14622    };
14623    if (json.has("therapeuticIndication")) {
14624      JsonArray array = json.getAsJsonArray("therapeuticIndication");
14625      for (int i = 0; i < array.size(); i++) {
14626        res.getTherapeuticIndication().add(parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(array.get(i).getAsJsonObject(), owner));
14627      }
14628    };
14629    if (json.has("otherTherapy")) {
14630      JsonArray array = json.getAsJsonArray("otherTherapy");
14631      for (int i = 0; i < array.size(); i++) {
14632        res.getOtherTherapy().add(parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(array.get(i).getAsJsonObject(), owner));
14633      }
14634    };
14635    if (json.has("population")) {
14636      JsonArray array = json.getAsJsonArray("population");
14637      for (int i = 0; i < array.size(); i++) {
14638        res.getPopulation().add(parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(array.get(i).getAsJsonObject(), owner));
14639      }
14640    };
14641  }
14642
14643  protected MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent parseMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
14644    MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent();
14645    parseMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponentProperties(json, owner, res);
14646    return res;
14647  }
14648
14649  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent res) throws IOException, FHIRFormatError {
14650    parseBackboneElementProperties(json, res);
14651    if (json.has("interactant")) {
14652      JsonArray array = json.getAsJsonArray("interactant");
14653      for (int i = 0; i < array.size(); i++) {
14654        res.getInteractant().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14655      }
14656    };
14657    if (json.has("type"))
14658      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14659    if (json.has("effect"))
14660      res.setEffect(parseCodeableConcept(json.getAsJsonObject("effect")));
14661    if (json.has("incidence"))
14662      res.setIncidence(parseCodeableConcept(json.getAsJsonObject("incidence")));
14663    if (json.has("management"))
14664      res.setManagement(parseCodeableConcept(json.getAsJsonObject("management")));
14665  }
14666
14667  protected MedicinalProductDeviceSpec parseMedicinalProductDeviceSpec(JsonObject json) throws IOException, FHIRFormatError {
14668    MedicinalProductDeviceSpec res = new MedicinalProductDeviceSpec();
14669    parseMedicinalProductDeviceSpecProperties(json, res);
14670    return res;
14671  }
14672
14673  protected void parseMedicinalProductDeviceSpecProperties(JsonObject json, MedicinalProductDeviceSpec res) throws IOException, FHIRFormatError {
14674    parseDomainResourceProperties(json, res);
14675    if (json.has("identifier"))
14676      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
14677    if (json.has("type"))
14678      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14679    if (json.has("tradeName"))
14680      res.setTradeNameElement(parseString(json.get("tradeName").getAsString()));
14681    if (json.has("_tradeName"))
14682      parseElementProperties(json.getAsJsonObject("_tradeName"), res.getTradeNameElement());
14683    if (json.has("quantity"))
14684      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
14685    if (json.has("listingNumber"))
14686      res.setListingNumberElement(parseString(json.get("listingNumber").getAsString()));
14687    if (json.has("_listingNumber"))
14688      parseElementProperties(json.getAsJsonObject("_listingNumber"), res.getListingNumberElement());
14689    if (json.has("modelNumber"))
14690      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
14691    if (json.has("_modelNumber"))
14692      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
14693    if (json.has("sterilityIndicator"))
14694      res.setSterilityIndicator(parseCodeableConcept(json.getAsJsonObject("sterilityIndicator")));
14695    if (json.has("sterilisationRequirement"))
14696      res.setSterilisationRequirement(parseCodeableConcept(json.getAsJsonObject("sterilisationRequirement")));
14697    if (json.has("usage"))
14698      res.setUsage(parseCodeableConcept(json.getAsJsonObject("usage")));
14699    if (json.has("nomenclature")) {
14700      JsonArray array = json.getAsJsonArray("nomenclature");
14701      for (int i = 0; i < array.size(); i++) {
14702        res.getNomenclature().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14703      }
14704    };
14705    if (json.has("shelfLife")) {
14706      JsonArray array = json.getAsJsonArray("shelfLife");
14707      for (int i = 0; i < array.size(); i++) {
14708        res.getShelfLife().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
14709      }
14710    };
14711    if (json.has("physicalCharacteristics"))
14712      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
14713    if (json.has("otherCharacteristics")) {
14714      JsonArray array = json.getAsJsonArray("otherCharacteristics");
14715      for (int i = 0; i < array.size(); i++) {
14716        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14717      }
14718    };
14719    if (json.has("batchIdentifier")) {
14720      JsonArray array = json.getAsJsonArray("batchIdentifier");
14721      for (int i = 0; i < array.size(); i++) {
14722        res.getBatchIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14723      }
14724    };
14725    if (json.has("manufacturer")) {
14726      JsonArray array = json.getAsJsonArray("manufacturer");
14727      for (int i = 0; i < array.size(); i++) {
14728        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
14729      }
14730    };
14731    if (json.has("material")) {
14732      JsonArray array = json.getAsJsonArray("material");
14733      for (int i = 0; i < array.size(); i++) {
14734        res.getMaterial().add(parseMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponent(array.get(i).getAsJsonObject(), res));
14735      }
14736    };
14737  }
14738
14739  protected MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent parseMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponent(JsonObject json, MedicinalProductDeviceSpec owner) throws IOException, FHIRFormatError {
14740    MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent res = new MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent();
14741    parseMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponentProperties(json, owner, res);
14742    return res;
14743  }
14744
14745  protected void parseMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponentProperties(JsonObject json, MedicinalProductDeviceSpec owner, MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent res) throws IOException, FHIRFormatError {
14746    parseBackboneElementProperties(json, res);
14747    if (json.has("substance"))
14748      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
14749    if (json.has("alternate"))
14750      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
14751    if (json.has("_alternate"))
14752      parseElementProperties(json.getAsJsonObject("_alternate"), res.getAlternateElement());
14753    if (json.has("allergenicIndicator"))
14754      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
14755    if (json.has("_allergenicIndicator"))
14756      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
14757  }
14758
14759  protected MedicinalProductIngredient parseMedicinalProductIngredient(JsonObject json) throws IOException, FHIRFormatError {
14760    MedicinalProductIngredient res = new MedicinalProductIngredient();
14761    parseMedicinalProductIngredientProperties(json, res);
14762    return res;
14763  }
14764
14765  protected void parseMedicinalProductIngredientProperties(JsonObject json, MedicinalProductIngredient res) throws IOException, FHIRFormatError {
14766    parseDomainResourceProperties(json, res);
14767    if (json.has("identifier"))
14768      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
14769    if (json.has("role"))
14770      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
14771    if (json.has("allergenicIndicator"))
14772      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
14773    if (json.has("_allergenicIndicator"))
14774      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
14775    if (json.has("manufacturer")) {
14776      JsonArray array = json.getAsJsonArray("manufacturer");
14777      for (int i = 0; i < array.size(); i++) {
14778        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
14779      }
14780    };
14781    if (json.has("specifiedSubstance")) {
14782      JsonArray array = json.getAsJsonArray("specifiedSubstance");
14783      for (int i = 0; i < array.size(); i++) {
14784        res.getSpecifiedSubstance().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(array.get(i).getAsJsonObject(), res));
14785      }
14786    };
14787    if (json.has("substance"))
14788      res.setSubstance(parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(json.getAsJsonObject("substance"), res));
14789  }
14790
14791  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
14792    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent();
14793    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(json, owner, res);
14794    return res;
14795  }
14796
14797  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res) throws IOException, FHIRFormatError {
14798    parseBackboneElementProperties(json, res);
14799    if (json.has("code"))
14800      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14801    if (json.has("group"))
14802      res.setGroup(parseCodeableConcept(json.getAsJsonObject("group")));
14803    if (json.has("confidentiality"))
14804      res.setConfidentiality(parseCodeableConcept(json.getAsJsonObject("confidentiality")));
14805    if (json.has("strength")) {
14806      JsonArray array = json.getAsJsonArray("strength");
14807      for (int i = 0; i < array.size(); i++) {
14808        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
14809      }
14810    };
14811  }
14812
14813  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
14814    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent();
14815    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(json, owner, res);
14816    return res;
14817  }
14818
14819  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res) throws IOException, FHIRFormatError {
14820    parseBackboneElementProperties(json, res);
14821    if (json.has("presentation"))
14822      res.setPresentation(parseRatio(json.getAsJsonObject("presentation")));
14823    if (json.has("concentration"))
14824      res.setConcentration(parseRatio(json.getAsJsonObject("concentration")));
14825    if (json.has("measurementPoint"))
14826      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
14827    if (json.has("_measurementPoint"))
14828      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
14829    if (json.has("country")) {
14830      JsonArray array = json.getAsJsonArray("country");
14831      for (int i = 0; i < array.size(); i++) {
14832        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14833      }
14834    };
14835    if (json.has("referenceStrength")) {
14836      JsonArray array = json.getAsJsonArray("referenceStrength");
14837      for (int i = 0; i < array.size(); i++) {
14838        res.getReferenceStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(array.get(i).getAsJsonObject(), owner));
14839      }
14840    };
14841  }
14842
14843  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
14844    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent();
14845    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(json, owner, res);
14846    return res;
14847  }
14848
14849  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res) throws IOException, FHIRFormatError {
14850    parseBackboneElementProperties(json, res);
14851    if (json.has("substance"))
14852      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
14853  }
14854
14855  protected MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
14856    MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent();
14857    parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(json, owner, res);
14858    return res;
14859  }
14860
14861  protected void parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res) throws IOException, FHIRFormatError {
14862    parseBackboneElementProperties(json, res);
14863    if (json.has("code"))
14864      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14865    if (json.has("strength")) {
14866      JsonArray array = json.getAsJsonArray("strength");
14867      for (int i = 0; i < array.size(); i++) {
14868        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
14869      }
14870    };
14871  }
14872
14873  protected MedicinalProductPackaged parseMedicinalProductPackaged(JsonObject json) throws IOException, FHIRFormatError {
14874    MedicinalProductPackaged res = new MedicinalProductPackaged();
14875    parseMedicinalProductPackagedProperties(json, res);
14876    return res;
14877  }
14878
14879  protected void parseMedicinalProductPackagedProperties(JsonObject json, MedicinalProductPackaged res) throws IOException, FHIRFormatError {
14880    parseDomainResourceProperties(json, res);
14881    if (json.has("identifier"))
14882      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
14883    if (json.has("description"))
14884      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14885    if (json.has("_description"))
14886      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14887    if (json.has("marketingStatus")) {
14888      JsonArray array = json.getAsJsonArray("marketingStatus");
14889      for (int i = 0; i < array.size(); i++) {
14890        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
14891      }
14892    };
14893    if (json.has("batchIdentifier")) {
14894      JsonArray array = json.getAsJsonArray("batchIdentifier");
14895      for (int i = 0; i < array.size(); i++) {
14896        res.getBatchIdentifier().add(parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(array.get(i).getAsJsonObject(), res));
14897      }
14898    };
14899    if (json.has("packageItem")) {
14900      JsonArray array = json.getAsJsonArray("packageItem");
14901      for (int i = 0; i < array.size(); i++) {
14902        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), res));
14903      }
14904    };
14905  }
14906
14907  protected MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
14908    MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res = new MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent();
14909    parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(json, owner, res);
14910    return res;
14911  }
14912
14913  protected void parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res) throws IOException, FHIRFormatError {
14914    parseBackboneElementProperties(json, res);
14915    if (json.has("outerPackaging"))
14916      res.setOuterPackaging(parseIdentifier(json.getAsJsonObject("outerPackaging")));
14917    if (json.has("immediatePackaging"))
14918      res.setImmediatePackaging(parseIdentifier(json.getAsJsonObject("immediatePackaging")));
14919  }
14920
14921  protected MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
14922    MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res = new MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent();
14923    parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(json, owner, res);
14924    return res;
14925  }
14926
14927  protected void parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res) throws IOException, FHIRFormatError {
14928    parseBackboneElementProperties(json, res);
14929    if (json.has("identifier")) {
14930      JsonArray array = json.getAsJsonArray("identifier");
14931      for (int i = 0; i < array.size(); i++) {
14932        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14933      }
14934    };
14935    if (json.has("type"))
14936      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14937    if (json.has("quantity"))
14938      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
14939    if (json.has("material")) {
14940      JsonArray array = json.getAsJsonArray("material");
14941      for (int i = 0; i < array.size(); i++) {
14942        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14943      }
14944    };
14945    if (json.has("alternateMaterial")) {
14946      JsonArray array = json.getAsJsonArray("alternateMaterial");
14947      for (int i = 0; i < array.size(); i++) {
14948        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14949      }
14950    };
14951    if (json.has("manufacturer")) {
14952      JsonArray array = json.getAsJsonArray("manufacturer");
14953      for (int i = 0; i < array.size(); i++) {
14954        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
14955      }
14956    };
14957    if (json.has("device")) {
14958      JsonArray array = json.getAsJsonArray("device");
14959      for (int i = 0; i < array.size(); i++) {
14960        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
14961      }
14962    };
14963    if (json.has("manufacturedItem")) {
14964      JsonArray array = json.getAsJsonArray("manufacturedItem");
14965      for (int i = 0; i < array.size(); i++) {
14966        res.getManufacturedItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemManufacturedItemComponent(array.get(i).getAsJsonObject(), owner));
14967      }
14968    };
14969    if (json.has("otherCharacteristics")) {
14970      JsonArray array = json.getAsJsonArray("otherCharacteristics");
14971      for (int i = 0; i < array.size(); i++) {
14972        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14973      }
14974    };
14975    if (json.has("packageItem")) {
14976      JsonArray array = json.getAsJsonArray("packageItem");
14977      for (int i = 0; i < array.size(); i++) {
14978        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), owner));
14979      }
14980    };
14981    if (json.has("physicalCharacteristics"))
14982      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
14983    if (json.has("shelfLifeStorage")) {
14984      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
14985      for (int i = 0; i < array.size(); i++) {
14986        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
14987      }
14988    };
14989  }
14990
14991  protected MedicinalProductPackaged.MedicinalProductPackagedPackageItemManufacturedItemComponent parseMedicinalProductPackagedMedicinalProductPackagedPackageItemManufacturedItemComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
14992    MedicinalProductPackaged.MedicinalProductPackagedPackageItemManufacturedItemComponent res = new MedicinalProductPackaged.MedicinalProductPackagedPackageItemManufacturedItemComponent();
14993    parseMedicinalProductPackagedMedicinalProductPackagedPackageItemManufacturedItemComponentProperties(json, owner, res);
14994    return res;
14995  }
14996
14997  protected void parseMedicinalProductPackagedMedicinalProductPackagedPackageItemManufacturedItemComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedPackageItemManufacturedItemComponent res) throws IOException, FHIRFormatError {
14998    parseBackboneElementProperties(json, res);
14999    if (json.has("manufacturedDoseForm"))
15000      res.setManufacturedDoseForm(parseCodeableConcept(json.getAsJsonObject("manufacturedDoseForm")));
15001    if (json.has("unitOfPresentation"))
15002      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
15003    if (json.has("quantity"))
15004      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
15005    if (json.has("xManufacturer")) {
15006      JsonArray array = json.getAsJsonArray("xManufacturer");
15007      for (int i = 0; i < array.size(); i++) {
15008        res.getXManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
15009      }
15010    };
15011    if (json.has("ingredient")) {
15012      JsonArray array = json.getAsJsonArray("ingredient");
15013      for (int i = 0; i < array.size(); i++) {
15014        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
15015      }
15016    };
15017    if (json.has("physicalCharacteristics"))
15018      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
15019  }
15020
15021  protected MedicinalProductPharmaceutical parseMedicinalProductPharmaceutical(JsonObject json) throws IOException, FHIRFormatError {
15022    MedicinalProductPharmaceutical res = new MedicinalProductPharmaceutical();
15023    parseMedicinalProductPharmaceuticalProperties(json, res);
15024    return res;
15025  }
15026
15027  protected void parseMedicinalProductPharmaceuticalProperties(JsonObject json, MedicinalProductPharmaceutical res) throws IOException, FHIRFormatError {
15028    parseDomainResourceProperties(json, res);
15029    if (json.has("identifier")) {
15030      JsonArray array = json.getAsJsonArray("identifier");
15031      for (int i = 0; i < array.size(); i++) {
15032        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15033      }
15034    };
15035    if (json.has("administrableDoseForm"))
15036      res.setAdministrableDoseForm(parseCodeableConcept(json.getAsJsonObject("administrableDoseForm")));
15037    if (json.has("unitOfPresentation"))
15038      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
15039    if (json.has("routeOfAdministration")) {
15040      JsonArray array = json.getAsJsonArray("routeOfAdministration");
15041      for (int i = 0; i < array.size(); i++) {
15042        res.getRouteOfAdministration().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15043      }
15044    };
15045    if (json.has("ingredient")) {
15046      JsonArray array = json.getAsJsonArray("ingredient");
15047      for (int i = 0; i < array.size(); i++) {
15048        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
15049      }
15050    };
15051    if (json.has("device")) {
15052      JsonArray array = json.getAsJsonArray("device");
15053      for (int i = 0; i < array.size(); i++) {
15054        res.getDevice().add(parseString(array.get(i).getAsString()));
15055      }
15056    };
15057    if (json.has("_device")) {
15058      JsonArray array = json.getAsJsonArray("_device");
15059      for (int i = 0; i < array.size(); i++) {
15060        if (i == res.getDevice().size())
15061          res.getDevice().add(parseString(null));
15062        if (array.get(i) instanceof JsonObject) 
15063          parseElementProperties(array.get(i).getAsJsonObject(), res.getDevice().get(i));
15064      }
15065    };
15066    if (json.has("characteristics")) {
15067      JsonArray array = json.getAsJsonArray("characteristics");
15068      for (int i = 0; i < array.size(); i++) {
15069        res.getCharacteristics().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(array.get(i).getAsJsonObject(), res));
15070      }
15071    };
15072  }
15073
15074  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
15075    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent();
15076    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(json, owner, res);
15077    return res;
15078  }
15079
15080  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res) throws IOException, FHIRFormatError {
15081    parseBackboneElementProperties(json, res);
15082    if (json.has("code"))
15083      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15084    if (json.has("status"))
15085      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
15086  }
15087
15088  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
15089    MessageDefinition res = new MessageDefinition();
15090    parseMessageDefinitionProperties(json, res);
15091    return res;
15092  }
15093
15094  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
15095    parseDomainResourceProperties(json, res);
15096    if (json.has("url"))
15097      res.setUrlElement(parseUri(json.get("url").getAsString()));
15098    if (json.has("_url"))
15099      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
15100    if (json.has("identifier"))
15101      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
15102    if (json.has("version"))
15103      res.setVersionElement(parseString(json.get("version").getAsString()));
15104    if (json.has("_version"))
15105      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15106    if (json.has("name"))
15107      res.setNameElement(parseString(json.get("name").getAsString()));
15108    if (json.has("_name"))
15109      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15110    if (json.has("title"))
15111      res.setTitleElement(parseString(json.get("title").getAsString()));
15112    if (json.has("_title"))
15113      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15114    if (json.has("replaces")) {
15115      JsonArray array = json.getAsJsonArray("replaces");
15116      for (int i = 0; i < array.size(); i++) {
15117        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
15118      }
15119    };
15120    if (json.has("_replaces")) {
15121      JsonArray array = json.getAsJsonArray("_replaces");
15122      for (int i = 0; i < array.size(); i++) {
15123        if (i == res.getReplaces().size())
15124          res.getReplaces().add(parseCanonical(null));
15125        if (array.get(i) instanceof JsonObject) 
15126          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
15127      }
15128    };
15129    if (json.has("status"))
15130      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15131    if (json.has("_status"))
15132      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15133    if (json.has("experimental"))
15134      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15135    if (json.has("_experimental"))
15136      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
15137    if (json.has("date"))
15138      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15139    if (json.has("_date"))
15140      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15141    if (json.has("publisher"))
15142      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15143    if (json.has("_publisher"))
15144      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
15145    if (json.has("contact")) {
15146      JsonArray array = json.getAsJsonArray("contact");
15147      for (int i = 0; i < array.size(); i++) {
15148        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15149      }
15150    };
15151    if (json.has("description"))
15152      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15153    if (json.has("_description"))
15154      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15155    if (json.has("useContext")) {
15156      JsonArray array = json.getAsJsonArray("useContext");
15157      for (int i = 0; i < array.size(); i++) {
15158        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15159      }
15160    };
15161    if (json.has("jurisdiction")) {
15162      JsonArray array = json.getAsJsonArray("jurisdiction");
15163      for (int i = 0; i < array.size(); i++) {
15164        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15165      }
15166    };
15167    if (json.has("purpose"))
15168      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15169    if (json.has("_purpose"))
15170      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
15171    if (json.has("copyright"))
15172      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15173    if (json.has("_copyright"))
15174      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
15175    if (json.has("base"))
15176      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
15177    if (json.has("_base"))
15178      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
15179    if (json.has("parent")) {
15180      JsonArray array = json.getAsJsonArray("parent");
15181      for (int i = 0; i < array.size(); i++) {
15182        res.getParent().add(parseCanonical(array.get(i).getAsString()));
15183      }
15184    };
15185    if (json.has("_parent")) {
15186      JsonArray array = json.getAsJsonArray("_parent");
15187      for (int i = 0; i < array.size(); i++) {
15188        if (i == res.getParent().size())
15189          res.getParent().add(parseCanonical(null));
15190        if (array.get(i) instanceof JsonObject) 
15191          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
15192      }
15193    };
15194    Type event = parseType("event", json);
15195    if (event != null)
15196      res.setEvent(event);
15197    if (json.has("category"))
15198      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
15199    if (json.has("_category"))
15200      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
15201    if (json.has("focus")) {
15202      JsonArray array = json.getAsJsonArray("focus");
15203      for (int i = 0; i < array.size(); i++) {
15204        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
15205      }
15206    };
15207    if (json.has("responseRequired"))
15208      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(), MessageDefinition.MessageheaderResponseRequest.NULL, new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
15209    if (json.has("_responseRequired"))
15210      parseElementProperties(json.getAsJsonObject("_responseRequired"), res.getResponseRequiredElement());
15211    if (json.has("allowedResponse")) {
15212      JsonArray array = json.getAsJsonArray("allowedResponse");
15213      for (int i = 0; i < array.size(); i++) {
15214        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
15215      }
15216    };
15217  }
15218
15219  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
15220    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
15221    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
15222    return res;
15223  }
15224
15225  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
15226    parseBackboneElementProperties(json, res);
15227    if (json.has("code"))
15228      res.setCodeElement(parseCode(json.get("code").getAsString()));
15229    if (json.has("_code"))
15230      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
15231    if (json.has("profile"))
15232      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
15233    if (json.has("_profile"))
15234      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
15235    if (json.has("min"))
15236      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
15237    if (json.has("_min"))
15238      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
15239    if (json.has("max"))
15240      res.setMaxElement(parseString(json.get("max").getAsString()));
15241    if (json.has("_max"))
15242      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
15243  }
15244
15245  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
15246    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
15247    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
15248    return res;
15249  }
15250
15251  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
15252    parseBackboneElementProperties(json, res);
15253    if (json.has("message"))
15254      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
15255    if (json.has("_message"))
15256      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
15257    if (json.has("situation"))
15258      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
15259    if (json.has("_situation"))
15260      parseElementProperties(json.getAsJsonObject("_situation"), res.getSituationElement());
15261  }
15262
15263  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
15264    MessageHeader res = new MessageHeader();
15265    parseMessageHeaderProperties(json, res);
15266    return res;
15267  }
15268
15269  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
15270    parseDomainResourceProperties(json, res);
15271    Type event = parseType("event", json);
15272    if (event != null)
15273      res.setEvent(event);
15274    if (json.has("destination")) {
15275      JsonArray array = json.getAsJsonArray("destination");
15276      for (int i = 0; i < array.size(); i++) {
15277        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
15278      }
15279    };
15280    if (json.has("sender"))
15281      res.setSender(parseReference(json.getAsJsonObject("sender")));
15282    if (json.has("enterer"))
15283      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
15284    if (json.has("author"))
15285      res.setAuthor(parseReference(json.getAsJsonObject("author")));
15286    if (json.has("source"))
15287      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source"), res));
15288    if (json.has("responsible"))
15289      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
15290    if (json.has("reason"))
15291      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
15292    if (json.has("response"))
15293      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(json.getAsJsonObject("response"), res));
15294    if (json.has("focus")) {
15295      JsonArray array = json.getAsJsonArray("focus");
15296      for (int i = 0; i < array.size(); i++) {
15297        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
15298      }
15299    };
15300    if (json.has("definition"))
15301      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
15302    if (json.has("_definition"))
15303      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
15304  }
15305
15306  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
15307    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
15308    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
15309    return res;
15310  }
15311
15312  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
15313    parseBackboneElementProperties(json, res);
15314    if (json.has("name"))
15315      res.setNameElement(parseString(json.get("name").getAsString()));
15316    if (json.has("_name"))
15317      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15318    if (json.has("target"))
15319      res.setTarget(parseReference(json.getAsJsonObject("target")));
15320    if (json.has("endpoint"))
15321      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
15322    if (json.has("_endpoint"))
15323      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
15324    if (json.has("receiver"))
15325      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
15326  }
15327
15328  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
15329    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
15330    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
15331    return res;
15332  }
15333
15334  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
15335    parseBackboneElementProperties(json, res);
15336    if (json.has("name"))
15337      res.setNameElement(parseString(json.get("name").getAsString()));
15338    if (json.has("_name"))
15339      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15340    if (json.has("software"))
15341      res.setSoftwareElement(parseString(json.get("software").getAsString()));
15342    if (json.has("_software"))
15343      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
15344    if (json.has("version"))
15345      res.setVersionElement(parseString(json.get("version").getAsString()));
15346    if (json.has("_version"))
15347      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15348    if (json.has("contact"))
15349      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
15350    if (json.has("endpoint"))
15351      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
15352    if (json.has("_endpoint"))
15353      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
15354  }
15355
15356  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
15357    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
15358    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
15359    return res;
15360  }
15361
15362  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
15363    parseBackboneElementProperties(json, res);
15364    if (json.has("identifier"))
15365      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
15366    if (json.has("_identifier"))
15367      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
15368    if (json.has("code"))
15369      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
15370    if (json.has("_code"))
15371      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
15372    if (json.has("details"))
15373      res.setDetails(parseReference(json.getAsJsonObject("details")));
15374  }
15375
15376  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
15377    NamingSystem res = new NamingSystem();
15378    parseNamingSystemProperties(json, res);
15379    return res;
15380  }
15381
15382  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
15383    parseDomainResourceProperties(json, res);
15384    if (json.has("name"))
15385      res.setNameElement(parseString(json.get("name").getAsString()));
15386    if (json.has("_name"))
15387      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15388    if (json.has("status"))
15389      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15390    if (json.has("_status"))
15391      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15392    if (json.has("kind"))
15393      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
15394    if (json.has("_kind"))
15395      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
15396    if (json.has("date"))
15397      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15398    if (json.has("_date"))
15399      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15400    if (json.has("publisher"))
15401      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15402    if (json.has("_publisher"))
15403      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
15404    if (json.has("contact")) {
15405      JsonArray array = json.getAsJsonArray("contact");
15406      for (int i = 0; i < array.size(); i++) {
15407        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15408      }
15409    };
15410    if (json.has("responsible"))
15411      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
15412    if (json.has("_responsible"))
15413      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
15414    if (json.has("type"))
15415      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15416    if (json.has("description"))
15417      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15418    if (json.has("_description"))
15419      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15420    if (json.has("useContext")) {
15421      JsonArray array = json.getAsJsonArray("useContext");
15422      for (int i = 0; i < array.size(); i++) {
15423        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15424      }
15425    };
15426    if (json.has("jurisdiction")) {
15427      JsonArray array = json.getAsJsonArray("jurisdiction");
15428      for (int i = 0; i < array.size(); i++) {
15429        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15430      }
15431    };
15432    if (json.has("usage"))
15433      res.setUsageElement(parseString(json.get("usage").getAsString()));
15434    if (json.has("_usage"))
15435      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
15436    if (json.has("uniqueId")) {
15437      JsonArray array = json.getAsJsonArray("uniqueId");
15438      for (int i = 0; i < array.size(); i++) {
15439        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
15440      }
15441    };
15442  }
15443
15444  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
15445    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
15446    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
15447    return res;
15448  }
15449
15450  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
15451    parseBackboneElementProperties(json, res);
15452    if (json.has("type"))
15453      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
15454    if (json.has("_type"))
15455      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
15456    if (json.has("value"))
15457      res.setValueElement(parseString(json.get("value").getAsString()));
15458    if (json.has("_value"))
15459      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
15460    if (json.has("preferred"))
15461      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
15462    if (json.has("_preferred"))
15463      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
15464    if (json.has("comment"))
15465      res.setCommentElement(parseString(json.get("comment").getAsString()));
15466    if (json.has("_comment"))
15467      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
15468    if (json.has("period"))
15469      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15470  }
15471
15472  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
15473    NutritionOrder res = new NutritionOrder();
15474    parseNutritionOrderProperties(json, res);
15475    return res;
15476  }
15477
15478  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
15479    parseDomainResourceProperties(json, res);
15480    if (json.has("identifier")) {
15481      JsonArray array = json.getAsJsonArray("identifier");
15482      for (int i = 0; i < array.size(); i++) {
15483        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15484      }
15485    };
15486    if (json.has("instantiates")) {
15487      JsonArray array = json.getAsJsonArray("instantiates");
15488      for (int i = 0; i < array.size(); i++) {
15489        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
15490      }
15491    };
15492    if (json.has("_instantiates")) {
15493      JsonArray array = json.getAsJsonArray("_instantiates");
15494      for (int i = 0; i < array.size(); i++) {
15495        if (i == res.getInstantiates().size())
15496          res.getInstantiates().add(parseUri(null));
15497        if (array.get(i) instanceof JsonObject) 
15498          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
15499      }
15500    };
15501    if (json.has("status"))
15502      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
15503    if (json.has("_status"))
15504      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15505    if (json.has("intent"))
15506      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), NutritionOrder.NutritiionOrderIntent.NULL, new NutritionOrder.NutritiionOrderIntentEnumFactory()));
15507    if (json.has("_intent"))
15508      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
15509    if (json.has("patient"))
15510      res.setPatient(parseReference(json.getAsJsonObject("patient")));
15511    if (json.has("context"))
15512      res.setContext(parseReference(json.getAsJsonObject("context")));
15513    if (json.has("dateTime"))
15514      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
15515    if (json.has("_dateTime"))
15516      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
15517    if (json.has("orderer"))
15518      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
15519    if (json.has("allergyIntolerance")) {
15520      JsonArray array = json.getAsJsonArray("allergyIntolerance");
15521      for (int i = 0; i < array.size(); i++) {
15522        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
15523      }
15524    };
15525    if (json.has("foodPreferenceModifier")) {
15526      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
15527      for (int i = 0; i < array.size(); i++) {
15528        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15529      }
15530    };
15531    if (json.has("excludeFoodModifier")) {
15532      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
15533      for (int i = 0; i < array.size(); i++) {
15534        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15535      }
15536    };
15537    if (json.has("oralDiet"))
15538      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet"), res));
15539    if (json.has("supplement")) {
15540      JsonArray array = json.getAsJsonArray("supplement");
15541      for (int i = 0; i < array.size(); i++) {
15542        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
15543      }
15544    };
15545    if (json.has("enteralFormula"))
15546      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula"), res));
15547    if (json.has("note")) {
15548      JsonArray array = json.getAsJsonArray("note");
15549      for (int i = 0; i < array.size(); i++) {
15550        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15551      }
15552    };
15553  }
15554
15555  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
15556    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
15557    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
15558    return res;
15559  }
15560
15561  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
15562    parseBackboneElementProperties(json, res);
15563    if (json.has("type")) {
15564      JsonArray array = json.getAsJsonArray("type");
15565      for (int i = 0; i < array.size(); i++) {
15566        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15567      }
15568    };
15569    if (json.has("schedule")) {
15570      JsonArray array = json.getAsJsonArray("schedule");
15571      for (int i = 0; i < array.size(); i++) {
15572        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
15573      }
15574    };
15575    if (json.has("nutrient")) {
15576      JsonArray array = json.getAsJsonArray("nutrient");
15577      for (int i = 0; i < array.size(); i++) {
15578        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
15579      }
15580    };
15581    if (json.has("texture")) {
15582      JsonArray array = json.getAsJsonArray("texture");
15583      for (int i = 0; i < array.size(); i++) {
15584        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
15585      }
15586    };
15587    if (json.has("fluidConsistencyType")) {
15588      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
15589      for (int i = 0; i < array.size(); i++) {
15590        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15591      }
15592    };
15593    if (json.has("instruction"))
15594      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
15595    if (json.has("_instruction"))
15596      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
15597  }
15598
15599  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
15600    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
15601    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
15602    return res;
15603  }
15604
15605  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
15606    parseBackboneElementProperties(json, res);
15607    if (json.has("modifier"))
15608      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
15609    if (json.has("amount"))
15610      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
15611  }
15612
15613  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
15614    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
15615    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
15616    return res;
15617  }
15618
15619  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
15620    parseBackboneElementProperties(json, res);
15621    if (json.has("modifier"))
15622      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
15623    if (json.has("foodType"))
15624      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
15625  }
15626
15627  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
15628    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
15629    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
15630    return res;
15631  }
15632
15633  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
15634    parseBackboneElementProperties(json, res);
15635    if (json.has("type"))
15636      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15637    if (json.has("productName"))
15638      res.setProductNameElement(parseString(json.get("productName").getAsString()));
15639    if (json.has("_productName"))
15640      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
15641    if (json.has("schedule")) {
15642      JsonArray array = json.getAsJsonArray("schedule");
15643      for (int i = 0; i < array.size(); i++) {
15644        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
15645      }
15646    };
15647    if (json.has("quantity"))
15648      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
15649    if (json.has("instruction"))
15650      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
15651    if (json.has("_instruction"))
15652      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
15653  }
15654
15655  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
15656    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
15657    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
15658    return res;
15659  }
15660
15661  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
15662    parseBackboneElementProperties(json, res);
15663    if (json.has("baseFormulaType"))
15664      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
15665    if (json.has("baseFormulaProductName"))
15666      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
15667    if (json.has("_baseFormulaProductName"))
15668      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
15669    if (json.has("additiveType"))
15670      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
15671    if (json.has("additiveProductName"))
15672      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
15673    if (json.has("_additiveProductName"))
15674      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
15675    if (json.has("caloricDensity"))
15676      res.setCaloricDensity(parseSimpleQuantity(json.getAsJsonObject("caloricDensity")));
15677    if (json.has("routeofAdministration"))
15678      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
15679    if (json.has("administration")) {
15680      JsonArray array = json.getAsJsonArray("administration");
15681      for (int i = 0; i < array.size(); i++) {
15682        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
15683      }
15684    };
15685    if (json.has("maxVolumeToDeliver"))
15686      res.setMaxVolumeToDeliver(parseSimpleQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
15687    if (json.has("administrationInstruction"))
15688      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
15689    if (json.has("_administrationInstruction"))
15690      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
15691  }
15692
15693  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
15694    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
15695    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
15696    return res;
15697  }
15698
15699  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
15700    parseBackboneElementProperties(json, res);
15701    if (json.has("schedule"))
15702      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
15703    if (json.has("quantity"))
15704      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
15705    Type rate = parseType("rate", json);
15706    if (rate != null)
15707      res.setRate(rate);
15708  }
15709
15710  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
15711    Observation res = new Observation();
15712    parseObservationProperties(json, res);
15713    return res;
15714  }
15715
15716  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
15717    parseDomainResourceProperties(json, res);
15718    if (json.has("identifier")) {
15719      JsonArray array = json.getAsJsonArray("identifier");
15720      for (int i = 0; i < array.size(); i++) {
15721        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15722      }
15723    };
15724    if (json.has("basedOn")) {
15725      JsonArray array = json.getAsJsonArray("basedOn");
15726      for (int i = 0; i < array.size(); i++) {
15727        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15728      }
15729    };
15730    if (json.has("partOf")) {
15731      JsonArray array = json.getAsJsonArray("partOf");
15732      for (int i = 0; i < array.size(); i++) {
15733        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15734      }
15735    };
15736    if (json.has("status"))
15737      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
15738    if (json.has("_status"))
15739      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15740    if (json.has("category")) {
15741      JsonArray array = json.getAsJsonArray("category");
15742      for (int i = 0; i < array.size(); i++) {
15743        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15744      }
15745    };
15746    if (json.has("code"))
15747      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15748    if (json.has("subject"))
15749      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15750    if (json.has("focus"))
15751      res.setFocus(parseReference(json.getAsJsonObject("focus")));
15752    if (json.has("context"))
15753      res.setContext(parseReference(json.getAsJsonObject("context")));
15754    Type effective = parseType("effective", json);
15755    if (effective != null)
15756      res.setEffective(effective);
15757    if (json.has("issued"))
15758      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
15759    if (json.has("_issued"))
15760      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
15761    if (json.has("performer")) {
15762      JsonArray array = json.getAsJsonArray("performer");
15763      for (int i = 0; i < array.size(); i++) {
15764        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
15765      }
15766    };
15767    Type value = parseType("value", json);
15768    if (value != null)
15769      res.setValue(value);
15770    if (json.has("dataAbsentReason"))
15771      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
15772    if (json.has("interpretation"))
15773      res.setInterpretation(parseCodeableConcept(json.getAsJsonObject("interpretation")));
15774    if (json.has("comment"))
15775      res.setCommentElement(parseString(json.get("comment").getAsString()));
15776    if (json.has("_comment"))
15777      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
15778    if (json.has("bodySite"))
15779      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
15780    if (json.has("method"))
15781      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
15782    if (json.has("specimen"))
15783      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
15784    if (json.has("device"))
15785      res.setDevice(parseReference(json.getAsJsonObject("device")));
15786    if (json.has("referenceRange")) {
15787      JsonArray array = json.getAsJsonArray("referenceRange");
15788      for (int i = 0; i < array.size(); i++) {
15789        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
15790      }
15791    };
15792    if (json.has("hasMember")) {
15793      JsonArray array = json.getAsJsonArray("hasMember");
15794      for (int i = 0; i < array.size(); i++) {
15795        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
15796      }
15797    };
15798    if (json.has("derivedFrom")) {
15799      JsonArray array = json.getAsJsonArray("derivedFrom");
15800      for (int i = 0; i < array.size(); i++) {
15801        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
15802      }
15803    };
15804    if (json.has("component")) {
15805      JsonArray array = json.getAsJsonArray("component");
15806      for (int i = 0; i < array.size(); i++) {
15807        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
15808      }
15809    };
15810  }
15811
15812  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
15813    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
15814    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
15815    return res;
15816  }
15817
15818  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
15819    parseBackboneElementProperties(json, res);
15820    if (json.has("low"))
15821      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
15822    if (json.has("high"))
15823      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
15824    if (json.has("type"))
15825      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15826    if (json.has("appliesTo")) {
15827      JsonArray array = json.getAsJsonArray("appliesTo");
15828      for (int i = 0; i < array.size(); i++) {
15829        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15830      }
15831    };
15832    if (json.has("age"))
15833      res.setAge(parseRange(json.getAsJsonObject("age")));
15834    if (json.has("text"))
15835      res.setTextElement(parseString(json.get("text").getAsString()));
15836    if (json.has("_text"))
15837      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
15838  }
15839
15840  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
15841    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
15842    parseObservationObservationComponentComponentProperties(json, owner, res);
15843    return res;
15844  }
15845
15846  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
15847    parseBackboneElementProperties(json, res);
15848    if (json.has("code"))
15849      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15850    Type value = parseType("value", json);
15851    if (value != null)
15852      res.setValue(value);
15853    if (json.has("dataAbsentReason"))
15854      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
15855    if (json.has("interpretation"))
15856      res.setInterpretation(parseCodeableConcept(json.getAsJsonObject("interpretation")));
15857    if (json.has("referenceRange")) {
15858      JsonArray array = json.getAsJsonArray("referenceRange");
15859      for (int i = 0; i < array.size(); i++) {
15860        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
15861      }
15862    };
15863  }
15864
15865  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
15866    ObservationDefinition res = new ObservationDefinition();
15867    parseObservationDefinitionProperties(json, res);
15868    return res;
15869  }
15870
15871  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res) throws IOException, FHIRFormatError {
15872    parseDomainResourceProperties(json, res);
15873    if (json.has("category"))
15874      res.setCategory(parseCoding(json.getAsJsonObject("category")));
15875    if (json.has("code"))
15876      res.setCode(parseCoding(json.getAsJsonObject("code")));
15877    if (json.has("permittedDataType")) {
15878      JsonArray array = json.getAsJsonArray("permittedDataType");
15879      for (int i = 0; i < array.size(); i++) {
15880        res.getPermittedDataType().add(parseCoding(array.get(i).getAsJsonObject()));
15881      }
15882    };
15883    if (json.has("multipleResultsAllowed"))
15884      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
15885    if (json.has("_multipleResultsAllowed"))
15886      parseElementProperties(json.getAsJsonObject("_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
15887    if (json.has("method"))
15888      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
15889    if (json.has("preferredReportName"))
15890      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
15891    if (json.has("_preferredReportName"))
15892      parseElementProperties(json.getAsJsonObject("_preferredReportName"), res.getPreferredReportNameElement());
15893    if (json.has("quantitativeDetails"))
15894      res.setQuantitativeDetails(parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(json.getAsJsonObject("quantitativeDetails"), res));
15895    if (json.has("qualifiedInterval")) {
15896      JsonArray array = json.getAsJsonArray("qualifiedInterval");
15897      for (int i = 0; i < array.size(); i++) {
15898        res.getQualifiedInterval().add(parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject(), res));
15899      }
15900    };
15901    if (json.has("validCodedValueSet"))
15902      res.setValidCodedValueSetElement(parseUri(json.get("validCodedValueSet").getAsString()));
15903    if (json.has("_validCodedValueSet"))
15904      parseElementProperties(json.getAsJsonObject("_validCodedValueSet"), res.getValidCodedValueSetElement());
15905    if (json.has("normalCodedValueSet"))
15906      res.setNormalCodedValueSetElement(parseUri(json.get("normalCodedValueSet").getAsString()));
15907    if (json.has("_normalCodedValueSet"))
15908      parseElementProperties(json.getAsJsonObject("_normalCodedValueSet"), res.getNormalCodedValueSetElement());
15909    if (json.has("abnormalCodedValueSet"))
15910      res.setAbnormalCodedValueSetElement(parseUri(json.get("abnormalCodedValueSet").getAsString()));
15911    if (json.has("_abnormalCodedValueSet"))
15912      parseElementProperties(json.getAsJsonObject("_abnormalCodedValueSet"), res.getAbnormalCodedValueSetElement());
15913    if (json.has("criticalCodedValueSet"))
15914      res.setCriticalCodedValueSetElement(parseUri(json.get("criticalCodedValueSet").getAsString()));
15915    if (json.has("_criticalCodedValueSet"))
15916      parseElementProperties(json.getAsJsonObject("_criticalCodedValueSet"), res.getCriticalCodedValueSetElement());
15917  }
15918
15919  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
15920    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
15921    parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(json, owner, res);
15922    return res;
15923  }
15924
15925  protected void parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res) throws IOException, FHIRFormatError {
15926    parseBackboneElementProperties(json, res);
15927    if (json.has("customaryUnit"))
15928      res.setCustomaryUnit(parseCoding(json.getAsJsonObject("customaryUnit")));
15929    if (json.has("unit"))
15930      res.setUnit(parseCoding(json.getAsJsonObject("unit")));
15931    if (json.has("conversionFactor"))
15932      res.setConversionFactorElement(parseDecimal(json.get("conversionFactor").getAsBigDecimal()));
15933    if (json.has("_conversionFactor"))
15934      parseElementProperties(json.getAsJsonObject("_conversionFactor"), res.getConversionFactorElement());
15935    if (json.has("decimalPrecision"))
15936      res.setDecimalPrecisionElement(parseInteger(json.get("decimalPrecision").getAsLong()));
15937    if (json.has("_decimalPrecision"))
15938      parseElementProperties(json.getAsJsonObject("_decimalPrecision"), res.getDecimalPrecisionElement());
15939  }
15940
15941  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
15942    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
15943    parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(json, owner, res);
15944    return res;
15945  }
15946
15947  protected void parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res) throws IOException, FHIRFormatError {
15948    parseBackboneElementProperties(json, res);
15949    if (json.has("category"))
15950      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
15951    if (json.has("range"))
15952      res.setRange(parseRange(json.getAsJsonObject("range")));
15953    if (json.has("type"))
15954      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15955    if (json.has("appliesTo")) {
15956      JsonArray array = json.getAsJsonArray("appliesTo");
15957      for (int i = 0; i < array.size(); i++) {
15958        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15959      }
15960    };
15961    if (json.has("age"))
15962      res.setAge(parseRange(json.getAsJsonObject("age")));
15963    if (json.has("gestationalAge"))
15964      res.setGestationalAge(parseRange(json.getAsJsonObject("gestationalAge")));
15965    if (json.has("condition"))
15966      res.setConditionElement(parseString(json.get("condition").getAsString()));
15967    if (json.has("_condition"))
15968      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
15969  }
15970
15971  protected OccupationalData parseOccupationalData(JsonObject json) throws IOException, FHIRFormatError {
15972    OccupationalData res = new OccupationalData();
15973    parseOccupationalDataProperties(json, res);
15974    return res;
15975  }
15976
15977  protected void parseOccupationalDataProperties(JsonObject json, OccupationalData res) throws IOException, FHIRFormatError {
15978    parseDomainResourceProperties(json, res);
15979    if (json.has("identifier"))
15980      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
15981    if (json.has("status"))
15982      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15983    if (json.has("_status"))
15984      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15985    if (json.has("subject"))
15986      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15987    if (json.has("date"))
15988      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15989    if (json.has("_date"))
15990      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15991    if (json.has("recorder")) {
15992      JsonArray array = json.getAsJsonArray("recorder");
15993      for (int i = 0; i < array.size(); i++) {
15994        res.getRecorder().add(parseReference(array.get(i).getAsJsonObject()));
15995      }
15996    };
15997    if (json.has("informant")) {
15998      JsonArray array = json.getAsJsonArray("informant");
15999      for (int i = 0; i < array.size(); i++) {
16000        res.getInformant().add(parseReference(array.get(i).getAsJsonObject()));
16001      }
16002    };
16003    if (json.has("employmentStatus")) {
16004      JsonArray array = json.getAsJsonArray("employmentStatus");
16005      for (int i = 0; i < array.size(); i++) {
16006        res.getEmploymentStatus().add(parseOccupationalDataOccupationalDataEmploymentStatusComponent(array.get(i).getAsJsonObject(), res));
16007      }
16008    };
16009    if (json.has("retirementDate")) {
16010      JsonArray array = json.getAsJsonArray("retirementDate");
16011      for (int i = 0; i < array.size(); i++) {
16012        res.getRetirementDate().add(parseDateTime(array.get(i).getAsString()));
16013      }
16014    };
16015    if (json.has("_retirementDate")) {
16016      JsonArray array = json.getAsJsonArray("_retirementDate");
16017      for (int i = 0; i < array.size(); i++) {
16018        if (i == res.getRetirementDate().size())
16019          res.getRetirementDate().add(parseDateTime(null));
16020        if (array.get(i) instanceof JsonObject) 
16021          parseElementProperties(array.get(i).getAsJsonObject(), res.getRetirementDate().get(i));
16022      }
16023    };
16024    if (json.has("combatZonePeriod")) {
16025      JsonArray array = json.getAsJsonArray("combatZonePeriod");
16026      for (int i = 0; i < array.size(); i++) {
16027        res.getCombatZonePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
16028      }
16029    };
16030    if (json.has("usualWork"))
16031      res.setUsualWork(parseOccupationalDataOccupationalDataUsualWorkComponent(json.getAsJsonObject("usualWork"), res));
16032    if (json.has("pastOrPresentJob")) {
16033      JsonArray array = json.getAsJsonArray("pastOrPresentJob");
16034      for (int i = 0; i < array.size(); i++) {
16035        res.getPastOrPresentJob().add(parseOccupationalDataOccupationalDataPastOrPresentJobComponent(array.get(i).getAsJsonObject(), res));
16036      }
16037    };
16038  }
16039
16040  protected OccupationalData.OccupationalDataEmploymentStatusComponent parseOccupationalDataOccupationalDataEmploymentStatusComponent(JsonObject json, OccupationalData owner) throws IOException, FHIRFormatError {
16041    OccupationalData.OccupationalDataEmploymentStatusComponent res = new OccupationalData.OccupationalDataEmploymentStatusComponent();
16042    parseOccupationalDataOccupationalDataEmploymentStatusComponentProperties(json, owner, res);
16043    return res;
16044  }
16045
16046  protected void parseOccupationalDataOccupationalDataEmploymentStatusComponentProperties(JsonObject json, OccupationalData owner, OccupationalData.OccupationalDataEmploymentStatusComponent res) throws IOException, FHIRFormatError {
16047    parseBackboneElementProperties(json, res);
16048    if (json.has("code"))
16049      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16050    if (json.has("effective"))
16051      res.setEffective(parsePeriod(json.getAsJsonObject("effective")));
16052  }
16053
16054  protected OccupationalData.OccupationalDataUsualWorkComponent parseOccupationalDataOccupationalDataUsualWorkComponent(JsonObject json, OccupationalData owner) throws IOException, FHIRFormatError {
16055    OccupationalData.OccupationalDataUsualWorkComponent res = new OccupationalData.OccupationalDataUsualWorkComponent();
16056    parseOccupationalDataOccupationalDataUsualWorkComponentProperties(json, owner, res);
16057    return res;
16058  }
16059
16060  protected void parseOccupationalDataOccupationalDataUsualWorkComponentProperties(JsonObject json, OccupationalData owner, OccupationalData.OccupationalDataUsualWorkComponent res) throws IOException, FHIRFormatError {
16061    parseBackboneElementProperties(json, res);
16062    if (json.has("occupation"))
16063      res.setOccupation(parseCodeableConcept(json.getAsJsonObject("occupation")));
16064    if (json.has("industry"))
16065      res.setIndustry(parseCodeableConcept(json.getAsJsonObject("industry")));
16066    if (json.has("start"))
16067      res.setStartElement(parseDateTime(json.get("start").getAsString()));
16068    if (json.has("_start"))
16069      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
16070    if (json.has("duration"))
16071      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
16072  }
16073
16074  protected OccupationalData.OccupationalDataPastOrPresentJobComponent parseOccupationalDataOccupationalDataPastOrPresentJobComponent(JsonObject json, OccupationalData owner) throws IOException, FHIRFormatError {
16075    OccupationalData.OccupationalDataPastOrPresentJobComponent res = new OccupationalData.OccupationalDataPastOrPresentJobComponent();
16076    parseOccupationalDataOccupationalDataPastOrPresentJobComponentProperties(json, owner, res);
16077    return res;
16078  }
16079
16080  protected void parseOccupationalDataOccupationalDataPastOrPresentJobComponentProperties(JsonObject json, OccupationalData owner, OccupationalData.OccupationalDataPastOrPresentJobComponent res) throws IOException, FHIRFormatError {
16081    parseBackboneElementProperties(json, res);
16082    if (json.has("occupation"))
16083      res.setOccupation(parseCodeableConcept(json.getAsJsonObject("occupation")));
16084    if (json.has("industry"))
16085      res.setIndustry(parseCodeableConcept(json.getAsJsonObject("industry")));
16086    if (json.has("effective"))
16087      res.setEffective(parsePeriod(json.getAsJsonObject("effective")));
16088    if (json.has("employer"))
16089      res.setEmployer(parseReference(json.getAsJsonObject("employer")));
16090    if (json.has("workClassification"))
16091      res.setWorkClassification(parseCodeableConcept(json.getAsJsonObject("workClassification")));
16092    if (json.has("supervisoryLevel"))
16093      res.setSupervisoryLevel(parseCodeableConcept(json.getAsJsonObject("supervisoryLevel")));
16094    if (json.has("jobDuty")) {
16095      JsonArray array = json.getAsJsonArray("jobDuty");
16096      for (int i = 0; i < array.size(); i++) {
16097        res.getJobDuty().add(parseString(array.get(i).getAsString()));
16098      }
16099    };
16100    if (json.has("_jobDuty")) {
16101      JsonArray array = json.getAsJsonArray("_jobDuty");
16102      for (int i = 0; i < array.size(); i++) {
16103        if (i == res.getJobDuty().size())
16104          res.getJobDuty().add(parseString(null));
16105        if (array.get(i) instanceof JsonObject) 
16106          parseElementProperties(array.get(i).getAsJsonObject(), res.getJobDuty().get(i));
16107      }
16108    };
16109    if (json.has("occupationalHazard")) {
16110      JsonArray array = json.getAsJsonArray("occupationalHazard");
16111      for (int i = 0; i < array.size(); i++) {
16112        res.getOccupationalHazard().add(parseString(array.get(i).getAsString()));
16113      }
16114    };
16115    if (json.has("_occupationalHazard")) {
16116      JsonArray array = json.getAsJsonArray("_occupationalHazard");
16117      for (int i = 0; i < array.size(); i++) {
16118        if (i == res.getOccupationalHazard().size())
16119          res.getOccupationalHazard().add(parseString(null));
16120        if (array.get(i) instanceof JsonObject) 
16121          parseElementProperties(array.get(i).getAsJsonObject(), res.getOccupationalHazard().get(i));
16122      }
16123    };
16124    if (json.has("workSchedule"))
16125      res.setWorkSchedule(parseOccupationalDataOccupationalDataPastOrPresentJobWorkScheduleComponent(json.getAsJsonObject("workSchedule"), owner));
16126  }
16127
16128  protected OccupationalData.OccupationalDataPastOrPresentJobWorkScheduleComponent parseOccupationalDataOccupationalDataPastOrPresentJobWorkScheduleComponent(JsonObject json, OccupationalData owner) throws IOException, FHIRFormatError {
16129    OccupationalData.OccupationalDataPastOrPresentJobWorkScheduleComponent res = new OccupationalData.OccupationalDataPastOrPresentJobWorkScheduleComponent();
16130    parseOccupationalDataOccupationalDataPastOrPresentJobWorkScheduleComponentProperties(json, owner, res);
16131    return res;
16132  }
16133
16134  protected void parseOccupationalDataOccupationalDataPastOrPresentJobWorkScheduleComponentProperties(JsonObject json, OccupationalData owner, OccupationalData.OccupationalDataPastOrPresentJobWorkScheduleComponent res) throws IOException, FHIRFormatError {
16135    parseBackboneElementProperties(json, res);
16136    if (json.has("code"))
16137      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16138    if (json.has("weeklyWorkDays"))
16139      res.setWeeklyWorkDaysElement(parseDecimal(json.get("weeklyWorkDays").getAsBigDecimal()));
16140    if (json.has("_weeklyWorkDays"))
16141      parseElementProperties(json.getAsJsonObject("_weeklyWorkDays"), res.getWeeklyWorkDaysElement());
16142    if (json.has("dailyWorkHours"))
16143      res.setDailyWorkHoursElement(parseDecimal(json.get("dailyWorkHours").getAsBigDecimal()));
16144    if (json.has("_dailyWorkHours"))
16145      parseElementProperties(json.getAsJsonObject("_dailyWorkHours"), res.getDailyWorkHoursElement());
16146  }
16147
16148  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
16149    OperationDefinition res = new OperationDefinition();
16150    parseOperationDefinitionProperties(json, res);
16151    return res;
16152  }
16153
16154  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
16155    parseDomainResourceProperties(json, res);
16156    if (json.has("url"))
16157      res.setUrlElement(parseUri(json.get("url").getAsString()));
16158    if (json.has("_url"))
16159      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
16160    if (json.has("version"))
16161      res.setVersionElement(parseString(json.get("version").getAsString()));
16162    if (json.has("_version"))
16163      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
16164    if (json.has("name"))
16165      res.setNameElement(parseString(json.get("name").getAsString()));
16166    if (json.has("_name"))
16167      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16168    if (json.has("status"))
16169      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16170    if (json.has("_status"))
16171      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16172    if (json.has("kind"))
16173      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
16174    if (json.has("_kind"))
16175      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
16176    if (json.has("experimental"))
16177      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16178    if (json.has("_experimental"))
16179      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
16180    if (json.has("date"))
16181      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16182    if (json.has("_date"))
16183      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16184    if (json.has("publisher"))
16185      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16186    if (json.has("_publisher"))
16187      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
16188    if (json.has("contact")) {
16189      JsonArray array = json.getAsJsonArray("contact");
16190      for (int i = 0; i < array.size(); i++) {
16191        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16192      }
16193    };
16194    if (json.has("description"))
16195      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16196    if (json.has("_description"))
16197      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16198    if (json.has("useContext")) {
16199      JsonArray array = json.getAsJsonArray("useContext");
16200      for (int i = 0; i < array.size(); i++) {
16201        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16202      }
16203    };
16204    if (json.has("jurisdiction")) {
16205      JsonArray array = json.getAsJsonArray("jurisdiction");
16206      for (int i = 0; i < array.size(); i++) {
16207        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16208      }
16209    };
16210    if (json.has("purpose"))
16211      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
16212    if (json.has("_purpose"))
16213      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
16214    if (json.has("affectsState"))
16215      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
16216    if (json.has("_affectsState"))
16217      parseElementProperties(json.getAsJsonObject("_affectsState"), res.getAffectsStateElement());
16218    if (json.has("code"))
16219      res.setCodeElement(parseCode(json.get("code").getAsString()));
16220    if (json.has("_code"))
16221      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
16222    if (json.has("comment"))
16223      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
16224    if (json.has("_comment"))
16225      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
16226    if (json.has("base"))
16227      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
16228    if (json.has("_base"))
16229      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
16230    if (json.has("resource")) {
16231      JsonArray array = json.getAsJsonArray("resource");
16232      for (int i = 0; i < array.size(); i++) {
16233        res.getResource().add(parseCode(array.get(i).getAsString()));
16234      }
16235    };
16236    if (json.has("_resource")) {
16237      JsonArray array = json.getAsJsonArray("_resource");
16238      for (int i = 0; i < array.size(); i++) {
16239        if (i == res.getResource().size())
16240          res.getResource().add(parseCode(null));
16241        if (array.get(i) instanceof JsonObject) 
16242          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
16243      }
16244    };
16245    if (json.has("system"))
16246      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
16247    if (json.has("_system"))
16248      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
16249    if (json.has("type"))
16250      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
16251    if (json.has("_type"))
16252      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16253    if (json.has("instance"))
16254      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
16255    if (json.has("_instance"))
16256      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
16257    if (json.has("inputProfile"))
16258      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
16259    if (json.has("_inputProfile"))
16260      parseElementProperties(json.getAsJsonObject("_inputProfile"), res.getInputProfileElement());
16261    if (json.has("outputProfile"))
16262      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
16263    if (json.has("_outputProfile"))
16264      parseElementProperties(json.getAsJsonObject("_outputProfile"), res.getOutputProfileElement());
16265    if (json.has("parameter")) {
16266      JsonArray array = json.getAsJsonArray("parameter");
16267      for (int i = 0; i < array.size(); i++) {
16268        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
16269      }
16270    };
16271    if (json.has("overload")) {
16272      JsonArray array = json.getAsJsonArray("overload");
16273      for (int i = 0; i < array.size(); i++) {
16274        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
16275      }
16276    };
16277  }
16278
16279  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
16280    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
16281    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
16282    return res;
16283  }
16284
16285  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
16286    parseBackboneElementProperties(json, res);
16287    if (json.has("name"))
16288      res.setNameElement(parseCode(json.get("name").getAsString()));
16289    if (json.has("_name"))
16290      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16291    if (json.has("use"))
16292      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
16293    if (json.has("_use"))
16294      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
16295    if (json.has("min"))
16296      res.setMinElement(parseInteger(json.get("min").getAsLong()));
16297    if (json.has("_min"))
16298      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
16299    if (json.has("max"))
16300      res.setMaxElement(parseString(json.get("max").getAsString()));
16301    if (json.has("_max"))
16302      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
16303    if (json.has("documentation"))
16304      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
16305    if (json.has("_documentation"))
16306      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
16307    if (json.has("type"))
16308      res.setTypeElement(parseCode(json.get("type").getAsString()));
16309    if (json.has("_type"))
16310      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16311    if (json.has("targetProfile")) {
16312      JsonArray array = json.getAsJsonArray("targetProfile");
16313      for (int i = 0; i < array.size(); i++) {
16314        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
16315      }
16316    };
16317    if (json.has("_targetProfile")) {
16318      JsonArray array = json.getAsJsonArray("_targetProfile");
16319      for (int i = 0; i < array.size(); i++) {
16320        if (i == res.getTargetProfile().size())
16321          res.getTargetProfile().add(parseCanonical(null));
16322        if (array.get(i) instanceof JsonObject) 
16323          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
16324      }
16325    };
16326    if (json.has("searchType"))
16327      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
16328    if (json.has("_searchType"))
16329      parseElementProperties(json.getAsJsonObject("_searchType"), res.getSearchTypeElement());
16330    if (json.has("binding"))
16331      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding"), owner));
16332    if (json.has("part")) {
16333      JsonArray array = json.getAsJsonArray("part");
16334      for (int i = 0; i < array.size(); i++) {
16335        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
16336      }
16337    };
16338  }
16339
16340  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
16341    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
16342    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
16343    return res;
16344  }
16345
16346  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
16347    parseBackboneElementProperties(json, res);
16348    if (json.has("strength"))
16349      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
16350    if (json.has("_strength"))
16351      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
16352    Type valueSet = parseType("valueSet", json);
16353    if (valueSet != null)
16354      res.setValueSet(valueSet);
16355  }
16356
16357  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
16358    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
16359    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
16360    return res;
16361  }
16362
16363  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
16364    parseBackboneElementProperties(json, res);
16365    if (json.has("parameterName")) {
16366      JsonArray array = json.getAsJsonArray("parameterName");
16367      for (int i = 0; i < array.size(); i++) {
16368        res.getParameterName().add(parseString(array.get(i).getAsString()));
16369      }
16370    };
16371    if (json.has("_parameterName")) {
16372      JsonArray array = json.getAsJsonArray("_parameterName");
16373      for (int i = 0; i < array.size(); i++) {
16374        if (i == res.getParameterName().size())
16375          res.getParameterName().add(parseString(null));
16376        if (array.get(i) instanceof JsonObject) 
16377          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
16378      }
16379    };
16380    if (json.has("comment"))
16381      res.setCommentElement(parseString(json.get("comment").getAsString()));
16382    if (json.has("_comment"))
16383      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
16384  }
16385
16386  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
16387    OperationOutcome res = new OperationOutcome();
16388    parseOperationOutcomeProperties(json, res);
16389    return res;
16390  }
16391
16392  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
16393    parseDomainResourceProperties(json, res);
16394    if (json.has("issue")) {
16395      JsonArray array = json.getAsJsonArray("issue");
16396      for (int i = 0; i < array.size(); i++) {
16397        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
16398      }
16399    };
16400  }
16401
16402  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
16403    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
16404    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
16405    return res;
16406  }
16407
16408  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
16409    parseBackboneElementProperties(json, res);
16410    if (json.has("severity"))
16411      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
16412    if (json.has("_severity"))
16413      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
16414    if (json.has("code"))
16415      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
16416    if (json.has("_code"))
16417      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
16418    if (json.has("details"))
16419      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
16420    if (json.has("diagnostics"))
16421      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
16422    if (json.has("_diagnostics"))
16423      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
16424    if (json.has("location")) {
16425      JsonArray array = json.getAsJsonArray("location");
16426      for (int i = 0; i < array.size(); i++) {
16427        res.getLocation().add(parseString(array.get(i).getAsString()));
16428      }
16429    };
16430    if (json.has("_location")) {
16431      JsonArray array = json.getAsJsonArray("_location");
16432      for (int i = 0; i < array.size(); i++) {
16433        if (i == res.getLocation().size())
16434          res.getLocation().add(parseString(null));
16435        if (array.get(i) instanceof JsonObject) 
16436          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
16437      }
16438    };
16439    if (json.has("expression")) {
16440      JsonArray array = json.getAsJsonArray("expression");
16441      for (int i = 0; i < array.size(); i++) {
16442        res.getExpression().add(parseString(array.get(i).getAsString()));
16443      }
16444    };
16445    if (json.has("_expression")) {
16446      JsonArray array = json.getAsJsonArray("_expression");
16447      for (int i = 0; i < array.size(); i++) {
16448        if (i == res.getExpression().size())
16449          res.getExpression().add(parseString(null));
16450        if (array.get(i) instanceof JsonObject) 
16451          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
16452      }
16453    };
16454  }
16455
16456  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
16457    Organization res = new Organization();
16458    parseOrganizationProperties(json, res);
16459    return res;
16460  }
16461
16462  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
16463    parseDomainResourceProperties(json, res);
16464    if (json.has("identifier")) {
16465      JsonArray array = json.getAsJsonArray("identifier");
16466      for (int i = 0; i < array.size(); i++) {
16467        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16468      }
16469    };
16470    if (json.has("active"))
16471      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
16472    if (json.has("_active"))
16473      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
16474    if (json.has("type")) {
16475      JsonArray array = json.getAsJsonArray("type");
16476      for (int i = 0; i < array.size(); i++) {
16477        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16478      }
16479    };
16480    if (json.has("name"))
16481      res.setNameElement(parseString(json.get("name").getAsString()));
16482    if (json.has("_name"))
16483      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16484    if (json.has("alias")) {
16485      JsonArray array = json.getAsJsonArray("alias");
16486      for (int i = 0; i < array.size(); i++) {
16487        res.getAlias().add(parseString(array.get(i).getAsString()));
16488      }
16489    };
16490    if (json.has("_alias")) {
16491      JsonArray array = json.getAsJsonArray("_alias");
16492      for (int i = 0; i < array.size(); i++) {
16493        if (i == res.getAlias().size())
16494          res.getAlias().add(parseString(null));
16495        if (array.get(i) instanceof JsonObject) 
16496          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
16497      }
16498    };
16499    if (json.has("telecom")) {
16500      JsonArray array = json.getAsJsonArray("telecom");
16501      for (int i = 0; i < array.size(); i++) {
16502        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16503      }
16504    };
16505    if (json.has("address")) {
16506      JsonArray array = json.getAsJsonArray("address");
16507      for (int i = 0; i < array.size(); i++) {
16508        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
16509      }
16510    };
16511    if (json.has("partOf"))
16512      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
16513    if (json.has("contact")) {
16514      JsonArray array = json.getAsJsonArray("contact");
16515      for (int i = 0; i < array.size(); i++) {
16516        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
16517      }
16518    };
16519    if (json.has("endpoint")) {
16520      JsonArray array = json.getAsJsonArray("endpoint");
16521      for (int i = 0; i < array.size(); i++) {
16522        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
16523      }
16524    };
16525  }
16526
16527  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
16528    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
16529    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
16530    return res;
16531  }
16532
16533  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
16534    parseBackboneElementProperties(json, res);
16535    if (json.has("purpose"))
16536      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
16537    if (json.has("name"))
16538      res.setName(parseHumanName(json.getAsJsonObject("name")));
16539    if (json.has("telecom")) {
16540      JsonArray array = json.getAsJsonArray("telecom");
16541      for (int i = 0; i < array.size(); i++) {
16542        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16543      }
16544    };
16545    if (json.has("address"))
16546      res.setAddress(parseAddress(json.getAsJsonObject("address")));
16547  }
16548
16549  protected OrganizationRole parseOrganizationRole(JsonObject json) throws IOException, FHIRFormatError {
16550    OrganizationRole res = new OrganizationRole();
16551    parseOrganizationRoleProperties(json, res);
16552    return res;
16553  }
16554
16555  protected void parseOrganizationRoleProperties(JsonObject json, OrganizationRole res) throws IOException, FHIRFormatError {
16556    parseDomainResourceProperties(json, res);
16557    if (json.has("identifier")) {
16558      JsonArray array = json.getAsJsonArray("identifier");
16559      for (int i = 0; i < array.size(); i++) {
16560        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16561      }
16562    };
16563    if (json.has("active"))
16564      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
16565    if (json.has("_active"))
16566      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
16567    if (json.has("period"))
16568      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
16569    if (json.has("organization"))
16570      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
16571    if (json.has("participatingOrganization"))
16572      res.setParticipatingOrganization(parseReference(json.getAsJsonObject("participatingOrganization")));
16573    if (json.has("network")) {
16574      JsonArray array = json.getAsJsonArray("network");
16575      for (int i = 0; i < array.size(); i++) {
16576        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
16577      }
16578    };
16579    if (json.has("code")) {
16580      JsonArray array = json.getAsJsonArray("code");
16581      for (int i = 0; i < array.size(); i++) {
16582        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16583      }
16584    };
16585    if (json.has("specialty")) {
16586      JsonArray array = json.getAsJsonArray("specialty");
16587      for (int i = 0; i < array.size(); i++) {
16588        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16589      }
16590    };
16591    if (json.has("location")) {
16592      JsonArray array = json.getAsJsonArray("location");
16593      for (int i = 0; i < array.size(); i++) {
16594        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
16595      }
16596    };
16597    if (json.has("healthcareService")) {
16598      JsonArray array = json.getAsJsonArray("healthcareService");
16599      for (int i = 0; i < array.size(); i++) {
16600        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
16601      }
16602    };
16603    if (json.has("telecom")) {
16604      JsonArray array = json.getAsJsonArray("telecom");
16605      for (int i = 0; i < array.size(); i++) {
16606        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16607      }
16608    };
16609    if (json.has("availableTime")) {
16610      JsonArray array = json.getAsJsonArray("availableTime");
16611      for (int i = 0; i < array.size(); i++) {
16612        res.getAvailableTime().add(parseOrganizationRoleOrganizationRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
16613      }
16614    };
16615    if (json.has("notAvailable")) {
16616      JsonArray array = json.getAsJsonArray("notAvailable");
16617      for (int i = 0; i < array.size(); i++) {
16618        res.getNotAvailable().add(parseOrganizationRoleOrganizationRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
16619      }
16620    };
16621    if (json.has("availabilityExceptions"))
16622      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
16623    if (json.has("_availabilityExceptions"))
16624      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
16625    if (json.has("endpoint")) {
16626      JsonArray array = json.getAsJsonArray("endpoint");
16627      for (int i = 0; i < array.size(); i++) {
16628        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
16629      }
16630    };
16631  }
16632
16633  protected OrganizationRole.OrganizationRoleAvailableTimeComponent parseOrganizationRoleOrganizationRoleAvailableTimeComponent(JsonObject json, OrganizationRole owner) throws IOException, FHIRFormatError {
16634    OrganizationRole.OrganizationRoleAvailableTimeComponent res = new OrganizationRole.OrganizationRoleAvailableTimeComponent();
16635    parseOrganizationRoleOrganizationRoleAvailableTimeComponentProperties(json, owner, res);
16636    return res;
16637  }
16638
16639  protected void parseOrganizationRoleOrganizationRoleAvailableTimeComponentProperties(JsonObject json, OrganizationRole owner, OrganizationRole.OrganizationRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
16640    parseBackboneElementProperties(json, res);
16641    if (json.has("daysOfWeek")) {
16642      JsonArray array = json.getAsJsonArray("daysOfWeek");
16643      for (int i = 0; i < array.size(); i++) {
16644        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), OrganizationRole.DaysOfWeek.NULL, new OrganizationRole.DaysOfWeekEnumFactory()));
16645      }
16646    };
16647    if (json.has("_daysOfWeek")) {
16648      JsonArray array = json.getAsJsonArray("_daysOfWeek");
16649      for (int i = 0; i < array.size(); i++) {
16650        if (i == res.getDaysOfWeek().size())
16651          res.getDaysOfWeek().add(parseEnumeration(null, OrganizationRole.DaysOfWeek.NULL, new OrganizationRole.DaysOfWeekEnumFactory()));
16652        if (array.get(i) instanceof JsonObject) 
16653          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
16654      }
16655    };
16656    if (json.has("allDay"))
16657      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
16658    if (json.has("_allDay"))
16659      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
16660    if (json.has("availableStartTime"))
16661      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
16662    if (json.has("_availableStartTime"))
16663      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
16664    if (json.has("availableEndTime"))
16665      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
16666    if (json.has("_availableEndTime"))
16667      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
16668  }
16669
16670  protected OrganizationRole.OrganizationRoleNotAvailableComponent parseOrganizationRoleOrganizationRoleNotAvailableComponent(JsonObject json, OrganizationRole owner) throws IOException, FHIRFormatError {
16671    OrganizationRole.OrganizationRoleNotAvailableComponent res = new OrganizationRole.OrganizationRoleNotAvailableComponent();
16672    parseOrganizationRoleOrganizationRoleNotAvailableComponentProperties(json, owner, res);
16673    return res;
16674  }
16675
16676  protected void parseOrganizationRoleOrganizationRoleNotAvailableComponentProperties(JsonObject json, OrganizationRole owner, OrganizationRole.OrganizationRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
16677    parseBackboneElementProperties(json, res);
16678    if (json.has("description"))
16679      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16680    if (json.has("_description"))
16681      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16682    if (json.has("during"))
16683      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
16684  }
16685
16686  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
16687    Patient res = new Patient();
16688    parsePatientProperties(json, res);
16689    return res;
16690  }
16691
16692  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
16693    parseDomainResourceProperties(json, res);
16694    if (json.has("identifier")) {
16695      JsonArray array = json.getAsJsonArray("identifier");
16696      for (int i = 0; i < array.size(); i++) {
16697        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16698      }
16699    };
16700    if (json.has("active"))
16701      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
16702    if (json.has("_active"))
16703      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
16704    if (json.has("name")) {
16705      JsonArray array = json.getAsJsonArray("name");
16706      for (int i = 0; i < array.size(); i++) {
16707        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
16708      }
16709    };
16710    if (json.has("telecom")) {
16711      JsonArray array = json.getAsJsonArray("telecom");
16712      for (int i = 0; i < array.size(); i++) {
16713        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16714      }
16715    };
16716    if (json.has("gender"))
16717      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
16718    if (json.has("_gender"))
16719      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
16720    if (json.has("birthDate"))
16721      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
16722    if (json.has("_birthDate"))
16723      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
16724    Type deceased = parseType("deceased", json);
16725    if (deceased != null)
16726      res.setDeceased(deceased);
16727    if (json.has("address")) {
16728      JsonArray array = json.getAsJsonArray("address");
16729      for (int i = 0; i < array.size(); i++) {
16730        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
16731      }
16732    };
16733    if (json.has("maritalStatus"))
16734      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
16735    Type multipleBirth = parseType("multipleBirth", json);
16736    if (multipleBirth != null)
16737      res.setMultipleBirth(multipleBirth);
16738    if (json.has("photo")) {
16739      JsonArray array = json.getAsJsonArray("photo");
16740      for (int i = 0; i < array.size(); i++) {
16741        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
16742      }
16743    };
16744    if (json.has("contact")) {
16745      JsonArray array = json.getAsJsonArray("contact");
16746      for (int i = 0; i < array.size(); i++) {
16747        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
16748      }
16749    };
16750    if (json.has("communication")) {
16751      JsonArray array = json.getAsJsonArray("communication");
16752      for (int i = 0; i < array.size(); i++) {
16753        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
16754      }
16755    };
16756    if (json.has("generalPractitioner")) {
16757      JsonArray array = json.getAsJsonArray("generalPractitioner");
16758      for (int i = 0; i < array.size(); i++) {
16759        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
16760      }
16761    };
16762    if (json.has("managingOrganization"))
16763      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
16764    if (json.has("link")) {
16765      JsonArray array = json.getAsJsonArray("link");
16766      for (int i = 0; i < array.size(); i++) {
16767        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
16768      }
16769    };
16770  }
16771
16772  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
16773    Patient.ContactComponent res = new Patient.ContactComponent();
16774    parsePatientContactComponentProperties(json, owner, res);
16775    return res;
16776  }
16777
16778  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res) throws IOException, FHIRFormatError {
16779    parseBackboneElementProperties(json, res);
16780    if (json.has("relationship")) {
16781      JsonArray array = json.getAsJsonArray("relationship");
16782      for (int i = 0; i < array.size(); i++) {
16783        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16784      }
16785    };
16786    if (json.has("name"))
16787      res.setName(parseHumanName(json.getAsJsonObject("name")));
16788    if (json.has("telecom")) {
16789      JsonArray array = json.getAsJsonArray("telecom");
16790      for (int i = 0; i < array.size(); i++) {
16791        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16792      }
16793    };
16794    if (json.has("address"))
16795      res.setAddress(parseAddress(json.getAsJsonObject("address")));
16796    if (json.has("gender"))
16797      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
16798    if (json.has("_gender"))
16799      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
16800    if (json.has("organization"))
16801      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
16802    if (json.has("period"))
16803      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
16804  }
16805
16806  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
16807    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
16808    parsePatientPatientCommunicationComponentProperties(json, owner, res);
16809    return res;
16810  }
16811
16812  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
16813    parseBackboneElementProperties(json, res);
16814    if (json.has("language"))
16815      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
16816    if (json.has("preferred"))
16817      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
16818    if (json.has("_preferred"))
16819      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
16820  }
16821
16822  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
16823    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
16824    parsePatientPatientLinkComponentProperties(json, owner, res);
16825    return res;
16826  }
16827
16828  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
16829    parseBackboneElementProperties(json, res);
16830    if (json.has("other"))
16831      res.setOther(parseReference(json.getAsJsonObject("other")));
16832    if (json.has("type"))
16833      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
16834    if (json.has("_type"))
16835      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16836  }
16837
16838  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
16839    PaymentNotice res = new PaymentNotice();
16840    parsePaymentNoticeProperties(json, res);
16841    return res;
16842  }
16843
16844  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
16845    parseDomainResourceProperties(json, res);
16846    if (json.has("identifier")) {
16847      JsonArray array = json.getAsJsonArray("identifier");
16848      for (int i = 0; i < array.size(); i++) {
16849        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16850      }
16851    };
16852    if (json.has("status"))
16853      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
16854    if (json.has("_status"))
16855      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16856    if (json.has("request"))
16857      res.setRequest(parseReference(json.getAsJsonObject("request")));
16858    if (json.has("response"))
16859      res.setResponse(parseReference(json.getAsJsonObject("response")));
16860    if (json.has("statusDate"))
16861      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
16862    if (json.has("_statusDate"))
16863      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
16864    if (json.has("created"))
16865      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
16866    if (json.has("_created"))
16867      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
16868    if (json.has("target"))
16869      res.setTarget(parseReference(json.getAsJsonObject("target")));
16870    if (json.has("provider"))
16871      res.setProvider(parseReference(json.getAsJsonObject("provider")));
16872    if (json.has("paymentStatus"))
16873      res.setPaymentStatus(parseCodeableConcept(json.getAsJsonObject("paymentStatus")));
16874  }
16875
16876  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
16877    PaymentReconciliation res = new PaymentReconciliation();
16878    parsePaymentReconciliationProperties(json, res);
16879    return res;
16880  }
16881
16882  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
16883    parseDomainResourceProperties(json, res);
16884    if (json.has("identifier")) {
16885      JsonArray array = json.getAsJsonArray("identifier");
16886      for (int i = 0; i < array.size(); i++) {
16887        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16888      }
16889    };
16890    if (json.has("status"))
16891      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
16892    if (json.has("_status"))
16893      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16894    if (json.has("period"))
16895      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
16896    if (json.has("created"))
16897      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
16898    if (json.has("_created"))
16899      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
16900    if (json.has("organization"))
16901      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
16902    if (json.has("request"))
16903      res.setRequest(parseReference(json.getAsJsonObject("request")));
16904    if (json.has("outcome"))
16905      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
16906    if (json.has("_outcome"))
16907      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
16908    if (json.has("disposition"))
16909      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
16910    if (json.has("_disposition"))
16911      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
16912    if (json.has("requestProvider"))
16913      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
16914    if (json.has("detail")) {
16915      JsonArray array = json.getAsJsonArray("detail");
16916      for (int i = 0; i < array.size(); i++) {
16917        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
16918      }
16919    };
16920    if (json.has("form"))
16921      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
16922    if (json.has("total"))
16923      res.setTotal(parseMoney(json.getAsJsonObject("total")));
16924    if (json.has("processNote")) {
16925      JsonArray array = json.getAsJsonArray("processNote");
16926      for (int i = 0; i < array.size(); i++) {
16927        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
16928      }
16929    };
16930  }
16931
16932  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
16933    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
16934    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
16935    return res;
16936  }
16937
16938  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
16939    parseBackboneElementProperties(json, res);
16940    if (json.has("type"))
16941      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16942    if (json.has("request"))
16943      res.setRequest(parseReference(json.getAsJsonObject("request")));
16944    if (json.has("response"))
16945      res.setResponse(parseReference(json.getAsJsonObject("response")));
16946    if (json.has("submitter"))
16947      res.setSubmitter(parseReference(json.getAsJsonObject("submitter")));
16948    if (json.has("payee"))
16949      res.setPayee(parseReference(json.getAsJsonObject("payee")));
16950    if (json.has("date"))
16951      res.setDateElement(parseDate(json.get("date").getAsString()));
16952    if (json.has("_date"))
16953      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16954    if (json.has("amount"))
16955      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
16956  }
16957
16958  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
16959    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
16960    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
16961    return res;
16962  }
16963
16964  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
16965    parseBackboneElementProperties(json, res);
16966    if (json.has("type"))
16967      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
16968    if (json.has("_type"))
16969      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16970    if (json.has("text"))
16971      res.setTextElement(parseString(json.get("text").getAsString()));
16972    if (json.has("_text"))
16973      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
16974  }
16975
16976  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
16977    Person res = new Person();
16978    parsePersonProperties(json, res);
16979    return res;
16980  }
16981
16982  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
16983    parseDomainResourceProperties(json, res);
16984    if (json.has("identifier")) {
16985      JsonArray array = json.getAsJsonArray("identifier");
16986      for (int i = 0; i < array.size(); i++) {
16987        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16988      }
16989    };
16990    if (json.has("name")) {
16991      JsonArray array = json.getAsJsonArray("name");
16992      for (int i = 0; i < array.size(); i++) {
16993        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
16994      }
16995    };
16996    if (json.has("telecom")) {
16997      JsonArray array = json.getAsJsonArray("telecom");
16998      for (int i = 0; i < array.size(); i++) {
16999        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
17000      }
17001    };
17002    if (json.has("gender"))
17003      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
17004    if (json.has("_gender"))
17005      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
17006    if (json.has("birthDate"))
17007      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
17008    if (json.has("_birthDate"))
17009      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
17010    if (json.has("address")) {
17011      JsonArray array = json.getAsJsonArray("address");
17012      for (int i = 0; i < array.size(); i++) {
17013        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
17014      }
17015    };
17016    if (json.has("photo"))
17017      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
17018    if (json.has("managingOrganization"))
17019      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
17020    if (json.has("active"))
17021      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
17022    if (json.has("_active"))
17023      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
17024    if (json.has("link")) {
17025      JsonArray array = json.getAsJsonArray("link");
17026      for (int i = 0; i < array.size(); i++) {
17027        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
17028      }
17029    };
17030  }
17031
17032  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
17033    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
17034    parsePersonPersonLinkComponentProperties(json, owner, res);
17035    return res;
17036  }
17037
17038  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
17039    parseBackboneElementProperties(json, res);
17040    if (json.has("target"))
17041      res.setTarget(parseReference(json.getAsJsonObject("target")));
17042    if (json.has("assurance"))
17043      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
17044    if (json.has("_assurance"))
17045      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
17046  }
17047
17048  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
17049    PlanDefinition res = new PlanDefinition();
17050    parsePlanDefinitionProperties(json, res);
17051    return res;
17052  }
17053
17054  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
17055    parseDomainResourceProperties(json, res);
17056    if (json.has("url"))
17057      res.setUrlElement(parseUri(json.get("url").getAsString()));
17058    if (json.has("_url"))
17059      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
17060    if (json.has("identifier")) {
17061      JsonArray array = json.getAsJsonArray("identifier");
17062      for (int i = 0; i < array.size(); i++) {
17063        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17064      }
17065    };
17066    if (json.has("version"))
17067      res.setVersionElement(parseString(json.get("version").getAsString()));
17068    if (json.has("_version"))
17069      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
17070    if (json.has("name"))
17071      res.setNameElement(parseString(json.get("name").getAsString()));
17072    if (json.has("_name"))
17073      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17074    if (json.has("title"))
17075      res.setTitleElement(parseString(json.get("title").getAsString()));
17076    if (json.has("_title"))
17077      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
17078    if (json.has("subtitle"))
17079      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
17080    if (json.has("_subtitle"))
17081      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
17082    if (json.has("type"))
17083      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17084    if (json.has("status"))
17085      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17086    if (json.has("_status"))
17087      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17088    if (json.has("experimental"))
17089      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17090    if (json.has("_experimental"))
17091      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
17092    Type subject = parseType("subject", json);
17093    if (subject != null)
17094      res.setSubject(subject);
17095    if (json.has("date"))
17096      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17097    if (json.has("_date"))
17098      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17099    if (json.has("publisher"))
17100      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17101    if (json.has("_publisher"))
17102      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
17103    if (json.has("contact")) {
17104      JsonArray array = json.getAsJsonArray("contact");
17105      for (int i = 0; i < array.size(); i++) {
17106        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17107      }
17108    };
17109    if (json.has("description"))
17110      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17111    if (json.has("_description"))
17112      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17113    if (json.has("useContext")) {
17114      JsonArray array = json.getAsJsonArray("useContext");
17115      for (int i = 0; i < array.size(); i++) {
17116        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17117      }
17118    };
17119    if (json.has("jurisdiction")) {
17120      JsonArray array = json.getAsJsonArray("jurisdiction");
17121      for (int i = 0; i < array.size(); i++) {
17122        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17123      }
17124    };
17125    if (json.has("purpose"))
17126      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17127    if (json.has("_purpose"))
17128      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
17129    if (json.has("usage"))
17130      res.setUsageElement(parseString(json.get("usage").getAsString()));
17131    if (json.has("_usage"))
17132      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
17133    if (json.has("copyright"))
17134      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17135    if (json.has("_copyright"))
17136      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
17137    if (json.has("approvalDate"))
17138      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
17139    if (json.has("_approvalDate"))
17140      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
17141    if (json.has("lastReviewDate"))
17142      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
17143    if (json.has("_lastReviewDate"))
17144      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
17145    if (json.has("effectivePeriod"))
17146      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
17147    if (json.has("topic")) {
17148      JsonArray array = json.getAsJsonArray("topic");
17149      for (int i = 0; i < array.size(); i++) {
17150        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17151      }
17152    };
17153    if (json.has("contributor")) {
17154      JsonArray array = json.getAsJsonArray("contributor");
17155      for (int i = 0; i < array.size(); i++) {
17156        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
17157      }
17158    };
17159    if (json.has("relatedArtifact")) {
17160      JsonArray array = json.getAsJsonArray("relatedArtifact");
17161      for (int i = 0; i < array.size(); i++) {
17162        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
17163      }
17164    };
17165    if (json.has("library")) {
17166      JsonArray array = json.getAsJsonArray("library");
17167      for (int i = 0; i < array.size(); i++) {
17168        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
17169      }
17170    };
17171    if (json.has("_library")) {
17172      JsonArray array = json.getAsJsonArray("_library");
17173      for (int i = 0; i < array.size(); i++) {
17174        if (i == res.getLibrary().size())
17175          res.getLibrary().add(parseCanonical(null));
17176        if (array.get(i) instanceof JsonObject) 
17177          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
17178      }
17179    };
17180    if (json.has("goal")) {
17181      JsonArray array = json.getAsJsonArray("goal");
17182      for (int i = 0; i < array.size(); i++) {
17183        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
17184      }
17185    };
17186    if (json.has("action")) {
17187      JsonArray array = json.getAsJsonArray("action");
17188      for (int i = 0; i < array.size(); i++) {
17189        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
17190      }
17191    };
17192  }
17193
17194  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
17195    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
17196    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
17197    return res;
17198  }
17199
17200  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
17201    parseBackboneElementProperties(json, res);
17202    if (json.has("category"))
17203      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
17204    if (json.has("description"))
17205      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
17206    if (json.has("priority"))
17207      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
17208    if (json.has("start"))
17209      res.setStart(parseCodeableConcept(json.getAsJsonObject("start")));
17210    if (json.has("addresses")) {
17211      JsonArray array = json.getAsJsonArray("addresses");
17212      for (int i = 0; i < array.size(); i++) {
17213        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17214      }
17215    };
17216    if (json.has("documentation")) {
17217      JsonArray array = json.getAsJsonArray("documentation");
17218      for (int i = 0; i < array.size(); i++) {
17219        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
17220      }
17221    };
17222    if (json.has("target")) {
17223      JsonArray array = json.getAsJsonArray("target");
17224      for (int i = 0; i < array.size(); i++) {
17225        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
17226      }
17227    };
17228  }
17229
17230  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
17231    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
17232    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
17233    return res;
17234  }
17235
17236  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
17237    parseBackboneElementProperties(json, res);
17238    if (json.has("measure"))
17239      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
17240    Type detail = parseType("detail", json);
17241    if (detail != null)
17242      res.setDetail(detail);
17243    if (json.has("due"))
17244      res.setDue(parseDuration(json.getAsJsonObject("due")));
17245  }
17246
17247  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
17248    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
17249    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
17250    return res;
17251  }
17252
17253  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
17254    parseBackboneElementProperties(json, res);
17255    if (json.has("prefix"))
17256      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
17257    if (json.has("_prefix"))
17258      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
17259    if (json.has("title"))
17260      res.setTitleElement(parseString(json.get("title").getAsString()));
17261    if (json.has("_title"))
17262      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
17263    if (json.has("description"))
17264      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17265    if (json.has("_description"))
17266      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17267    if (json.has("textEquivalent"))
17268      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
17269    if (json.has("_textEquivalent"))
17270      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
17271    if (json.has("code")) {
17272      JsonArray array = json.getAsJsonArray("code");
17273      for (int i = 0; i < array.size(); i++) {
17274        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17275      }
17276    };
17277    if (json.has("reason")) {
17278      JsonArray array = json.getAsJsonArray("reason");
17279      for (int i = 0; i < array.size(); i++) {
17280        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17281      }
17282    };
17283    if (json.has("documentation")) {
17284      JsonArray array = json.getAsJsonArray("documentation");
17285      for (int i = 0; i < array.size(); i++) {
17286        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
17287      }
17288    };
17289    if (json.has("goalId")) {
17290      JsonArray array = json.getAsJsonArray("goalId");
17291      for (int i = 0; i < array.size(); i++) {
17292        res.getGoalId().add(parseId(array.get(i).getAsString()));
17293      }
17294    };
17295    if (json.has("_goalId")) {
17296      JsonArray array = json.getAsJsonArray("_goalId");
17297      for (int i = 0; i < array.size(); i++) {
17298        if (i == res.getGoalId().size())
17299          res.getGoalId().add(parseId(null));
17300        if (array.get(i) instanceof JsonObject) 
17301          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
17302      }
17303    };
17304    if (json.has("trigger")) {
17305      JsonArray array = json.getAsJsonArray("trigger");
17306      for (int i = 0; i < array.size(); i++) {
17307        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
17308      }
17309    };
17310    if (json.has("condition")) {
17311      JsonArray array = json.getAsJsonArray("condition");
17312      for (int i = 0; i < array.size(); i++) {
17313        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
17314      }
17315    };
17316    if (json.has("input")) {
17317      JsonArray array = json.getAsJsonArray("input");
17318      for (int i = 0; i < array.size(); i++) {
17319        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
17320      }
17321    };
17322    if (json.has("output")) {
17323      JsonArray array = json.getAsJsonArray("output");
17324      for (int i = 0; i < array.size(); i++) {
17325        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
17326      }
17327    };
17328    if (json.has("relatedAction")) {
17329      JsonArray array = json.getAsJsonArray("relatedAction");
17330      for (int i = 0; i < array.size(); i++) {
17331        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
17332      }
17333    };
17334    Type timing = parseType("timing", json);
17335    if (timing != null)
17336      res.setTiming(timing);
17337    if (json.has("participant")) {
17338      JsonArray array = json.getAsJsonArray("participant");
17339      for (int i = 0; i < array.size(); i++) {
17340        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
17341      }
17342    };
17343    if (json.has("type"))
17344      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17345    if (json.has("groupingBehavior"))
17346      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
17347    if (json.has("_groupingBehavior"))
17348      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
17349    if (json.has("selectionBehavior"))
17350      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
17351    if (json.has("_selectionBehavior"))
17352      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
17353    if (json.has("requiredBehavior"))
17354      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
17355    if (json.has("_requiredBehavior"))
17356      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
17357    if (json.has("precheckBehavior"))
17358      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
17359    if (json.has("_precheckBehavior"))
17360      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
17361    if (json.has("cardinalityBehavior"))
17362      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
17363    if (json.has("_cardinalityBehavior"))
17364      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
17365    if (json.has("definition"))
17366      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
17367    if (json.has("_definition"))
17368      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
17369    if (json.has("transform"))
17370      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
17371    if (json.has("_transform"))
17372      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
17373    if (json.has("dynamicValue")) {
17374      JsonArray array = json.getAsJsonArray("dynamicValue");
17375      for (int i = 0; i < array.size(); i++) {
17376        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
17377      }
17378    };
17379    if (json.has("action")) {
17380      JsonArray array = json.getAsJsonArray("action");
17381      for (int i = 0; i < array.size(); i++) {
17382        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
17383      }
17384    };
17385  }
17386
17387  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
17388    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
17389    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
17390    return res;
17391  }
17392
17393  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
17394    parseBackboneElementProperties(json, res);
17395    if (json.has("kind"))
17396      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
17397    if (json.has("_kind"))
17398      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
17399    if (json.has("description"))
17400      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17401    if (json.has("_description"))
17402      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17403    if (json.has("language"))
17404      res.setLanguageElement(parseString(json.get("language").getAsString()));
17405    if (json.has("_language"))
17406      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
17407    if (json.has("expression"))
17408      res.setExpressionElement(parseString(json.get("expression").getAsString()));
17409    if (json.has("_expression"))
17410      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
17411  }
17412
17413  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
17414    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
17415    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
17416    return res;
17417  }
17418
17419  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
17420    parseBackboneElementProperties(json, res);
17421    if (json.has("actionId"))
17422      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
17423    if (json.has("_actionId"))
17424      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
17425    if (json.has("relationship"))
17426      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
17427    if (json.has("_relationship"))
17428      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
17429    Type offset = parseType("offset", json);
17430    if (offset != null)
17431      res.setOffset(offset);
17432  }
17433
17434  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
17435    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
17436    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
17437    return res;
17438  }
17439
17440  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
17441    parseBackboneElementProperties(json, res);
17442    if (json.has("type"))
17443      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
17444    if (json.has("_type"))
17445      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17446    if (json.has("role"))
17447      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
17448  }
17449
17450  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
17451    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
17452    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
17453    return res;
17454  }
17455
17456  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
17457    parseBackboneElementProperties(json, res);
17458    if (json.has("description"))
17459      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17460    if (json.has("_description"))
17461      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17462    if (json.has("path"))
17463      res.setPathElement(parseString(json.get("path").getAsString()));
17464    if (json.has("_path"))
17465      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
17466    if (json.has("language"))
17467      res.setLanguageElement(parseString(json.get("language").getAsString()));
17468    if (json.has("_language"))
17469      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
17470    if (json.has("expression"))
17471      res.setExpressionElement(parseString(json.get("expression").getAsString()));
17472    if (json.has("_expression"))
17473      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
17474  }
17475
17476  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
17477    Practitioner res = new Practitioner();
17478    parsePractitionerProperties(json, res);
17479    return res;
17480  }
17481
17482  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
17483    parseDomainResourceProperties(json, res);
17484    if (json.has("identifier")) {
17485      JsonArray array = json.getAsJsonArray("identifier");
17486      for (int i = 0; i < array.size(); i++) {
17487        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17488      }
17489    };
17490    if (json.has("active"))
17491      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
17492    if (json.has("_active"))
17493      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
17494    if (json.has("name")) {
17495      JsonArray array = json.getAsJsonArray("name");
17496      for (int i = 0; i < array.size(); i++) {
17497        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
17498      }
17499    };
17500    if (json.has("telecom")) {
17501      JsonArray array = json.getAsJsonArray("telecom");
17502      for (int i = 0; i < array.size(); i++) {
17503        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
17504      }
17505    };
17506    if (json.has("address")) {
17507      JsonArray array = json.getAsJsonArray("address");
17508      for (int i = 0; i < array.size(); i++) {
17509        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
17510      }
17511    };
17512    if (json.has("gender"))
17513      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
17514    if (json.has("_gender"))
17515      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
17516    if (json.has("birthDate"))
17517      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
17518    if (json.has("_birthDate"))
17519      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
17520    if (json.has("photo")) {
17521      JsonArray array = json.getAsJsonArray("photo");
17522      for (int i = 0; i < array.size(); i++) {
17523        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
17524      }
17525    };
17526    if (json.has("qualification")) {
17527      JsonArray array = json.getAsJsonArray("qualification");
17528      for (int i = 0; i < array.size(); i++) {
17529        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
17530      }
17531    };
17532    if (json.has("communication")) {
17533      JsonArray array = json.getAsJsonArray("communication");
17534      for (int i = 0; i < array.size(); i++) {
17535        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17536      }
17537    };
17538  }
17539
17540  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
17541    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
17542    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
17543    return res;
17544  }
17545
17546  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
17547    parseBackboneElementProperties(json, res);
17548    if (json.has("identifier")) {
17549      JsonArray array = json.getAsJsonArray("identifier");
17550      for (int i = 0; i < array.size(); i++) {
17551        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17552      }
17553    };
17554    if (json.has("code"))
17555      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17556    if (json.has("period"))
17557      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
17558    if (json.has("issuer"))
17559      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
17560  }
17561
17562  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
17563    PractitionerRole res = new PractitionerRole();
17564    parsePractitionerRoleProperties(json, res);
17565    return res;
17566  }
17567
17568  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
17569    parseDomainResourceProperties(json, res);
17570    if (json.has("identifier")) {
17571      JsonArray array = json.getAsJsonArray("identifier");
17572      for (int i = 0; i < array.size(); i++) {
17573        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17574      }
17575    };
17576    if (json.has("active"))
17577      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
17578    if (json.has("_active"))
17579      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
17580    if (json.has("period"))
17581      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
17582    if (json.has("practitioner"))
17583      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
17584    if (json.has("organization"))
17585      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
17586    if (json.has("code")) {
17587      JsonArray array = json.getAsJsonArray("code");
17588      for (int i = 0; i < array.size(); i++) {
17589        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17590      }
17591    };
17592    if (json.has("specialty")) {
17593      JsonArray array = json.getAsJsonArray("specialty");
17594      for (int i = 0; i < array.size(); i++) {
17595        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17596      }
17597    };
17598    if (json.has("location")) {
17599      JsonArray array = json.getAsJsonArray("location");
17600      for (int i = 0; i < array.size(); i++) {
17601        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
17602      }
17603    };
17604    if (json.has("healthcareService")) {
17605      JsonArray array = json.getAsJsonArray("healthcareService");
17606      for (int i = 0; i < array.size(); i++) {
17607        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
17608      }
17609    };
17610    if (json.has("telecom")) {
17611      JsonArray array = json.getAsJsonArray("telecom");
17612      for (int i = 0; i < array.size(); i++) {
17613        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
17614      }
17615    };
17616    if (json.has("availableTime")) {
17617      JsonArray array = json.getAsJsonArray("availableTime");
17618      for (int i = 0; i < array.size(); i++) {
17619        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
17620      }
17621    };
17622    if (json.has("notAvailable")) {
17623      JsonArray array = json.getAsJsonArray("notAvailable");
17624      for (int i = 0; i < array.size(); i++) {
17625        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
17626      }
17627    };
17628    if (json.has("availabilityExceptions"))
17629      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
17630    if (json.has("_availabilityExceptions"))
17631      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
17632    if (json.has("endpoint")) {
17633      JsonArray array = json.getAsJsonArray("endpoint");
17634      for (int i = 0; i < array.size(); i++) {
17635        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
17636      }
17637    };
17638  }
17639
17640  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
17641    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
17642    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
17643    return res;
17644  }
17645
17646  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
17647    parseBackboneElementProperties(json, res);
17648    if (json.has("daysOfWeek")) {
17649      JsonArray array = json.getAsJsonArray("daysOfWeek");
17650      for (int i = 0; i < array.size(); i++) {
17651        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
17652      }
17653    };
17654    if (json.has("_daysOfWeek")) {
17655      JsonArray array = json.getAsJsonArray("_daysOfWeek");
17656      for (int i = 0; i < array.size(); i++) {
17657        if (i == res.getDaysOfWeek().size())
17658          res.getDaysOfWeek().add(parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
17659        if (array.get(i) instanceof JsonObject) 
17660          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
17661      }
17662    };
17663    if (json.has("allDay"))
17664      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
17665    if (json.has("_allDay"))
17666      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
17667    if (json.has("availableStartTime"))
17668      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
17669    if (json.has("_availableStartTime"))
17670      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
17671    if (json.has("availableEndTime"))
17672      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
17673    if (json.has("_availableEndTime"))
17674      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
17675  }
17676
17677  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
17678    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
17679    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
17680    return res;
17681  }
17682
17683  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
17684    parseBackboneElementProperties(json, res);
17685    if (json.has("description"))
17686      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17687    if (json.has("_description"))
17688      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17689    if (json.has("during"))
17690      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
17691  }
17692
17693  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
17694    Procedure res = new Procedure();
17695    parseProcedureProperties(json, res);
17696    return res;
17697  }
17698
17699  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
17700    parseDomainResourceProperties(json, res);
17701    if (json.has("identifier")) {
17702      JsonArray array = json.getAsJsonArray("identifier");
17703      for (int i = 0; i < array.size(); i++) {
17704        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17705      }
17706    };
17707    if (json.has("instantiates")) {
17708      JsonArray array = json.getAsJsonArray("instantiates");
17709      for (int i = 0; i < array.size(); i++) {
17710        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
17711      }
17712    };
17713    if (json.has("_instantiates")) {
17714      JsonArray array = json.getAsJsonArray("_instantiates");
17715      for (int i = 0; i < array.size(); i++) {
17716        if (i == res.getInstantiates().size())
17717          res.getInstantiates().add(parseUri(null));
17718        if (array.get(i) instanceof JsonObject) 
17719          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
17720      }
17721    };
17722    if (json.has("basedOn")) {
17723      JsonArray array = json.getAsJsonArray("basedOn");
17724      for (int i = 0; i < array.size(); i++) {
17725        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17726      }
17727    };
17728    if (json.has("partOf")) {
17729      JsonArray array = json.getAsJsonArray("partOf");
17730      for (int i = 0; i < array.size(); i++) {
17731        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17732      }
17733    };
17734    if (json.has("status"))
17735      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
17736    if (json.has("_status"))
17737      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17738    if (json.has("statusReason"))
17739      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
17740    if (json.has("category"))
17741      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
17742    if (json.has("code"))
17743      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17744    if (json.has("subject"))
17745      res.setSubject(parseReference(json.getAsJsonObject("subject")));
17746    if (json.has("context"))
17747      res.setContext(parseReference(json.getAsJsonObject("context")));
17748    Type performed = parseType("performed", json);
17749    if (performed != null)
17750      res.setPerformed(performed);
17751    if (json.has("recorder"))
17752      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
17753    if (json.has("asserter"))
17754      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
17755    if (json.has("performer")) {
17756      JsonArray array = json.getAsJsonArray("performer");
17757      for (int i = 0; i < array.size(); i++) {
17758        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
17759      }
17760    };
17761    if (json.has("location"))
17762      res.setLocation(parseReference(json.getAsJsonObject("location")));
17763    if (json.has("reasonCode")) {
17764      JsonArray array = json.getAsJsonArray("reasonCode");
17765      for (int i = 0; i < array.size(); i++) {
17766        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17767      }
17768    };
17769    if (json.has("reasonReference")) {
17770      JsonArray array = json.getAsJsonArray("reasonReference");
17771      for (int i = 0; i < array.size(); i++) {
17772        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
17773      }
17774    };
17775    if (json.has("bodySite")) {
17776      JsonArray array = json.getAsJsonArray("bodySite");
17777      for (int i = 0; i < array.size(); i++) {
17778        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17779      }
17780    };
17781    if (json.has("outcome"))
17782      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
17783    if (json.has("report")) {
17784      JsonArray array = json.getAsJsonArray("report");
17785      for (int i = 0; i < array.size(); i++) {
17786        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
17787      }
17788    };
17789    if (json.has("complication")) {
17790      JsonArray array = json.getAsJsonArray("complication");
17791      for (int i = 0; i < array.size(); i++) {
17792        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17793      }
17794    };
17795    if (json.has("complicationDetail")) {
17796      JsonArray array = json.getAsJsonArray("complicationDetail");
17797      for (int i = 0; i < array.size(); i++) {
17798        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
17799      }
17800    };
17801    if (json.has("followUp")) {
17802      JsonArray array = json.getAsJsonArray("followUp");
17803      for (int i = 0; i < array.size(); i++) {
17804        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17805      }
17806    };
17807    if (json.has("note")) {
17808      JsonArray array = json.getAsJsonArray("note");
17809      for (int i = 0; i < array.size(); i++) {
17810        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17811      }
17812    };
17813    if (json.has("focalDevice")) {
17814      JsonArray array = json.getAsJsonArray("focalDevice");
17815      for (int i = 0; i < array.size(); i++) {
17816        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
17817      }
17818    };
17819    if (json.has("usedReference")) {
17820      JsonArray array = json.getAsJsonArray("usedReference");
17821      for (int i = 0; i < array.size(); i++) {
17822        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
17823      }
17824    };
17825    if (json.has("usedCode")) {
17826      JsonArray array = json.getAsJsonArray("usedCode");
17827      for (int i = 0; i < array.size(); i++) {
17828        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17829      }
17830    };
17831  }
17832
17833  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
17834    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
17835    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
17836    return res;
17837  }
17838
17839  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
17840    parseBackboneElementProperties(json, res);
17841    if (json.has("role"))
17842      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
17843    if (json.has("actor"))
17844      res.setActor(parseReference(json.getAsJsonObject("actor")));
17845    if (json.has("onBehalfOf"))
17846      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
17847  }
17848
17849  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
17850    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
17851    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
17852    return res;
17853  }
17854
17855  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
17856    parseBackboneElementProperties(json, res);
17857    if (json.has("action"))
17858      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
17859    if (json.has("manipulated"))
17860      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
17861  }
17862
17863  protected ProcessRequest parseProcessRequest(JsonObject json) throws IOException, FHIRFormatError {
17864    ProcessRequest res = new ProcessRequest();
17865    parseProcessRequestProperties(json, res);
17866    return res;
17867  }
17868
17869  protected void parseProcessRequestProperties(JsonObject json, ProcessRequest res) throws IOException, FHIRFormatError {
17870    parseDomainResourceProperties(json, res);
17871    if (json.has("identifier")) {
17872      JsonArray array = json.getAsJsonArray("identifier");
17873      for (int i = 0; i < array.size(); i++) {
17874        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17875      }
17876    };
17877    if (json.has("status"))
17878      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcessRequest.ProcessRequestStatus.NULL, new ProcessRequest.ProcessRequestStatusEnumFactory()));
17879    if (json.has("_status"))
17880      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17881    if (json.has("action"))
17882      res.setActionElement(parseEnumeration(json.get("action").getAsString(), ProcessRequest.ActionList.NULL, new ProcessRequest.ActionListEnumFactory()));
17883    if (json.has("_action"))
17884      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
17885    if (json.has("target"))
17886      res.setTarget(parseReference(json.getAsJsonObject("target")));
17887    if (json.has("created"))
17888      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
17889    if (json.has("_created"))
17890      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
17891    if (json.has("provider"))
17892      res.setProvider(parseReference(json.getAsJsonObject("provider")));
17893    if (json.has("request"))
17894      res.setRequest(parseReference(json.getAsJsonObject("request")));
17895    if (json.has("response"))
17896      res.setResponse(parseReference(json.getAsJsonObject("response")));
17897    if (json.has("nullify"))
17898      res.setNullifyElement(parseBoolean(json.get("nullify").getAsBoolean()));
17899    if (json.has("_nullify"))
17900      parseElementProperties(json.getAsJsonObject("_nullify"), res.getNullifyElement());
17901    if (json.has("reference"))
17902      res.setReferenceElement(parseString(json.get("reference").getAsString()));
17903    if (json.has("_reference"))
17904      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
17905    if (json.has("item")) {
17906      JsonArray array = json.getAsJsonArray("item");
17907      for (int i = 0; i < array.size(); i++) {
17908        res.getItem().add(parseProcessRequestItemsComponent(array.get(i).getAsJsonObject(), res));
17909      }
17910    };
17911    if (json.has("include")) {
17912      JsonArray array = json.getAsJsonArray("include");
17913      for (int i = 0; i < array.size(); i++) {
17914        res.getInclude().add(parseString(array.get(i).getAsString()));
17915      }
17916    };
17917    if (json.has("_include")) {
17918      JsonArray array = json.getAsJsonArray("_include");
17919      for (int i = 0; i < array.size(); i++) {
17920        if (i == res.getInclude().size())
17921          res.getInclude().add(parseString(null));
17922        if (array.get(i) instanceof JsonObject) 
17923          parseElementProperties(array.get(i).getAsJsonObject(), res.getInclude().get(i));
17924      }
17925    };
17926    if (json.has("exclude")) {
17927      JsonArray array = json.getAsJsonArray("exclude");
17928      for (int i = 0; i < array.size(); i++) {
17929        res.getExclude().add(parseString(array.get(i).getAsString()));
17930      }
17931    };
17932    if (json.has("_exclude")) {
17933      JsonArray array = json.getAsJsonArray("_exclude");
17934      for (int i = 0; i < array.size(); i++) {
17935        if (i == res.getExclude().size())
17936          res.getExclude().add(parseString(null));
17937        if (array.get(i) instanceof JsonObject) 
17938          parseElementProperties(array.get(i).getAsJsonObject(), res.getExclude().get(i));
17939      }
17940    };
17941    if (json.has("period"))
17942      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
17943  }
17944
17945  protected ProcessRequest.ItemsComponent parseProcessRequestItemsComponent(JsonObject json, ProcessRequest owner) throws IOException, FHIRFormatError {
17946    ProcessRequest.ItemsComponent res = new ProcessRequest.ItemsComponent();
17947    parseProcessRequestItemsComponentProperties(json, owner, res);
17948    return res;
17949  }
17950
17951  protected void parseProcessRequestItemsComponentProperties(JsonObject json, ProcessRequest owner, ProcessRequest.ItemsComponent res) throws IOException, FHIRFormatError {
17952    parseBackboneElementProperties(json, res);
17953    if (json.has("sequenceLinkId"))
17954      res.setSequenceLinkIdElement(parseInteger(json.get("sequenceLinkId").getAsLong()));
17955    if (json.has("_sequenceLinkId"))
17956      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
17957  }
17958
17959  protected ProcessResponse parseProcessResponse(JsonObject json) throws IOException, FHIRFormatError {
17960    ProcessResponse res = new ProcessResponse();
17961    parseProcessResponseProperties(json, res);
17962    return res;
17963  }
17964
17965  protected void parseProcessResponseProperties(JsonObject json, ProcessResponse res) throws IOException, FHIRFormatError {
17966    parseDomainResourceProperties(json, res);
17967    if (json.has("identifier")) {
17968      JsonArray array = json.getAsJsonArray("identifier");
17969      for (int i = 0; i < array.size(); i++) {
17970        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17971      }
17972    };
17973    if (json.has("status"))
17974      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcessResponse.ProcessResponseStatus.NULL, new ProcessResponse.ProcessResponseStatusEnumFactory()));
17975    if (json.has("_status"))
17976      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17977    if (json.has("created"))
17978      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
17979    if (json.has("_created"))
17980      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
17981    if (json.has("organization"))
17982      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
17983    if (json.has("request"))
17984      res.setRequest(parseReference(json.getAsJsonObject("request")));
17985    if (json.has("outcome"))
17986      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ProcessResponse.ProcessingOutcome.NULL, new ProcessResponse.ProcessingOutcomeEnumFactory()));
17987    if (json.has("_outcome"))
17988      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
17989    if (json.has("disposition"))
17990      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
17991    if (json.has("_disposition"))
17992      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
17993    if (json.has("requestProvider"))
17994      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
17995    if (json.has("form"))
17996      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
17997    if (json.has("processNote")) {
17998      JsonArray array = json.getAsJsonArray("processNote");
17999      for (int i = 0; i < array.size(); i++) {
18000        res.getProcessNote().add(parseProcessResponseProcessResponseProcessNoteComponent(array.get(i).getAsJsonObject(), res));
18001      }
18002    };
18003    if (json.has("error")) {
18004      JsonArray array = json.getAsJsonArray("error");
18005      for (int i = 0; i < array.size(); i++) {
18006        res.getError().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18007      }
18008    };
18009    if (json.has("communicationRequest")) {
18010      JsonArray array = json.getAsJsonArray("communicationRequest");
18011      for (int i = 0; i < array.size(); i++) {
18012        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
18013      }
18014    };
18015  }
18016
18017  protected ProcessResponse.ProcessResponseProcessNoteComponent parseProcessResponseProcessResponseProcessNoteComponent(JsonObject json, ProcessResponse owner) throws IOException, FHIRFormatError {
18018    ProcessResponse.ProcessResponseProcessNoteComponent res = new ProcessResponse.ProcessResponseProcessNoteComponent();
18019    parseProcessResponseProcessResponseProcessNoteComponentProperties(json, owner, res);
18020    return res;
18021  }
18022
18023  protected void parseProcessResponseProcessResponseProcessNoteComponentProperties(JsonObject json, ProcessResponse owner, ProcessResponse.ProcessResponseProcessNoteComponent res) throws IOException, FHIRFormatError {
18024    parseBackboneElementProperties(json, res);
18025    if (json.has("type"))
18026      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
18027    if (json.has("_type"))
18028      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18029    if (json.has("text"))
18030      res.setTextElement(parseString(json.get("text").getAsString()));
18031    if (json.has("_text"))
18032      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
18033  }
18034
18035  protected ProductPlan parseProductPlan(JsonObject json) throws IOException, FHIRFormatError {
18036    ProductPlan res = new ProductPlan();
18037    parseProductPlanProperties(json, res);
18038    return res;
18039  }
18040
18041  protected void parseProductPlanProperties(JsonObject json, ProductPlan res) throws IOException, FHIRFormatError {
18042    parseDomainResourceProperties(json, res);
18043    if (json.has("identifier")) {
18044      JsonArray array = json.getAsJsonArray("identifier");
18045      for (int i = 0; i < array.size(); i++) {
18046        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18047      }
18048    };
18049    if (json.has("status"))
18050      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18051    if (json.has("_status"))
18052      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18053    if (json.has("type")) {
18054      JsonArray array = json.getAsJsonArray("type");
18055      for (int i = 0; i < array.size(); i++) {
18056        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18057      }
18058    };
18059    if (json.has("name"))
18060      res.setNameElement(parseString(json.get("name").getAsString()));
18061    if (json.has("_name"))
18062      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18063    if (json.has("alias")) {
18064      JsonArray array = json.getAsJsonArray("alias");
18065      for (int i = 0; i < array.size(); i++) {
18066        res.getAlias().add(parseString(array.get(i).getAsString()));
18067      }
18068    };
18069    if (json.has("_alias")) {
18070      JsonArray array = json.getAsJsonArray("_alias");
18071      for (int i = 0; i < array.size(); i++) {
18072        if (i == res.getAlias().size())
18073          res.getAlias().add(parseString(null));
18074        if (array.get(i) instanceof JsonObject) 
18075          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
18076      }
18077    };
18078    if (json.has("period"))
18079      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
18080    if (json.has("ownedBy"))
18081      res.setOwnedBy(parseReference(json.getAsJsonObject("ownedBy")));
18082    if (json.has("administeredBy"))
18083      res.setAdministeredBy(parseReference(json.getAsJsonObject("administeredBy")));
18084    if (json.has("coverageArea"))
18085      res.setCoverageArea(parseReference(json.getAsJsonObject("coverageArea")));
18086    if (json.has("contact")) {
18087      JsonArray array = json.getAsJsonArray("contact");
18088      for (int i = 0; i < array.size(); i++) {
18089        res.getContact().add(parseProductPlanProductPlanContactComponent(array.get(i).getAsJsonObject(), res));
18090      }
18091    };
18092    if (json.has("endpoint")) {
18093      JsonArray array = json.getAsJsonArray("endpoint");
18094      for (int i = 0; i < array.size(); i++) {
18095        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
18096      }
18097    };
18098    if (json.has("network")) {
18099      JsonArray array = json.getAsJsonArray("network");
18100      for (int i = 0; i < array.size(); i++) {
18101        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
18102      }
18103    };
18104    if (json.has("coverage")) {
18105      JsonArray array = json.getAsJsonArray("coverage");
18106      for (int i = 0; i < array.size(); i++) {
18107        res.getCoverage().add(parseProductPlanProductPlanCoverageComponent(array.get(i).getAsJsonObject(), res));
18108      }
18109    };
18110    if (json.has("plan")) {
18111      JsonArray array = json.getAsJsonArray("plan");
18112      for (int i = 0; i < array.size(); i++) {
18113        res.getPlan().add(parseProductPlanProductPlanPlanComponent(array.get(i).getAsJsonObject(), res));
18114      }
18115    };
18116  }
18117
18118  protected ProductPlan.ProductPlanContactComponent parseProductPlanProductPlanContactComponent(JsonObject json, ProductPlan owner) throws IOException, FHIRFormatError {
18119    ProductPlan.ProductPlanContactComponent res = new ProductPlan.ProductPlanContactComponent();
18120    parseProductPlanProductPlanContactComponentProperties(json, owner, res);
18121    return res;
18122  }
18123
18124  protected void parseProductPlanProductPlanContactComponentProperties(JsonObject json, ProductPlan owner, ProductPlan.ProductPlanContactComponent res) throws IOException, FHIRFormatError {
18125    parseBackboneElementProperties(json, res);
18126    if (json.has("purpose"))
18127      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
18128    if (json.has("name"))
18129      res.setName(parseHumanName(json.getAsJsonObject("name")));
18130    if (json.has("telecom")) {
18131      JsonArray array = json.getAsJsonArray("telecom");
18132      for (int i = 0; i < array.size(); i++) {
18133        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
18134      }
18135    };
18136    if (json.has("address"))
18137      res.setAddress(parseAddress(json.getAsJsonObject("address")));
18138  }
18139
18140  protected ProductPlan.ProductPlanCoverageComponent parseProductPlanProductPlanCoverageComponent(JsonObject json, ProductPlan owner) throws IOException, FHIRFormatError {
18141    ProductPlan.ProductPlanCoverageComponent res = new ProductPlan.ProductPlanCoverageComponent();
18142    parseProductPlanProductPlanCoverageComponentProperties(json, owner, res);
18143    return res;
18144  }
18145
18146  protected void parseProductPlanProductPlanCoverageComponentProperties(JsonObject json, ProductPlan owner, ProductPlan.ProductPlanCoverageComponent res) throws IOException, FHIRFormatError {
18147    parseBackboneElementProperties(json, res);
18148    if (json.has("type"))
18149      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18150    if (json.has("network")) {
18151      JsonArray array = json.getAsJsonArray("network");
18152      for (int i = 0; i < array.size(); i++) {
18153        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
18154      }
18155    };
18156    if (json.has("benefit")) {
18157      JsonArray array = json.getAsJsonArray("benefit");
18158      for (int i = 0; i < array.size(); i++) {
18159        res.getBenefit().add(parseProductPlanProductPlanCoverageBenefitComponent(array.get(i).getAsJsonObject(), owner));
18160      }
18161    };
18162  }
18163
18164  protected ProductPlan.ProductPlanCoverageBenefitComponent parseProductPlanProductPlanCoverageBenefitComponent(JsonObject json, ProductPlan owner) throws IOException, FHIRFormatError {
18165    ProductPlan.ProductPlanCoverageBenefitComponent res = new ProductPlan.ProductPlanCoverageBenefitComponent();
18166    parseProductPlanProductPlanCoverageBenefitComponentProperties(json, owner, res);
18167    return res;
18168  }
18169
18170  protected void parseProductPlanProductPlanCoverageBenefitComponentProperties(JsonObject json, ProductPlan owner, ProductPlan.ProductPlanCoverageBenefitComponent res) throws IOException, FHIRFormatError {
18171    parseBackboneElementProperties(json, res);
18172    if (json.has("type"))
18173      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18174    if (json.has("requirement"))
18175      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
18176    if (json.has("_requirement"))
18177      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
18178    if (json.has("limit")) {
18179      JsonArray array = json.getAsJsonArray("limit");
18180      for (int i = 0; i < array.size(); i++) {
18181        res.getLimit().add(parseProductPlanProductPlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject(), owner));
18182      }
18183    };
18184  }
18185
18186  protected ProductPlan.ProductPlanCoverageBenefitLimitComponent parseProductPlanProductPlanCoverageBenefitLimitComponent(JsonObject json, ProductPlan owner) throws IOException, FHIRFormatError {
18187    ProductPlan.ProductPlanCoverageBenefitLimitComponent res = new ProductPlan.ProductPlanCoverageBenefitLimitComponent();
18188    parseProductPlanProductPlanCoverageBenefitLimitComponentProperties(json, owner, res);
18189    return res;
18190  }
18191
18192  protected void parseProductPlanProductPlanCoverageBenefitLimitComponentProperties(JsonObject json, ProductPlan owner, ProductPlan.ProductPlanCoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
18193    parseBackboneElementProperties(json, res);
18194    if (json.has("value"))
18195      res.setValue(parseQuantity(json.getAsJsonObject("value")));
18196    if (json.has("code"))
18197      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
18198  }
18199
18200  protected ProductPlan.ProductPlanPlanComponent parseProductPlanProductPlanPlanComponent(JsonObject json, ProductPlan owner) throws IOException, FHIRFormatError {
18201    ProductPlan.ProductPlanPlanComponent res = new ProductPlan.ProductPlanPlanComponent();
18202    parseProductPlanProductPlanPlanComponentProperties(json, owner, res);
18203    return res;
18204  }
18205
18206  protected void parseProductPlanProductPlanPlanComponentProperties(JsonObject json, ProductPlan owner, ProductPlan.ProductPlanPlanComponent res) throws IOException, FHIRFormatError {
18207    parseBackboneElementProperties(json, res);
18208    if (json.has("identifier")) {
18209      JsonArray array = json.getAsJsonArray("identifier");
18210      for (int i = 0; i < array.size(); i++) {
18211        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18212      }
18213    };
18214    if (json.has("type"))
18215      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18216    if (json.has("coverageArea"))
18217      res.setCoverageArea(parseReference(json.getAsJsonObject("coverageArea")));
18218    if (json.has("network")) {
18219      JsonArray array = json.getAsJsonArray("network");
18220      for (int i = 0; i < array.size(); i++) {
18221        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
18222      }
18223    };
18224    if (json.has("generalCost")) {
18225      JsonArray array = json.getAsJsonArray("generalCost");
18226      for (int i = 0; i < array.size(); i++) {
18227        res.getGeneralCost().add(parseProductPlanProductPlanPlanGeneralCostComponent(array.get(i).getAsJsonObject(), owner));
18228      }
18229    };
18230    if (json.has("specificCost")) {
18231      JsonArray array = json.getAsJsonArray("specificCost");
18232      for (int i = 0; i < array.size(); i++) {
18233        res.getSpecificCost().add(parseProductPlanProductPlanPlanSpecificCostComponent(array.get(i).getAsJsonObject(), owner));
18234      }
18235    };
18236  }
18237
18238  protected ProductPlan.ProductPlanPlanGeneralCostComponent parseProductPlanProductPlanPlanGeneralCostComponent(JsonObject json, ProductPlan owner) throws IOException, FHIRFormatError {
18239    ProductPlan.ProductPlanPlanGeneralCostComponent res = new ProductPlan.ProductPlanPlanGeneralCostComponent();
18240    parseProductPlanProductPlanPlanGeneralCostComponentProperties(json, owner, res);
18241    return res;
18242  }
18243
18244  protected void parseProductPlanProductPlanPlanGeneralCostComponentProperties(JsonObject json, ProductPlan owner, ProductPlan.ProductPlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
18245    parseBackboneElementProperties(json, res);
18246    if (json.has("type"))
18247      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18248    if (json.has("groupSize"))
18249      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
18250    if (json.has("_groupSize"))
18251      parseElementProperties(json.getAsJsonObject("_groupSize"), res.getGroupSizeElement());
18252    if (json.has("cost"))
18253      res.setCost(parseMoney(json.getAsJsonObject("cost")));
18254    if (json.has("comment"))
18255      res.setCommentElement(parseString(json.get("comment").getAsString()));
18256    if (json.has("_comment"))
18257      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
18258  }
18259
18260  protected ProductPlan.ProductPlanPlanSpecificCostComponent parseProductPlanProductPlanPlanSpecificCostComponent(JsonObject json, ProductPlan owner) throws IOException, FHIRFormatError {
18261    ProductPlan.ProductPlanPlanSpecificCostComponent res = new ProductPlan.ProductPlanPlanSpecificCostComponent();
18262    parseProductPlanProductPlanPlanSpecificCostComponentProperties(json, owner, res);
18263    return res;
18264  }
18265
18266  protected void parseProductPlanProductPlanPlanSpecificCostComponentProperties(JsonObject json, ProductPlan owner, ProductPlan.ProductPlanPlanSpecificCostComponent res) throws IOException, FHIRFormatError {
18267    parseBackboneElementProperties(json, res);
18268    if (json.has("category"))
18269      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
18270    if (json.has("benefit")) {
18271      JsonArray array = json.getAsJsonArray("benefit");
18272      for (int i = 0; i < array.size(); i++) {
18273        res.getBenefit().add(parseProductPlanProductPlanPlanSpecificCostBenefitComponent(array.get(i).getAsJsonObject(), owner));
18274      }
18275    };
18276  }
18277
18278  protected ProductPlan.ProductPlanPlanSpecificCostBenefitComponent parseProductPlanProductPlanPlanSpecificCostBenefitComponent(JsonObject json, ProductPlan owner) throws IOException, FHIRFormatError {
18279    ProductPlan.ProductPlanPlanSpecificCostBenefitComponent res = new ProductPlan.ProductPlanPlanSpecificCostBenefitComponent();
18280    parseProductPlanProductPlanPlanSpecificCostBenefitComponentProperties(json, owner, res);
18281    return res;
18282  }
18283
18284  protected void parseProductPlanProductPlanPlanSpecificCostBenefitComponentProperties(JsonObject json, ProductPlan owner, ProductPlan.ProductPlanPlanSpecificCostBenefitComponent res) throws IOException, FHIRFormatError {
18285    parseBackboneElementProperties(json, res);
18286    if (json.has("type"))
18287      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18288    if (json.has("description"))
18289      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18290    if (json.has("_description"))
18291      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18292    if (json.has("cost")) {
18293      JsonArray array = json.getAsJsonArray("cost");
18294      for (int i = 0; i < array.size(); i++) {
18295        res.getCost().add(parseProductPlanProductPlanPlanSpecificCostBenefitCostComponent(array.get(i).getAsJsonObject(), owner));
18296      }
18297    };
18298  }
18299
18300  protected ProductPlan.ProductPlanPlanSpecificCostBenefitCostComponent parseProductPlanProductPlanPlanSpecificCostBenefitCostComponent(JsonObject json, ProductPlan owner) throws IOException, FHIRFormatError {
18301    ProductPlan.ProductPlanPlanSpecificCostBenefitCostComponent res = new ProductPlan.ProductPlanPlanSpecificCostBenefitCostComponent();
18302    parseProductPlanProductPlanPlanSpecificCostBenefitCostComponentProperties(json, owner, res);
18303    return res;
18304  }
18305
18306  protected void parseProductPlanProductPlanPlanSpecificCostBenefitCostComponentProperties(JsonObject json, ProductPlan owner, ProductPlan.ProductPlanPlanSpecificCostBenefitCostComponent res) throws IOException, FHIRFormatError {
18307    parseBackboneElementProperties(json, res);
18308    if (json.has("type"))
18309      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18310    if (json.has("applicability"))
18311      res.setApplicabilityElement(parseEnumeration(json.get("applicability").getAsString(), ProductPlan.BenefitCostApplicability.NULL, new ProductPlan.BenefitCostApplicabilityEnumFactory()));
18312    if (json.has("_applicability"))
18313      parseElementProperties(json.getAsJsonObject("_applicability"), res.getApplicabilityElement());
18314    if (json.has("qualifiers")) {
18315      JsonArray array = json.getAsJsonArray("qualifiers");
18316      for (int i = 0; i < array.size(); i++) {
18317        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18318      }
18319    };
18320    if (json.has("value"))
18321      res.setValue(parseMoney(json.getAsJsonObject("value")));
18322  }
18323
18324  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
18325    Provenance res = new Provenance();
18326    parseProvenanceProperties(json, res);
18327    return res;
18328  }
18329
18330  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
18331    parseDomainResourceProperties(json, res);
18332    if (json.has("target")) {
18333      JsonArray array = json.getAsJsonArray("target");
18334      for (int i = 0; i < array.size(); i++) {
18335        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
18336      }
18337    };
18338    Type occurred = parseType("occurred", json);
18339    if (occurred != null)
18340      res.setOccurred(occurred);
18341    if (json.has("recorded"))
18342      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
18343    if (json.has("_recorded"))
18344      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
18345    if (json.has("policy")) {
18346      JsonArray array = json.getAsJsonArray("policy");
18347      for (int i = 0; i < array.size(); i++) {
18348        res.getPolicy().add(parseUri(array.get(i).getAsString()));
18349      }
18350    };
18351    if (json.has("_policy")) {
18352      JsonArray array = json.getAsJsonArray("_policy");
18353      for (int i = 0; i < array.size(); i++) {
18354        if (i == res.getPolicy().size())
18355          res.getPolicy().add(parseUri(null));
18356        if (array.get(i) instanceof JsonObject) 
18357          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
18358      }
18359    };
18360    if (json.has("location"))
18361      res.setLocation(parseReference(json.getAsJsonObject("location")));
18362    if (json.has("reason")) {
18363      JsonArray array = json.getAsJsonArray("reason");
18364      for (int i = 0; i < array.size(); i++) {
18365        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18366      }
18367    };
18368    if (json.has("activity"))
18369      res.setActivity(parseCodeableConcept(json.getAsJsonObject("activity")));
18370    if (json.has("agent")) {
18371      JsonArray array = json.getAsJsonArray("agent");
18372      for (int i = 0; i < array.size(); i++) {
18373        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
18374      }
18375    };
18376    if (json.has("entity")) {
18377      JsonArray array = json.getAsJsonArray("entity");
18378      for (int i = 0; i < array.size(); i++) {
18379        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
18380      }
18381    };
18382    if (json.has("signature")) {
18383      JsonArray array = json.getAsJsonArray("signature");
18384      for (int i = 0; i < array.size(); i++) {
18385        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
18386      }
18387    };
18388  }
18389
18390  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
18391    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
18392    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
18393    return res;
18394  }
18395
18396  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
18397    parseBackboneElementProperties(json, res);
18398    if (json.has("type"))
18399      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18400    if (json.has("role")) {
18401      JsonArray array = json.getAsJsonArray("role");
18402      for (int i = 0; i < array.size(); i++) {
18403        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18404      }
18405    };
18406    Type who = parseType("who", json);
18407    if (who != null)
18408      res.setWho(who);
18409    Type onBehalfOf = parseType("onBehalfOf", json);
18410    if (onBehalfOf != null)
18411      res.setOnBehalfOf(onBehalfOf);
18412  }
18413
18414  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
18415    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
18416    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
18417    return res;
18418  }
18419
18420  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
18421    parseBackboneElementProperties(json, res);
18422    if (json.has("role"))
18423      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
18424    if (json.has("_role"))
18425      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
18426    Type what = parseType("what", json);
18427    if (what != null)
18428      res.setWhat(what);
18429    if (json.has("agent")) {
18430      JsonArray array = json.getAsJsonArray("agent");
18431      for (int i = 0; i < array.size(); i++) {
18432        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
18433      }
18434    };
18435  }
18436
18437  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
18438    Questionnaire res = new Questionnaire();
18439    parseQuestionnaireProperties(json, res);
18440    return res;
18441  }
18442
18443  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
18444    parseDomainResourceProperties(json, res);
18445    if (json.has("url"))
18446      res.setUrlElement(parseUri(json.get("url").getAsString()));
18447    if (json.has("_url"))
18448      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18449    if (json.has("identifier")) {
18450      JsonArray array = json.getAsJsonArray("identifier");
18451      for (int i = 0; i < array.size(); i++) {
18452        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18453      }
18454    };
18455    if (json.has("version"))
18456      res.setVersionElement(parseString(json.get("version").getAsString()));
18457    if (json.has("_version"))
18458      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
18459    if (json.has("name"))
18460      res.setNameElement(parseString(json.get("name").getAsString()));
18461    if (json.has("_name"))
18462      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18463    if (json.has("title"))
18464      res.setTitleElement(parseString(json.get("title").getAsString()));
18465    if (json.has("_title"))
18466      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
18467    if (json.has("derivedFrom")) {
18468      JsonArray array = json.getAsJsonArray("derivedFrom");
18469      for (int i = 0; i < array.size(); i++) {
18470        res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
18471      }
18472    };
18473    if (json.has("_derivedFrom")) {
18474      JsonArray array = json.getAsJsonArray("_derivedFrom");
18475      for (int i = 0; i < array.size(); i++) {
18476        if (i == res.getDerivedFrom().size())
18477          res.getDerivedFrom().add(parseCanonical(null));
18478        if (array.get(i) instanceof JsonObject) 
18479          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
18480      }
18481    };
18482    if (json.has("status"))
18483      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18484    if (json.has("_status"))
18485      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18486    if (json.has("experimental"))
18487      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
18488    if (json.has("_experimental"))
18489      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
18490    if (json.has("subjectType")) {
18491      JsonArray array = json.getAsJsonArray("subjectType");
18492      for (int i = 0; i < array.size(); i++) {
18493        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
18494      }
18495    };
18496    if (json.has("_subjectType")) {
18497      JsonArray array = json.getAsJsonArray("_subjectType");
18498      for (int i = 0; i < array.size(); i++) {
18499        if (i == res.getSubjectType().size())
18500          res.getSubjectType().add(parseCode(null));
18501        if (array.get(i) instanceof JsonObject) 
18502          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
18503      }
18504    };
18505    if (json.has("date"))
18506      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18507    if (json.has("_date"))
18508      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
18509    if (json.has("publisher"))
18510      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18511    if (json.has("_publisher"))
18512      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
18513    if (json.has("contact")) {
18514      JsonArray array = json.getAsJsonArray("contact");
18515      for (int i = 0; i < array.size(); i++) {
18516        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18517      }
18518    };
18519    if (json.has("description"))
18520      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18521    if (json.has("_description"))
18522      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18523    if (json.has("useContext")) {
18524      JsonArray array = json.getAsJsonArray("useContext");
18525      for (int i = 0; i < array.size(); i++) {
18526        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18527      }
18528    };
18529    if (json.has("jurisdiction")) {
18530      JsonArray array = json.getAsJsonArray("jurisdiction");
18531      for (int i = 0; i < array.size(); i++) {
18532        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18533      }
18534    };
18535    if (json.has("purpose"))
18536      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
18537    if (json.has("_purpose"))
18538      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
18539    if (json.has("copyright"))
18540      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
18541    if (json.has("_copyright"))
18542      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
18543    if (json.has("approvalDate"))
18544      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
18545    if (json.has("_approvalDate"))
18546      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
18547    if (json.has("lastReviewDate"))
18548      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
18549    if (json.has("_lastReviewDate"))
18550      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
18551    if (json.has("effectivePeriod"))
18552      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
18553    if (json.has("code")) {
18554      JsonArray array = json.getAsJsonArray("code");
18555      for (int i = 0; i < array.size(); i++) {
18556        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
18557      }
18558    };
18559    if (json.has("item")) {
18560      JsonArray array = json.getAsJsonArray("item");
18561      for (int i = 0; i < array.size(); i++) {
18562        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
18563      }
18564    };
18565  }
18566
18567  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
18568    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
18569    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
18570    return res;
18571  }
18572
18573  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
18574    parseBackboneElementProperties(json, res);
18575    if (json.has("linkId"))
18576      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
18577    if (json.has("_linkId"))
18578      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
18579    if (json.has("definition"))
18580      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
18581    if (json.has("_definition"))
18582      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
18583    if (json.has("code")) {
18584      JsonArray array = json.getAsJsonArray("code");
18585      for (int i = 0; i < array.size(); i++) {
18586        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
18587      }
18588    };
18589    if (json.has("prefix"))
18590      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
18591    if (json.has("_prefix"))
18592      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
18593    if (json.has("text"))
18594      res.setTextElement(parseString(json.get("text").getAsString()));
18595    if (json.has("_text"))
18596      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
18597    if (json.has("type"))
18598      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
18599    if (json.has("_type"))
18600      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18601    if (json.has("enableWhen")) {
18602      JsonArray array = json.getAsJsonArray("enableWhen");
18603      for (int i = 0; i < array.size(); i++) {
18604        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
18605      }
18606    };
18607    if (json.has("enableBehavior"))
18608      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(), Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
18609    if (json.has("_enableBehavior"))
18610      parseElementProperties(json.getAsJsonObject("_enableBehavior"), res.getEnableBehaviorElement());
18611    if (json.has("required"))
18612      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
18613    if (json.has("_required"))
18614      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
18615    if (json.has("repeats"))
18616      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
18617    if (json.has("_repeats"))
18618      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
18619    if (json.has("readOnly"))
18620      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
18621    if (json.has("_readOnly"))
18622      parseElementProperties(json.getAsJsonObject("_readOnly"), res.getReadOnlyElement());
18623    if (json.has("maxLength"))
18624      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
18625    if (json.has("_maxLength"))
18626      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
18627    if (json.has("options"))
18628      res.setOptionsElement(parseCanonical(json.get("options").getAsString()));
18629    if (json.has("_options"))
18630      parseElementProperties(json.getAsJsonObject("_options"), res.getOptionsElement());
18631    if (json.has("option")) {
18632      JsonArray array = json.getAsJsonArray("option");
18633      for (int i = 0; i < array.size(); i++) {
18634        res.getOption().add(parseQuestionnaireQuestionnaireItemOptionComponent(array.get(i).getAsJsonObject(), owner));
18635      }
18636    };
18637    if (json.has("initial")) {
18638      JsonArray array = json.getAsJsonArray("initial");
18639      for (int i = 0; i < array.size(); i++) {
18640        res.getInitial().add(parseQuestionnaireQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject(), owner));
18641      }
18642    };
18643    if (json.has("item")) {
18644      JsonArray array = json.getAsJsonArray("item");
18645      for (int i = 0; i < array.size(); i++) {
18646        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
18647      }
18648    };
18649  }
18650
18651  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
18652    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
18653    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
18654    return res;
18655  }
18656
18657  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
18658    parseBackboneElementProperties(json, res);
18659    if (json.has("question"))
18660      res.setQuestionElement(parseString(json.get("question").getAsString()));
18661    if (json.has("_question"))
18662      parseElementProperties(json.getAsJsonObject("_question"), res.getQuestionElement());
18663    if (json.has("operator"))
18664      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
18665    if (json.has("_operator"))
18666      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
18667    Type answer = parseType("answer", json);
18668    if (answer != null)
18669      res.setAnswer(answer);
18670  }
18671
18672  protected Questionnaire.QuestionnaireItemOptionComponent parseQuestionnaireQuestionnaireItemOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
18673    Questionnaire.QuestionnaireItemOptionComponent res = new Questionnaire.QuestionnaireItemOptionComponent();
18674    parseQuestionnaireQuestionnaireItemOptionComponentProperties(json, owner, res);
18675    return res;
18676  }
18677
18678  protected void parseQuestionnaireQuestionnaireItemOptionComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemOptionComponent res) throws IOException, FHIRFormatError {
18679    parseBackboneElementProperties(json, res);
18680    Type value = parseType("value", json);
18681    if (value != null)
18682      res.setValue(value);
18683    if (json.has("initialSelected"))
18684      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
18685    if (json.has("_initialSelected"))
18686      parseElementProperties(json.getAsJsonObject("_initialSelected"), res.getInitialSelectedElement());
18687  }
18688
18689  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireQuestionnaireItemInitialComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
18690    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
18691    parseQuestionnaireQuestionnaireItemInitialComponentProperties(json, owner, res);
18692    return res;
18693  }
18694
18695  protected void parseQuestionnaireQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
18696    parseBackboneElementProperties(json, res);
18697    Type value = parseType("value", json);
18698    if (value != null)
18699      res.setValue(value);
18700  }
18701
18702  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
18703    QuestionnaireResponse res = new QuestionnaireResponse();
18704    parseQuestionnaireResponseProperties(json, res);
18705    return res;
18706  }
18707
18708  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
18709    parseDomainResourceProperties(json, res);
18710    if (json.has("identifier"))
18711      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
18712    if (json.has("basedOn")) {
18713      JsonArray array = json.getAsJsonArray("basedOn");
18714      for (int i = 0; i < array.size(); i++) {
18715        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18716      }
18717    };
18718    if (json.has("partOf")) {
18719      JsonArray array = json.getAsJsonArray("partOf");
18720      for (int i = 0; i < array.size(); i++) {
18721        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18722      }
18723    };
18724    if (json.has("questionnaire"))
18725      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
18726    if (json.has("_questionnaire"))
18727      parseElementProperties(json.getAsJsonObject("_questionnaire"), res.getQuestionnaireElement());
18728    if (json.has("status"))
18729      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
18730    if (json.has("_status"))
18731      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18732    if (json.has("subject"))
18733      res.setSubject(parseReference(json.getAsJsonObject("subject")));
18734    if (json.has("context"))
18735      res.setContext(parseReference(json.getAsJsonObject("context")));
18736    if (json.has("authored"))
18737      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
18738    if (json.has("_authored"))
18739      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
18740    if (json.has("author"))
18741      res.setAuthor(parseReference(json.getAsJsonObject("author")));
18742    if (json.has("source"))
18743      res.setSource(parseReference(json.getAsJsonObject("source")));
18744    if (json.has("item")) {
18745      JsonArray array = json.getAsJsonArray("item");
18746      for (int i = 0; i < array.size(); i++) {
18747        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
18748      }
18749    };
18750  }
18751
18752  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
18753    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
18754    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
18755    return res;
18756  }
18757
18758  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
18759    parseBackboneElementProperties(json, res);
18760    if (json.has("linkId"))
18761      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
18762    if (json.has("_linkId"))
18763      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
18764    if (json.has("definition"))
18765      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
18766    if (json.has("_definition"))
18767      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
18768    if (json.has("text"))
18769      res.setTextElement(parseString(json.get("text").getAsString()));
18770    if (json.has("_text"))
18771      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
18772    if (json.has("subject"))
18773      res.setSubject(parseReference(json.getAsJsonObject("subject")));
18774    if (json.has("answer")) {
18775      JsonArray array = json.getAsJsonArray("answer");
18776      for (int i = 0; i < array.size(); i++) {
18777        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
18778      }
18779    };
18780    if (json.has("item")) {
18781      JsonArray array = json.getAsJsonArray("item");
18782      for (int i = 0; i < array.size(); i++) {
18783        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
18784      }
18785    };
18786  }
18787
18788  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
18789    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
18790    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
18791    return res;
18792  }
18793
18794  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
18795    parseBackboneElementProperties(json, res);
18796    Type value = parseType("value", json);
18797    if (value != null)
18798      res.setValue(value);
18799    if (json.has("item")) {
18800      JsonArray array = json.getAsJsonArray("item");
18801      for (int i = 0; i < array.size(); i++) {
18802        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
18803      }
18804    };
18805  }
18806
18807  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
18808    RelatedPerson res = new RelatedPerson();
18809    parseRelatedPersonProperties(json, res);
18810    return res;
18811  }
18812
18813  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
18814    parseDomainResourceProperties(json, res);
18815    if (json.has("identifier")) {
18816      JsonArray array = json.getAsJsonArray("identifier");
18817      for (int i = 0; i < array.size(); i++) {
18818        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18819      }
18820    };
18821    if (json.has("active"))
18822      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
18823    if (json.has("_active"))
18824      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
18825    if (json.has("patient"))
18826      res.setPatient(parseReference(json.getAsJsonObject("patient")));
18827    if (json.has("relationship")) {
18828      JsonArray array = json.getAsJsonArray("relationship");
18829      for (int i = 0; i < array.size(); i++) {
18830        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18831      }
18832    };
18833    if (json.has("name")) {
18834      JsonArray array = json.getAsJsonArray("name");
18835      for (int i = 0; i < array.size(); i++) {
18836        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
18837      }
18838    };
18839    if (json.has("telecom")) {
18840      JsonArray array = json.getAsJsonArray("telecom");
18841      for (int i = 0; i < array.size(); i++) {
18842        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
18843      }
18844    };
18845    if (json.has("gender"))
18846      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
18847    if (json.has("_gender"))
18848      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
18849    if (json.has("birthDate"))
18850      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
18851    if (json.has("_birthDate"))
18852      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
18853    if (json.has("address")) {
18854      JsonArray array = json.getAsJsonArray("address");
18855      for (int i = 0; i < array.size(); i++) {
18856        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
18857      }
18858    };
18859    if (json.has("photo")) {
18860      JsonArray array = json.getAsJsonArray("photo");
18861      for (int i = 0; i < array.size(); i++) {
18862        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
18863      }
18864    };
18865    if (json.has("period"))
18866      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
18867  }
18868
18869  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
18870    RequestGroup res = new RequestGroup();
18871    parseRequestGroupProperties(json, res);
18872    return res;
18873  }
18874
18875  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
18876    parseDomainResourceProperties(json, res);
18877    if (json.has("identifier")) {
18878      JsonArray array = json.getAsJsonArray("identifier");
18879      for (int i = 0; i < array.size(); i++) {
18880        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18881      }
18882    };
18883    if (json.has("instantiatesCanonical")) {
18884      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
18885      for (int i = 0; i < array.size(); i++) {
18886        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
18887      }
18888    };
18889    if (json.has("_instantiatesCanonical")) {
18890      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
18891      for (int i = 0; i < array.size(); i++) {
18892        if (i == res.getInstantiatesCanonical().size())
18893          res.getInstantiatesCanonical().add(parseCanonical(null));
18894        if (array.get(i) instanceof JsonObject) 
18895          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
18896      }
18897    };
18898    if (json.has("instantiatesUri")) {
18899      JsonArray array = json.getAsJsonArray("instantiatesUri");
18900      for (int i = 0; i < array.size(); i++) {
18901        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
18902      }
18903    };
18904    if (json.has("_instantiatesUri")) {
18905      JsonArray array = json.getAsJsonArray("_instantiatesUri");
18906      for (int i = 0; i < array.size(); i++) {
18907        if (i == res.getInstantiatesUri().size())
18908          res.getInstantiatesUri().add(parseUri(null));
18909        if (array.get(i) instanceof JsonObject) 
18910          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
18911      }
18912    };
18913    if (json.has("basedOn")) {
18914      JsonArray array = json.getAsJsonArray("basedOn");
18915      for (int i = 0; i < array.size(); i++) {
18916        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18917      }
18918    };
18919    if (json.has("replaces")) {
18920      JsonArray array = json.getAsJsonArray("replaces");
18921      for (int i = 0; i < array.size(); i++) {
18922        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
18923      }
18924    };
18925    if (json.has("groupIdentifier"))
18926      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
18927    if (json.has("status"))
18928      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
18929    if (json.has("_status"))
18930      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18931    if (json.has("intent"))
18932      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
18933    if (json.has("_intent"))
18934      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
18935    if (json.has("priority"))
18936      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
18937    if (json.has("_priority"))
18938      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
18939    if (json.has("code"))
18940      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
18941    if (json.has("subject"))
18942      res.setSubject(parseReference(json.getAsJsonObject("subject")));
18943    if (json.has("context"))
18944      res.setContext(parseReference(json.getAsJsonObject("context")));
18945    if (json.has("authoredOn"))
18946      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
18947    if (json.has("_authoredOn"))
18948      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
18949    if (json.has("author"))
18950      res.setAuthor(parseReference(json.getAsJsonObject("author")));
18951    if (json.has("reasonCode")) {
18952      JsonArray array = json.getAsJsonArray("reasonCode");
18953      for (int i = 0; i < array.size(); i++) {
18954        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18955      }
18956    };
18957    if (json.has("reasonReference")) {
18958      JsonArray array = json.getAsJsonArray("reasonReference");
18959      for (int i = 0; i < array.size(); i++) {
18960        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
18961      }
18962    };
18963    if (json.has("note")) {
18964      JsonArray array = json.getAsJsonArray("note");
18965      for (int i = 0; i < array.size(); i++) {
18966        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18967      }
18968    };
18969    if (json.has("action")) {
18970      JsonArray array = json.getAsJsonArray("action");
18971      for (int i = 0; i < array.size(); i++) {
18972        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
18973      }
18974    };
18975  }
18976
18977  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
18978    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
18979    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
18980    return res;
18981  }
18982
18983  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
18984    parseBackboneElementProperties(json, res);
18985    if (json.has("prefix"))
18986      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
18987    if (json.has("_prefix"))
18988      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
18989    if (json.has("title"))
18990      res.setTitleElement(parseString(json.get("title").getAsString()));
18991    if (json.has("_title"))
18992      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
18993    if (json.has("description"))
18994      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18995    if (json.has("_description"))
18996      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18997    if (json.has("textEquivalent"))
18998      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
18999    if (json.has("_textEquivalent"))
19000      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
19001    if (json.has("code")) {
19002      JsonArray array = json.getAsJsonArray("code");
19003      for (int i = 0; i < array.size(); i++) {
19004        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19005      }
19006    };
19007    if (json.has("documentation")) {
19008      JsonArray array = json.getAsJsonArray("documentation");
19009      for (int i = 0; i < array.size(); i++) {
19010        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
19011      }
19012    };
19013    if (json.has("condition")) {
19014      JsonArray array = json.getAsJsonArray("condition");
19015      for (int i = 0; i < array.size(); i++) {
19016        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
19017      }
19018    };
19019    if (json.has("relatedAction")) {
19020      JsonArray array = json.getAsJsonArray("relatedAction");
19021      for (int i = 0; i < array.size(); i++) {
19022        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
19023      }
19024    };
19025    Type timing = parseType("timing", json);
19026    if (timing != null)
19027      res.setTiming(timing);
19028    if (json.has("participant")) {
19029      JsonArray array = json.getAsJsonArray("participant");
19030      for (int i = 0; i < array.size(); i++) {
19031        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
19032      }
19033    };
19034    if (json.has("type"))
19035      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19036    if (json.has("groupingBehavior"))
19037      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
19038    if (json.has("_groupingBehavior"))
19039      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
19040    if (json.has("selectionBehavior"))
19041      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
19042    if (json.has("_selectionBehavior"))
19043      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
19044    if (json.has("requiredBehavior"))
19045      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
19046    if (json.has("_requiredBehavior"))
19047      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
19048    if (json.has("precheckBehavior"))
19049      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
19050    if (json.has("_precheckBehavior"))
19051      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
19052    if (json.has("cardinalityBehavior"))
19053      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
19054    if (json.has("_cardinalityBehavior"))
19055      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
19056    if (json.has("resource"))
19057      res.setResource(parseReference(json.getAsJsonObject("resource")));
19058    if (json.has("action")) {
19059      JsonArray array = json.getAsJsonArray("action");
19060      for (int i = 0; i < array.size(); i++) {
19061        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
19062      }
19063    };
19064  }
19065
19066  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
19067    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
19068    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
19069    return res;
19070  }
19071
19072  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
19073    parseBackboneElementProperties(json, res);
19074    if (json.has("kind"))
19075      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
19076    if (json.has("_kind"))
19077      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
19078    if (json.has("description"))
19079      res.setDescriptionElement(parseString(json.get("description").getAsString()));
19080    if (json.has("_description"))
19081      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19082    if (json.has("language"))
19083      res.setLanguageElement(parseString(json.get("language").getAsString()));
19084    if (json.has("_language"))
19085      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
19086    if (json.has("expression"))
19087      res.setExpressionElement(parseString(json.get("expression").getAsString()));
19088    if (json.has("_expression"))
19089      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
19090  }
19091
19092  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
19093    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
19094    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
19095    return res;
19096  }
19097
19098  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
19099    parseBackboneElementProperties(json, res);
19100    if (json.has("actionId"))
19101      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
19102    if (json.has("_actionId"))
19103      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
19104    if (json.has("relationship"))
19105      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
19106    if (json.has("_relationship"))
19107      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
19108    Type offset = parseType("offset", json);
19109    if (offset != null)
19110      res.setOffset(offset);
19111  }
19112
19113  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
19114    ResearchStudy res = new ResearchStudy();
19115    parseResearchStudyProperties(json, res);
19116    return res;
19117  }
19118
19119  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
19120    parseDomainResourceProperties(json, res);
19121    if (json.has("identifier")) {
19122      JsonArray array = json.getAsJsonArray("identifier");
19123      for (int i = 0; i < array.size(); i++) {
19124        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19125      }
19126    };
19127    if (json.has("title"))
19128      res.setTitleElement(parseString(json.get("title").getAsString()));
19129    if (json.has("_title"))
19130      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
19131    if (json.has("protocol")) {
19132      JsonArray array = json.getAsJsonArray("protocol");
19133      for (int i = 0; i < array.size(); i++) {
19134        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
19135      }
19136    };
19137    if (json.has("partOf")) {
19138      JsonArray array = json.getAsJsonArray("partOf");
19139      for (int i = 0; i < array.size(); i++) {
19140        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
19141      }
19142    };
19143    if (json.has("status"))
19144      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
19145    if (json.has("_status"))
19146      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19147    if (json.has("primaryPurposeType"))
19148      res.setPrimaryPurposeType(parseCodeableConcept(json.getAsJsonObject("primaryPurposeType")));
19149    if (json.has("phase"))
19150      res.setPhase(parseCodeableConcept(json.getAsJsonObject("phase")));
19151    if (json.has("category")) {
19152      JsonArray array = json.getAsJsonArray("category");
19153      for (int i = 0; i < array.size(); i++) {
19154        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19155      }
19156    };
19157    if (json.has("focus")) {
19158      JsonArray array = json.getAsJsonArray("focus");
19159      for (int i = 0; i < array.size(); i++) {
19160        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19161      }
19162    };
19163    if (json.has("condition")) {
19164      JsonArray array = json.getAsJsonArray("condition");
19165      for (int i = 0; i < array.size(); i++) {
19166        res.getCondition().add(parseReference(array.get(i).getAsJsonObject()));
19167      }
19168    };
19169    if (json.has("contact")) {
19170      JsonArray array = json.getAsJsonArray("contact");
19171      for (int i = 0; i < array.size(); i++) {
19172        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19173      }
19174    };
19175    if (json.has("relatedArtifact")) {
19176      JsonArray array = json.getAsJsonArray("relatedArtifact");
19177      for (int i = 0; i < array.size(); i++) {
19178        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
19179      }
19180    };
19181    if (json.has("keyword")) {
19182      JsonArray array = json.getAsJsonArray("keyword");
19183      for (int i = 0; i < array.size(); i++) {
19184        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19185      }
19186    };
19187    if (json.has("location")) {
19188      JsonArray array = json.getAsJsonArray("location");
19189      for (int i = 0; i < array.size(); i++) {
19190        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19191      }
19192    };
19193    if (json.has("description"))
19194      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19195    if (json.has("_description"))
19196      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19197    if (json.has("enrollment")) {
19198      JsonArray array = json.getAsJsonArray("enrollment");
19199      for (int i = 0; i < array.size(); i++) {
19200        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
19201      }
19202    };
19203    if (json.has("period"))
19204      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19205    if (json.has("sponsor"))
19206      res.setSponsor(parseReference(json.getAsJsonObject("sponsor")));
19207    if (json.has("principalInvestigator"))
19208      res.setPrincipalInvestigator(parseReference(json.getAsJsonObject("principalInvestigator")));
19209    if (json.has("site")) {
19210      JsonArray array = json.getAsJsonArray("site");
19211      for (int i = 0; i < array.size(); i++) {
19212        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
19213      }
19214    };
19215    if (json.has("reasonStopped"))
19216      res.setReasonStopped(parseCodeableConcept(json.getAsJsonObject("reasonStopped")));
19217    if (json.has("note")) {
19218      JsonArray array = json.getAsJsonArray("note");
19219      for (int i = 0; i < array.size(); i++) {
19220        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19221      }
19222    };
19223    if (json.has("arm")) {
19224      JsonArray array = json.getAsJsonArray("arm");
19225      for (int i = 0; i < array.size(); i++) {
19226        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
19227      }
19228    };
19229    if (json.has("objective")) {
19230      JsonArray array = json.getAsJsonArray("objective");
19231      for (int i = 0; i < array.size(); i++) {
19232        res.getObjective().add(parseResearchStudyResearchStudyObjectiveComponent(array.get(i).getAsJsonObject(), res));
19233      }
19234    };
19235  }
19236
19237  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
19238    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
19239    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
19240    return res;
19241  }
19242
19243  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
19244    parseBackboneElementProperties(json, res);
19245    if (json.has("name"))
19246      res.setNameElement(parseString(json.get("name").getAsString()));
19247    if (json.has("_name"))
19248      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19249    if (json.has("type"))
19250      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19251    if (json.has("description"))
19252      res.setDescriptionElement(parseString(json.get("description").getAsString()));
19253    if (json.has("_description"))
19254      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19255  }
19256
19257  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyResearchStudyObjectiveComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
19258    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
19259    parseResearchStudyResearchStudyObjectiveComponentProperties(json, owner, res);
19260    return res;
19261  }
19262
19263  protected void parseResearchStudyResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
19264    parseBackboneElementProperties(json, res);
19265    if (json.has("name"))
19266      res.setNameElement(parseString(json.get("name").getAsString()));
19267    if (json.has("_name"))
19268      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19269    if (json.has("type"))
19270      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19271  }
19272
19273  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
19274    ResearchSubject res = new ResearchSubject();
19275    parseResearchSubjectProperties(json, res);
19276    return res;
19277  }
19278
19279  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
19280    parseDomainResourceProperties(json, res);
19281    if (json.has("identifier")) {
19282      JsonArray array = json.getAsJsonArray("identifier");
19283      for (int i = 0; i < array.size(); i++) {
19284        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19285      }
19286    };
19287    if (json.has("status"))
19288      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
19289    if (json.has("_status"))
19290      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19291    if (json.has("period"))
19292      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19293    if (json.has("study"))
19294      res.setStudy(parseReference(json.getAsJsonObject("study")));
19295    if (json.has("individual"))
19296      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
19297    if (json.has("assignedArm"))
19298      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
19299    if (json.has("_assignedArm"))
19300      parseElementProperties(json.getAsJsonObject("_assignedArm"), res.getAssignedArmElement());
19301    if (json.has("actualArm"))
19302      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
19303    if (json.has("_actualArm"))
19304      parseElementProperties(json.getAsJsonObject("_actualArm"), res.getActualArmElement());
19305    if (json.has("consent"))
19306      res.setConsent(parseReference(json.getAsJsonObject("consent")));
19307  }
19308
19309  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
19310    RiskAssessment res = new RiskAssessment();
19311    parseRiskAssessmentProperties(json, res);
19312    return res;
19313  }
19314
19315  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
19316    parseDomainResourceProperties(json, res);
19317    if (json.has("identifier")) {
19318      JsonArray array = json.getAsJsonArray("identifier");
19319      for (int i = 0; i < array.size(); i++) {
19320        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19321      }
19322    };
19323    if (json.has("basedOn"))
19324      res.setBasedOn(parseReference(json.getAsJsonObject("basedOn")));
19325    if (json.has("parent"))
19326      res.setParent(parseReference(json.getAsJsonObject("parent")));
19327    if (json.has("status"))
19328      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
19329    if (json.has("_status"))
19330      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19331    if (json.has("method"))
19332      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
19333    if (json.has("code"))
19334      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19335    if (json.has("subject"))
19336      res.setSubject(parseReference(json.getAsJsonObject("subject")));
19337    if (json.has("context"))
19338      res.setContext(parseReference(json.getAsJsonObject("context")));
19339    Type occurrence = parseType("occurrence", json);
19340    if (occurrence != null)
19341      res.setOccurrence(occurrence);
19342    if (json.has("condition"))
19343      res.setCondition(parseReference(json.getAsJsonObject("condition")));
19344    if (json.has("performer"))
19345      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
19346    if (json.has("reasonCode")) {
19347      JsonArray array = json.getAsJsonArray("reasonCode");
19348      for (int i = 0; i < array.size(); i++) {
19349        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19350      }
19351    };
19352    if (json.has("reasonReference")) {
19353      JsonArray array = json.getAsJsonArray("reasonReference");
19354      for (int i = 0; i < array.size(); i++) {
19355        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
19356      }
19357    };
19358    if (json.has("basis")) {
19359      JsonArray array = json.getAsJsonArray("basis");
19360      for (int i = 0; i < array.size(); i++) {
19361        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
19362      }
19363    };
19364    if (json.has("prediction")) {
19365      JsonArray array = json.getAsJsonArray("prediction");
19366      for (int i = 0; i < array.size(); i++) {
19367        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
19368      }
19369    };
19370    if (json.has("mitigation"))
19371      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
19372    if (json.has("_mitigation"))
19373      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
19374    if (json.has("note")) {
19375      JsonArray array = json.getAsJsonArray("note");
19376      for (int i = 0; i < array.size(); i++) {
19377        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19378      }
19379    };
19380  }
19381
19382  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
19383    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
19384    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
19385    return res;
19386  }
19387
19388  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
19389    parseBackboneElementProperties(json, res);
19390    if (json.has("outcome"))
19391      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
19392    Type probability = parseType("probability", json);
19393    if (probability != null)
19394      res.setProbability(probability);
19395    if (json.has("qualitativeRisk"))
19396      res.setQualitativeRisk(parseCodeableConcept(json.getAsJsonObject("qualitativeRisk")));
19397    if (json.has("relativeRisk"))
19398      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
19399    if (json.has("_relativeRisk"))
19400      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
19401    Type when = parseType("when", json);
19402    if (when != null)
19403      res.setWhen(when);
19404    if (json.has("rationale"))
19405      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
19406    if (json.has("_rationale"))
19407      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
19408  }
19409
19410  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
19411    Schedule res = new Schedule();
19412    parseScheduleProperties(json, res);
19413    return res;
19414  }
19415
19416  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
19417    parseDomainResourceProperties(json, res);
19418    if (json.has("identifier")) {
19419      JsonArray array = json.getAsJsonArray("identifier");
19420      for (int i = 0; i < array.size(); i++) {
19421        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19422      }
19423    };
19424    if (json.has("active"))
19425      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19426    if (json.has("_active"))
19427      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
19428    if (json.has("serviceCategory")) {
19429      JsonArray array = json.getAsJsonArray("serviceCategory");
19430      for (int i = 0; i < array.size(); i++) {
19431        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19432      }
19433    };
19434    if (json.has("serviceType")) {
19435      JsonArray array = json.getAsJsonArray("serviceType");
19436      for (int i = 0; i < array.size(); i++) {
19437        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19438      }
19439    };
19440    if (json.has("specialty")) {
19441      JsonArray array = json.getAsJsonArray("specialty");
19442      for (int i = 0; i < array.size(); i++) {
19443        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19444      }
19445    };
19446    if (json.has("actor")) {
19447      JsonArray array = json.getAsJsonArray("actor");
19448      for (int i = 0; i < array.size(); i++) {
19449        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
19450      }
19451    };
19452    if (json.has("planningHorizon"))
19453      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
19454    if (json.has("comment"))
19455      res.setCommentElement(parseString(json.get("comment").getAsString()));
19456    if (json.has("_comment"))
19457      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
19458  }
19459
19460  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
19461    SearchParameter res = new SearchParameter();
19462    parseSearchParameterProperties(json, res);
19463    return res;
19464  }
19465
19466  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
19467    parseDomainResourceProperties(json, res);
19468    if (json.has("url"))
19469      res.setUrlElement(parseUri(json.get("url").getAsString()));
19470    if (json.has("_url"))
19471      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19472    if (json.has("version"))
19473      res.setVersionElement(parseString(json.get("version").getAsString()));
19474    if (json.has("_version"))
19475      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19476    if (json.has("name"))
19477      res.setNameElement(parseString(json.get("name").getAsString()));
19478    if (json.has("_name"))
19479      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19480    if (json.has("derivedFrom"))
19481      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
19482    if (json.has("_derivedFrom"))
19483      parseElementProperties(json.getAsJsonObject("_derivedFrom"), res.getDerivedFromElement());
19484    if (json.has("status"))
19485      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19486    if (json.has("_status"))
19487      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19488    if (json.has("experimental"))
19489      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19490    if (json.has("_experimental"))
19491      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
19492    if (json.has("date"))
19493      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19494    if (json.has("_date"))
19495      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19496    if (json.has("publisher"))
19497      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19498    if (json.has("_publisher"))
19499      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
19500    if (json.has("contact")) {
19501      JsonArray array = json.getAsJsonArray("contact");
19502      for (int i = 0; i < array.size(); i++) {
19503        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19504      }
19505    };
19506    if (json.has("description"))
19507      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19508    if (json.has("_description"))
19509      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19510    if (json.has("useContext")) {
19511      JsonArray array = json.getAsJsonArray("useContext");
19512      for (int i = 0; i < array.size(); i++) {
19513        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19514      }
19515    };
19516    if (json.has("jurisdiction")) {
19517      JsonArray array = json.getAsJsonArray("jurisdiction");
19518      for (int i = 0; i < array.size(); i++) {
19519        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19520      }
19521    };
19522    if (json.has("purpose"))
19523      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19524    if (json.has("_purpose"))
19525      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
19526    if (json.has("code"))
19527      res.setCodeElement(parseCode(json.get("code").getAsString()));
19528    if (json.has("_code"))
19529      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19530    if (json.has("base")) {
19531      JsonArray array = json.getAsJsonArray("base");
19532      for (int i = 0; i < array.size(); i++) {
19533        res.getBase().add(parseCode(array.get(i).getAsString()));
19534      }
19535    };
19536    if (json.has("_base")) {
19537      JsonArray array = json.getAsJsonArray("_base");
19538      for (int i = 0; i < array.size(); i++) {
19539        if (i == res.getBase().size())
19540          res.getBase().add(parseCode(null));
19541        if (array.get(i) instanceof JsonObject) 
19542          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
19543      }
19544    };
19545    if (json.has("type"))
19546      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
19547    if (json.has("_type"))
19548      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19549    if (json.has("expression"))
19550      res.setExpressionElement(parseString(json.get("expression").getAsString()));
19551    if (json.has("_expression"))
19552      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
19553    if (json.has("xpath"))
19554      res.setXpathElement(parseString(json.get("xpath").getAsString()));
19555    if (json.has("_xpath"))
19556      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
19557    if (json.has("xpathUsage"))
19558      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
19559    if (json.has("_xpathUsage"))
19560      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
19561    if (json.has("target")) {
19562      JsonArray array = json.getAsJsonArray("target");
19563      for (int i = 0; i < array.size(); i++) {
19564        res.getTarget().add(parseCode(array.get(i).getAsString()));
19565      }
19566    };
19567    if (json.has("_target")) {
19568      JsonArray array = json.getAsJsonArray("_target");
19569      for (int i = 0; i < array.size(); i++) {
19570        if (i == res.getTarget().size())
19571          res.getTarget().add(parseCode(null));
19572        if (array.get(i) instanceof JsonObject) 
19573          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
19574      }
19575    };
19576    if (json.has("multipleOr"))
19577      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
19578    if (json.has("_multipleOr"))
19579      parseElementProperties(json.getAsJsonObject("_multipleOr"), res.getMultipleOrElement());
19580    if (json.has("multipleAnd"))
19581      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
19582    if (json.has("_multipleAnd"))
19583      parseElementProperties(json.getAsJsonObject("_multipleAnd"), res.getMultipleAndElement());
19584    if (json.has("comparator")) {
19585      JsonArray array = json.getAsJsonArray("comparator");
19586      for (int i = 0; i < array.size(); i++) {
19587        res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
19588      }
19589    };
19590    if (json.has("_comparator")) {
19591      JsonArray array = json.getAsJsonArray("_comparator");
19592      for (int i = 0; i < array.size(); i++) {
19593        if (i == res.getComparator().size())
19594          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
19595        if (array.get(i) instanceof JsonObject) 
19596          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
19597      }
19598    };
19599    if (json.has("modifier")) {
19600      JsonArray array = json.getAsJsonArray("modifier");
19601      for (int i = 0; i < array.size(); i++) {
19602        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
19603      }
19604    };
19605    if (json.has("_modifier")) {
19606      JsonArray array = json.getAsJsonArray("_modifier");
19607      for (int i = 0; i < array.size(); i++) {
19608        if (i == res.getModifier().size())
19609          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
19610        if (array.get(i) instanceof JsonObject) 
19611          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
19612      }
19613    };
19614    if (json.has("chain")) {
19615      JsonArray array = json.getAsJsonArray("chain");
19616      for (int i = 0; i < array.size(); i++) {
19617        res.getChain().add(parseString(array.get(i).getAsString()));
19618      }
19619    };
19620    if (json.has("_chain")) {
19621      JsonArray array = json.getAsJsonArray("_chain");
19622      for (int i = 0; i < array.size(); i++) {
19623        if (i == res.getChain().size())
19624          res.getChain().add(parseString(null));
19625        if (array.get(i) instanceof JsonObject) 
19626          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
19627      }
19628    };
19629    if (json.has("component")) {
19630      JsonArray array = json.getAsJsonArray("component");
19631      for (int i = 0; i < array.size(); i++) {
19632        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
19633      }
19634    };
19635  }
19636
19637  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
19638    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
19639    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
19640    return res;
19641  }
19642
19643  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
19644    parseBackboneElementProperties(json, res);
19645    if (json.has("definition"))
19646      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
19647    if (json.has("_definition"))
19648      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
19649    if (json.has("expression"))
19650      res.setExpressionElement(parseString(json.get("expression").getAsString()));
19651    if (json.has("_expression"))
19652      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
19653  }
19654
19655  protected Sequence parseSequence(JsonObject json) throws IOException, FHIRFormatError {
19656    Sequence res = new Sequence();
19657    parseSequenceProperties(json, res);
19658    return res;
19659  }
19660
19661  protected void parseSequenceProperties(JsonObject json, Sequence res) throws IOException, FHIRFormatError {
19662    parseDomainResourceProperties(json, res);
19663    if (json.has("identifier")) {
19664      JsonArray array = json.getAsJsonArray("identifier");
19665      for (int i = 0; i < array.size(); i++) {
19666        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19667      }
19668    };
19669    if (json.has("type"))
19670      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.SequenceType.NULL, new Sequence.SequenceTypeEnumFactory()));
19671    if (json.has("_type"))
19672      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19673    if (json.has("coordinateSystem"))
19674      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
19675    if (json.has("_coordinateSystem"))
19676      parseElementProperties(json.getAsJsonObject("_coordinateSystem"), res.getCoordinateSystemElement());
19677    if (json.has("patient"))
19678      res.setPatient(parseReference(json.getAsJsonObject("patient")));
19679    if (json.has("specimen"))
19680      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
19681    if (json.has("device"))
19682      res.setDevice(parseReference(json.getAsJsonObject("device")));
19683    if (json.has("performer"))
19684      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
19685    if (json.has("quantity"))
19686      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
19687    if (json.has("referenceSeq"))
19688      res.setReferenceSeq(parseSequenceSequenceReferenceSeqComponent(json.getAsJsonObject("referenceSeq"), res));
19689    if (json.has("variant")) {
19690      JsonArray array = json.getAsJsonArray("variant");
19691      for (int i = 0; i < array.size(); i++) {
19692        res.getVariant().add(parseSequenceSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
19693      }
19694    };
19695    if (json.has("observedSeq"))
19696      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
19697    if (json.has("_observedSeq"))
19698      parseElementProperties(json.getAsJsonObject("_observedSeq"), res.getObservedSeqElement());
19699    if (json.has("quality")) {
19700      JsonArray array = json.getAsJsonArray("quality");
19701      for (int i = 0; i < array.size(); i++) {
19702        res.getQuality().add(parseSequenceSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
19703      }
19704    };
19705    if (json.has("readCoverage"))
19706      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
19707    if (json.has("_readCoverage"))
19708      parseElementProperties(json.getAsJsonObject("_readCoverage"), res.getReadCoverageElement());
19709    if (json.has("repository")) {
19710      JsonArray array = json.getAsJsonArray("repository");
19711      for (int i = 0; i < array.size(); i++) {
19712        res.getRepository().add(parseSequenceSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
19713      }
19714    };
19715    if (json.has("pointer")) {
19716      JsonArray array = json.getAsJsonArray("pointer");
19717      for (int i = 0; i < array.size(); i++) {
19718        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
19719      }
19720    };
19721    if (json.has("structureVariant")) {
19722      JsonArray array = json.getAsJsonArray("structureVariant");
19723      for (int i = 0; i < array.size(); i++) {
19724        res.getStructureVariant().add(parseSequenceSequenceStructureVariantComponent(array.get(i).getAsJsonObject(), res));
19725      }
19726    };
19727  }
19728
19729  protected Sequence.SequenceReferenceSeqComponent parseSequenceSequenceReferenceSeqComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
19730    Sequence.SequenceReferenceSeqComponent res = new Sequence.SequenceReferenceSeqComponent();
19731    parseSequenceSequenceReferenceSeqComponentProperties(json, owner, res);
19732    return res;
19733  }
19734
19735  protected void parseSequenceSequenceReferenceSeqComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
19736    parseBackboneElementProperties(json, res);
19737    if (json.has("chromosome"))
19738      res.setChromosome(parseCodeableConcept(json.getAsJsonObject("chromosome")));
19739    if (json.has("genomeBuild"))
19740      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
19741    if (json.has("_genomeBuild"))
19742      parseElementProperties(json.getAsJsonObject("_genomeBuild"), res.getGenomeBuildElement());
19743    if (json.has("orientation"))
19744      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(), Sequence.OrientationType.NULL, new Sequence.OrientationTypeEnumFactory()));
19745    if (json.has("_orientation"))
19746      parseElementProperties(json.getAsJsonObject("_orientation"), res.getOrientationElement());
19747    if (json.has("referenceSeqId"))
19748      res.setReferenceSeqId(parseCodeableConcept(json.getAsJsonObject("referenceSeqId")));
19749    if (json.has("referenceSeqPointer"))
19750      res.setReferenceSeqPointer(parseReference(json.getAsJsonObject("referenceSeqPointer")));
19751    if (json.has("referenceSeqString"))
19752      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
19753    if (json.has("_referenceSeqString"))
19754      parseElementProperties(json.getAsJsonObject("_referenceSeqString"), res.getReferenceSeqStringElement());
19755    if (json.has("strand"))
19756      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), Sequence.StrandType.NULL, new Sequence.StrandTypeEnumFactory()));
19757    if (json.has("_strand"))
19758      parseElementProperties(json.getAsJsonObject("_strand"), res.getStrandElement());
19759    if (json.has("windowStart"))
19760      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
19761    if (json.has("_windowStart"))
19762      parseElementProperties(json.getAsJsonObject("_windowStart"), res.getWindowStartElement());
19763    if (json.has("windowEnd"))
19764      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
19765    if (json.has("_windowEnd"))
19766      parseElementProperties(json.getAsJsonObject("_windowEnd"), res.getWindowEndElement());
19767  }
19768
19769  protected Sequence.SequenceVariantComponent parseSequenceSequenceVariantComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
19770    Sequence.SequenceVariantComponent res = new Sequence.SequenceVariantComponent();
19771    parseSequenceSequenceVariantComponentProperties(json, owner, res);
19772    return res;
19773  }
19774
19775  protected void parseSequenceSequenceVariantComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceVariantComponent res) throws IOException, FHIRFormatError {
19776    parseBackboneElementProperties(json, res);
19777    if (json.has("start"))
19778      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19779    if (json.has("_start"))
19780      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
19781    if (json.has("end"))
19782      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19783    if (json.has("_end"))
19784      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
19785    if (json.has("observedAllele"))
19786      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
19787    if (json.has("_observedAllele"))
19788      parseElementProperties(json.getAsJsonObject("_observedAllele"), res.getObservedAlleleElement());
19789    if (json.has("referenceAllele"))
19790      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
19791    if (json.has("_referenceAllele"))
19792      parseElementProperties(json.getAsJsonObject("_referenceAllele"), res.getReferenceAlleleElement());
19793    if (json.has("cigar"))
19794      res.setCigarElement(parseString(json.get("cigar").getAsString()));
19795    if (json.has("_cigar"))
19796      parseElementProperties(json.getAsJsonObject("_cigar"), res.getCigarElement());
19797    if (json.has("variantPointer"))
19798      res.setVariantPointer(parseReference(json.getAsJsonObject("variantPointer")));
19799  }
19800
19801  protected Sequence.SequenceQualityComponent parseSequenceSequenceQualityComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
19802    Sequence.SequenceQualityComponent res = new Sequence.SequenceQualityComponent();
19803    parseSequenceSequenceQualityComponentProperties(json, owner, res);
19804    return res;
19805  }
19806
19807  protected void parseSequenceSequenceQualityComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceQualityComponent res) throws IOException, FHIRFormatError {
19808    parseBackboneElementProperties(json, res);
19809    if (json.has("type"))
19810      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.QualityType.NULL, new Sequence.QualityTypeEnumFactory()));
19811    if (json.has("_type"))
19812      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19813    if (json.has("standardSequence"))
19814      res.setStandardSequence(parseCodeableConcept(json.getAsJsonObject("standardSequence")));
19815    if (json.has("start"))
19816      res.setStartElement(parseInteger(json.get("start").getAsLong()));
19817    if (json.has("_start"))
19818      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
19819    if (json.has("end"))
19820      res.setEndElement(parseInteger(json.get("end").getAsLong()));
19821    if (json.has("_end"))
19822      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
19823    if (json.has("score"))
19824      res.setScore(parseQuantity(json.getAsJsonObject("score")));
19825    if (json.has("method"))
19826      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
19827    if (json.has("truthTP"))
19828      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
19829    if (json.has("_truthTP"))
19830      parseElementProperties(json.getAsJsonObject("_truthTP"), res.getTruthTPElement());
19831    if (json.has("queryTP"))
19832      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
19833    if (json.has("_queryTP"))
19834      parseElementProperties(json.getAsJsonObject("_queryTP"), res.getQueryTPElement());
19835    if (json.has("truthFN"))
19836      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
19837    if (json.has("_truthFN"))
19838      parseElementProperties(json.getAsJsonObject("_truthFN"), res.getTruthFNElement());
19839    if (json.has("queryFP"))
19840      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
19841    if (json.has("_queryFP"))
19842      parseElementProperties(json.getAsJsonObject("_queryFP"), res.getQueryFPElement());
19843    if (json.has("gtFP"))
19844      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
19845    if (json.has("_gtFP"))
19846      parseElementProperties(json.getAsJsonObject("_gtFP"), res.getGtFPElement());
19847    if (json.has("precision"))
19848      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
19849    if (json.has("_precision"))
19850      parseElementProperties(json.getAsJsonObject("_precision"), res.getPrecisionElement());
19851    if (json.has("recall"))
19852      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
19853    if (json.has("_recall"))
19854      parseElementProperties(json.getAsJsonObject("_recall"), res.getRecallElement());
19855    if (json.has("fScore"))
19856      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
19857    if (json.has("_fScore"))
19858      parseElementProperties(json.getAsJsonObject("_fScore"), res.getFScoreElement());
19859    if (json.has("roc"))
19860      res.setRoc(parseSequenceSequenceQualityRocComponent(json.getAsJsonObject("roc"), owner));
19861  }
19862
19863  protected Sequence.SequenceQualityRocComponent parseSequenceSequenceQualityRocComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
19864    Sequence.SequenceQualityRocComponent res = new Sequence.SequenceQualityRocComponent();
19865    parseSequenceSequenceQualityRocComponentProperties(json, owner, res);
19866    return res;
19867  }
19868
19869  protected void parseSequenceSequenceQualityRocComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceQualityRocComponent res) throws IOException, FHIRFormatError {
19870    parseBackboneElementProperties(json, res);
19871    if (json.has("score")) {
19872      JsonArray array = json.getAsJsonArray("score");
19873      for (int i = 0; i < array.size(); i++) {
19874        res.getScore().add(parseInteger(array.get(i).getAsLong()));
19875      }
19876    };
19877    if (json.has("_score")) {
19878      JsonArray array = json.getAsJsonArray("_score");
19879      for (int i = 0; i < array.size(); i++) {
19880        if (i == res.getScore().size())
19881          res.getScore().add(parseInteger(null));
19882        if (array.get(i) instanceof JsonObject) 
19883          parseElementProperties(array.get(i).getAsJsonObject(), res.getScore().get(i));
19884      }
19885    };
19886    if (json.has("numTP")) {
19887      JsonArray array = json.getAsJsonArray("numTP");
19888      for (int i = 0; i < array.size(); i++) {
19889        res.getNumTP().add(parseInteger(array.get(i).getAsLong()));
19890      }
19891    };
19892    if (json.has("_numTP")) {
19893      JsonArray array = json.getAsJsonArray("_numTP");
19894      for (int i = 0; i < array.size(); i++) {
19895        if (i == res.getNumTP().size())
19896          res.getNumTP().add(parseInteger(null));
19897        if (array.get(i) instanceof JsonObject) 
19898          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumTP().get(i));
19899      }
19900    };
19901    if (json.has("numFP")) {
19902      JsonArray array = json.getAsJsonArray("numFP");
19903      for (int i = 0; i < array.size(); i++) {
19904        res.getNumFP().add(parseInteger(array.get(i).getAsLong()));
19905      }
19906    };
19907    if (json.has("_numFP")) {
19908      JsonArray array = json.getAsJsonArray("_numFP");
19909      for (int i = 0; i < array.size(); i++) {
19910        if (i == res.getNumFP().size())
19911          res.getNumFP().add(parseInteger(null));
19912        if (array.get(i) instanceof JsonObject) 
19913          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFP().get(i));
19914      }
19915    };
19916    if (json.has("numFN")) {
19917      JsonArray array = json.getAsJsonArray("numFN");
19918      for (int i = 0; i < array.size(); i++) {
19919        res.getNumFN().add(parseInteger(array.get(i).getAsLong()));
19920      }
19921    };
19922    if (json.has("_numFN")) {
19923      JsonArray array = json.getAsJsonArray("_numFN");
19924      for (int i = 0; i < array.size(); i++) {
19925        if (i == res.getNumFN().size())
19926          res.getNumFN().add(parseInteger(null));
19927        if (array.get(i) instanceof JsonObject) 
19928          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFN().get(i));
19929      }
19930    };
19931    if (json.has("precision")) {
19932      JsonArray array = json.getAsJsonArray("precision");
19933      for (int i = 0; i < array.size(); i++) {
19934        res.getPrecision().add(parseDecimal(array.get(i).getAsBigDecimal()));
19935      }
19936    };
19937    if (json.has("_precision")) {
19938      JsonArray array = json.getAsJsonArray("_precision");
19939      for (int i = 0; i < array.size(); i++) {
19940        if (i == res.getPrecision().size())
19941          res.getPrecision().add(parseDecimal(null));
19942        if (array.get(i) instanceof JsonObject) 
19943          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrecision().get(i));
19944      }
19945    };
19946    if (json.has("sensitivity")) {
19947      JsonArray array = json.getAsJsonArray("sensitivity");
19948      for (int i = 0; i < array.size(); i++) {
19949        res.getSensitivity().add(parseDecimal(array.get(i).getAsBigDecimal()));
19950      }
19951    };
19952    if (json.has("_sensitivity")) {
19953      JsonArray array = json.getAsJsonArray("_sensitivity");
19954      for (int i = 0; i < array.size(); i++) {
19955        if (i == res.getSensitivity().size())
19956          res.getSensitivity().add(parseDecimal(null));
19957        if (array.get(i) instanceof JsonObject) 
19958          parseElementProperties(array.get(i).getAsJsonObject(), res.getSensitivity().get(i));
19959      }
19960    };
19961    if (json.has("fMeasure")) {
19962      JsonArray array = json.getAsJsonArray("fMeasure");
19963      for (int i = 0; i < array.size(); i++) {
19964        res.getFMeasure().add(parseDecimal(array.get(i).getAsBigDecimal()));
19965      }
19966    };
19967    if (json.has("_fMeasure")) {
19968      JsonArray array = json.getAsJsonArray("_fMeasure");
19969      for (int i = 0; i < array.size(); i++) {
19970        if (i == res.getFMeasure().size())
19971          res.getFMeasure().add(parseDecimal(null));
19972        if (array.get(i) instanceof JsonObject) 
19973          parseElementProperties(array.get(i).getAsJsonObject(), res.getFMeasure().get(i));
19974      }
19975    };
19976  }
19977
19978  protected Sequence.SequenceRepositoryComponent parseSequenceSequenceRepositoryComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
19979    Sequence.SequenceRepositoryComponent res = new Sequence.SequenceRepositoryComponent();
19980    parseSequenceSequenceRepositoryComponentProperties(json, owner, res);
19981    return res;
19982  }
19983
19984  protected void parseSequenceSequenceRepositoryComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceRepositoryComponent res) throws IOException, FHIRFormatError {
19985    parseBackboneElementProperties(json, res);
19986    if (json.has("type"))
19987      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.RepositoryType.NULL, new Sequence.RepositoryTypeEnumFactory()));
19988    if (json.has("_type"))
19989      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19990    if (json.has("url"))
19991      res.setUrlElement(parseUri(json.get("url").getAsString()));
19992    if (json.has("_url"))
19993      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19994    if (json.has("name"))
19995      res.setNameElement(parseString(json.get("name").getAsString()));
19996    if (json.has("_name"))
19997      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19998    if (json.has("datasetId"))
19999      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
20000    if (json.has("_datasetId"))
20001      parseElementProperties(json.getAsJsonObject("_datasetId"), res.getDatasetIdElement());
20002    if (json.has("variantsetId"))
20003      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
20004    if (json.has("_variantsetId"))
20005      parseElementProperties(json.getAsJsonObject("_variantsetId"), res.getVariantsetIdElement());
20006    if (json.has("readsetId"))
20007      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
20008    if (json.has("_readsetId"))
20009      parseElementProperties(json.getAsJsonObject("_readsetId"), res.getReadsetIdElement());
20010  }
20011
20012  protected Sequence.SequenceStructureVariantComponent parseSequenceSequenceStructureVariantComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
20013    Sequence.SequenceStructureVariantComponent res = new Sequence.SequenceStructureVariantComponent();
20014    parseSequenceSequenceStructureVariantComponentProperties(json, owner, res);
20015    return res;
20016  }
20017
20018  protected void parseSequenceSequenceStructureVariantComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceStructureVariantComponent res) throws IOException, FHIRFormatError {
20019    parseBackboneElementProperties(json, res);
20020    if (json.has("precision"))
20021      res.setPrecisionElement(parseString(json.get("precision").getAsString()));
20022    if (json.has("_precision"))
20023      parseElementProperties(json.getAsJsonObject("_precision"), res.getPrecisionElement());
20024    if (json.has("reportedaCGHRatio"))
20025      res.setReportedaCGHRatioElement(parseDecimal(json.get("reportedaCGHRatio").getAsBigDecimal()));
20026    if (json.has("_reportedaCGHRatio"))
20027      parseElementProperties(json.getAsJsonObject("_reportedaCGHRatio"), res.getReportedaCGHRatioElement());
20028    if (json.has("length"))
20029      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
20030    if (json.has("_length"))
20031      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
20032    if (json.has("outer"))
20033      res.setOuter(parseSequenceSequenceStructureVariantOuterComponent(json.getAsJsonObject("outer"), owner));
20034    if (json.has("inner"))
20035      res.setInner(parseSequenceSequenceStructureVariantInnerComponent(json.getAsJsonObject("inner"), owner));
20036  }
20037
20038  protected Sequence.SequenceStructureVariantOuterComponent parseSequenceSequenceStructureVariantOuterComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
20039    Sequence.SequenceStructureVariantOuterComponent res = new Sequence.SequenceStructureVariantOuterComponent();
20040    parseSequenceSequenceStructureVariantOuterComponentProperties(json, owner, res);
20041    return res;
20042  }
20043
20044  protected void parseSequenceSequenceStructureVariantOuterComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceStructureVariantOuterComponent res) throws IOException, FHIRFormatError {
20045    parseBackboneElementProperties(json, res);
20046    if (json.has("start"))
20047      res.setStartElement(parseInteger(json.get("start").getAsLong()));
20048    if (json.has("_start"))
20049      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
20050    if (json.has("end"))
20051      res.setEndElement(parseInteger(json.get("end").getAsLong()));
20052    if (json.has("_end"))
20053      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
20054  }
20055
20056  protected Sequence.SequenceStructureVariantInnerComponent parseSequenceSequenceStructureVariantInnerComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
20057    Sequence.SequenceStructureVariantInnerComponent res = new Sequence.SequenceStructureVariantInnerComponent();
20058    parseSequenceSequenceStructureVariantInnerComponentProperties(json, owner, res);
20059    return res;
20060  }
20061
20062  protected void parseSequenceSequenceStructureVariantInnerComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceStructureVariantInnerComponent res) throws IOException, FHIRFormatError {
20063    parseBackboneElementProperties(json, res);
20064    if (json.has("start"))
20065      res.setStartElement(parseInteger(json.get("start").getAsLong()));
20066    if (json.has("_start"))
20067      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
20068    if (json.has("end"))
20069      res.setEndElement(parseInteger(json.get("end").getAsLong()));
20070    if (json.has("_end"))
20071      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
20072  }
20073
20074  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
20075    ServiceRequest res = new ServiceRequest();
20076    parseServiceRequestProperties(json, res);
20077    return res;
20078  }
20079
20080  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res) throws IOException, FHIRFormatError {
20081    parseDomainResourceProperties(json, res);
20082    if (json.has("identifier")) {
20083      JsonArray array = json.getAsJsonArray("identifier");
20084      for (int i = 0; i < array.size(); i++) {
20085        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20086      }
20087    };
20088    if (json.has("instantiates")) {
20089      JsonArray array = json.getAsJsonArray("instantiates");
20090      for (int i = 0; i < array.size(); i++) {
20091        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
20092      }
20093    };
20094    if (json.has("_instantiates")) {
20095      JsonArray array = json.getAsJsonArray("_instantiates");
20096      for (int i = 0; i < array.size(); i++) {
20097        if (i == res.getInstantiates().size())
20098          res.getInstantiates().add(parseUri(null));
20099        if (array.get(i) instanceof JsonObject) 
20100          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
20101      }
20102    };
20103    if (json.has("basedOn")) {
20104      JsonArray array = json.getAsJsonArray("basedOn");
20105      for (int i = 0; i < array.size(); i++) {
20106        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
20107      }
20108    };
20109    if (json.has("replaces")) {
20110      JsonArray array = json.getAsJsonArray("replaces");
20111      for (int i = 0; i < array.size(); i++) {
20112        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
20113      }
20114    };
20115    if (json.has("requisition"))
20116      res.setRequisition(parseIdentifier(json.getAsJsonObject("requisition")));
20117    if (json.has("status"))
20118      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ServiceRequest.ServiceRequestStatus.NULL, new ServiceRequest.ServiceRequestStatusEnumFactory()));
20119    if (json.has("_status"))
20120      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20121    if (json.has("intent"))
20122      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ServiceRequest.ServiceRequestIntent.NULL, new ServiceRequest.ServiceRequestIntentEnumFactory()));
20123    if (json.has("_intent"))
20124      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
20125    if (json.has("category")) {
20126      JsonArray array = json.getAsJsonArray("category");
20127      for (int i = 0; i < array.size(); i++) {
20128        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20129      }
20130    };
20131    if (json.has("priority"))
20132      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ServiceRequest.ServiceRequestPriority.NULL, new ServiceRequest.ServiceRequestPriorityEnumFactory()));
20133    if (json.has("_priority"))
20134      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
20135    if (json.has("doNotPerform"))
20136      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
20137    if (json.has("_doNotPerform"))
20138      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
20139    if (json.has("code"))
20140      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20141    if (json.has("orderDetail")) {
20142      JsonArray array = json.getAsJsonArray("orderDetail");
20143      for (int i = 0; i < array.size(); i++) {
20144        res.getOrderDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20145      }
20146    };
20147    if (json.has("subject"))
20148      res.setSubject(parseReference(json.getAsJsonObject("subject")));
20149    if (json.has("context"))
20150      res.setContext(parseReference(json.getAsJsonObject("context")));
20151    Type occurrence = parseType("occurrence", json);
20152    if (occurrence != null)
20153      res.setOccurrence(occurrence);
20154    Type asNeeded = parseType("asNeeded", json);
20155    if (asNeeded != null)
20156      res.setAsNeeded(asNeeded);
20157    if (json.has("authoredOn"))
20158      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
20159    if (json.has("_authoredOn"))
20160      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
20161    if (json.has("requester"))
20162      res.setRequester(parseReference(json.getAsJsonObject("requester")));
20163    if (json.has("performerType"))
20164      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
20165    if (json.has("performer")) {
20166      JsonArray array = json.getAsJsonArray("performer");
20167      for (int i = 0; i < array.size(); i++) {
20168        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
20169      }
20170    };
20171    if (json.has("reasonCode")) {
20172      JsonArray array = json.getAsJsonArray("reasonCode");
20173      for (int i = 0; i < array.size(); i++) {
20174        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20175      }
20176    };
20177    if (json.has("reasonReference")) {
20178      JsonArray array = json.getAsJsonArray("reasonReference");
20179      for (int i = 0; i < array.size(); i++) {
20180        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
20181      }
20182    };
20183    if (json.has("insurance")) {
20184      JsonArray array = json.getAsJsonArray("insurance");
20185      for (int i = 0; i < array.size(); i++) {
20186        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
20187      }
20188    };
20189    if (json.has("supportingInfo")) {
20190      JsonArray array = json.getAsJsonArray("supportingInfo");
20191      for (int i = 0; i < array.size(); i++) {
20192        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
20193      }
20194    };
20195    if (json.has("specimen")) {
20196      JsonArray array = json.getAsJsonArray("specimen");
20197      for (int i = 0; i < array.size(); i++) {
20198        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
20199      }
20200    };
20201    if (json.has("bodySite")) {
20202      JsonArray array = json.getAsJsonArray("bodySite");
20203      for (int i = 0; i < array.size(); i++) {
20204        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20205      }
20206    };
20207    if (json.has("note")) {
20208      JsonArray array = json.getAsJsonArray("note");
20209      for (int i = 0; i < array.size(); i++) {
20210        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20211      }
20212    };
20213    if (json.has("patientInstruction"))
20214      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
20215    if (json.has("_patientInstruction"))
20216      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
20217    if (json.has("relevantHistory")) {
20218      JsonArray array = json.getAsJsonArray("relevantHistory");
20219      for (int i = 0; i < array.size(); i++) {
20220        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
20221      }
20222    };
20223  }
20224
20225  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
20226    Slot res = new Slot();
20227    parseSlotProperties(json, res);
20228    return res;
20229  }
20230
20231  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
20232    parseDomainResourceProperties(json, res);
20233    if (json.has("identifier")) {
20234      JsonArray array = json.getAsJsonArray("identifier");
20235      for (int i = 0; i < array.size(); i++) {
20236        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20237      }
20238    };
20239    if (json.has("serviceCategory")) {
20240      JsonArray array = json.getAsJsonArray("serviceCategory");
20241      for (int i = 0; i < array.size(); i++) {
20242        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20243      }
20244    };
20245    if (json.has("serviceType")) {
20246      JsonArray array = json.getAsJsonArray("serviceType");
20247      for (int i = 0; i < array.size(); i++) {
20248        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20249      }
20250    };
20251    if (json.has("specialty")) {
20252      JsonArray array = json.getAsJsonArray("specialty");
20253      for (int i = 0; i < array.size(); i++) {
20254        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20255      }
20256    };
20257    if (json.has("appointmentType"))
20258      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
20259    if (json.has("schedule"))
20260      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
20261    if (json.has("status"))
20262      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
20263    if (json.has("_status"))
20264      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20265    if (json.has("start"))
20266      res.setStartElement(parseInstant(json.get("start").getAsString()));
20267    if (json.has("_start"))
20268      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
20269    if (json.has("end"))
20270      res.setEndElement(parseInstant(json.get("end").getAsString()));
20271    if (json.has("_end"))
20272      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
20273    if (json.has("overbooked"))
20274      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
20275    if (json.has("_overbooked"))
20276      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
20277    if (json.has("comment"))
20278      res.setCommentElement(parseString(json.get("comment").getAsString()));
20279    if (json.has("_comment"))
20280      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
20281  }
20282
20283  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
20284    Specimen res = new Specimen();
20285    parseSpecimenProperties(json, res);
20286    return res;
20287  }
20288
20289  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
20290    parseDomainResourceProperties(json, res);
20291    if (json.has("identifier")) {
20292      JsonArray array = json.getAsJsonArray("identifier");
20293      for (int i = 0; i < array.size(); i++) {
20294        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20295      }
20296    };
20297    if (json.has("accessionIdentifier"))
20298      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
20299    if (json.has("status"))
20300      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
20301    if (json.has("_status"))
20302      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20303    if (json.has("type"))
20304      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20305    if (json.has("subject"))
20306      res.setSubject(parseReference(json.getAsJsonObject("subject")));
20307    if (json.has("receivedTime"))
20308      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
20309    if (json.has("_receivedTime"))
20310      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
20311    if (json.has("parent")) {
20312      JsonArray array = json.getAsJsonArray("parent");
20313      for (int i = 0; i < array.size(); i++) {
20314        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
20315      }
20316    };
20317    if (json.has("request")) {
20318      JsonArray array = json.getAsJsonArray("request");
20319      for (int i = 0; i < array.size(); i++) {
20320        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
20321      }
20322    };
20323    if (json.has("collection"))
20324      res.setCollection(parseSpecimenSpecimenCollectionComponent(json.getAsJsonObject("collection"), res));
20325    if (json.has("processing")) {
20326      JsonArray array = json.getAsJsonArray("processing");
20327      for (int i = 0; i < array.size(); i++) {
20328        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
20329      }
20330    };
20331    if (json.has("container")) {
20332      JsonArray array = json.getAsJsonArray("container");
20333      for (int i = 0; i < array.size(); i++) {
20334        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
20335      }
20336    };
20337    if (json.has("note")) {
20338      JsonArray array = json.getAsJsonArray("note");
20339      for (int i = 0; i < array.size(); i++) {
20340        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20341      }
20342    };
20343  }
20344
20345  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
20346    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
20347    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
20348    return res;
20349  }
20350
20351  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
20352    parseBackboneElementProperties(json, res);
20353    if (json.has("collector"))
20354      res.setCollector(parseReference(json.getAsJsonObject("collector")));
20355    Type collected = parseType("collected", json);
20356    if (collected != null)
20357      res.setCollected(collected);
20358    if (json.has("quantity"))
20359      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
20360    if (json.has("method"))
20361      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
20362    if (json.has("bodySite"))
20363      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
20364  }
20365
20366  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
20367    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
20368    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
20369    return res;
20370  }
20371
20372  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
20373    parseBackboneElementProperties(json, res);
20374    if (json.has("description"))
20375      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20376    if (json.has("_description"))
20377      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20378    if (json.has("procedure"))
20379      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
20380    if (json.has("additive")) {
20381      JsonArray array = json.getAsJsonArray("additive");
20382      for (int i = 0; i < array.size(); i++) {
20383        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
20384      }
20385    };
20386    Type time = parseType("time", json);
20387    if (time != null)
20388      res.setTime(time);
20389  }
20390
20391  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
20392    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
20393    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
20394    return res;
20395  }
20396
20397  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
20398    parseBackboneElementProperties(json, res);
20399    if (json.has("identifier")) {
20400      JsonArray array = json.getAsJsonArray("identifier");
20401      for (int i = 0; i < array.size(); i++) {
20402        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20403      }
20404    };
20405    if (json.has("description"))
20406      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20407    if (json.has("_description"))
20408      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20409    if (json.has("type"))
20410      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20411    if (json.has("capacity"))
20412      res.setCapacity(parseSimpleQuantity(json.getAsJsonObject("capacity")));
20413    if (json.has("specimenQuantity"))
20414      res.setSpecimenQuantity(parseSimpleQuantity(json.getAsJsonObject("specimenQuantity")));
20415    Type additive = parseType("additive", json);
20416    if (additive != null)
20417      res.setAdditive(additive);
20418  }
20419
20420  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
20421    SpecimenDefinition res = new SpecimenDefinition();
20422    parseSpecimenDefinitionProperties(json, res);
20423    return res;
20424  }
20425
20426  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res) throws IOException, FHIRFormatError {
20427    parseDomainResourceProperties(json, res);
20428    if (json.has("identifier"))
20429      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
20430    if (json.has("typeCollected"))
20431      res.setTypeCollected(parseCodeableConcept(json.getAsJsonObject("typeCollected")));
20432    if (json.has("patientPreparation"))
20433      res.setPatientPreparationElement(parseString(json.get("patientPreparation").getAsString()));
20434    if (json.has("_patientPreparation"))
20435      parseElementProperties(json.getAsJsonObject("_patientPreparation"), res.getPatientPreparationElement());
20436    if (json.has("timeAspect"))
20437      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
20438    if (json.has("_timeAspect"))
20439      parseElementProperties(json.getAsJsonObject("_timeAspect"), res.getTimeAspectElement());
20440    if (json.has("collection")) {
20441      JsonArray array = json.getAsJsonArray("collection");
20442      for (int i = 0; i < array.size(); i++) {
20443        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20444      }
20445    };
20446    if (json.has("specimenToLab")) {
20447      JsonArray array = json.getAsJsonArray("specimenToLab");
20448      for (int i = 0; i < array.size(); i++) {
20449        res.getSpecimenToLab().add(parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabComponent(array.get(i).getAsJsonObject(), res));
20450      }
20451    };
20452  }
20453
20454  protected SpecimenDefinition.SpecimenDefinitionSpecimenToLabComponent parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
20455    SpecimenDefinition.SpecimenDefinitionSpecimenToLabComponent res = new SpecimenDefinition.SpecimenDefinitionSpecimenToLabComponent();
20456    parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabComponentProperties(json, owner, res);
20457    return res;
20458  }
20459
20460  protected void parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionSpecimenToLabComponent res) throws IOException, FHIRFormatError {
20461    parseBackboneElementProperties(json, res);
20462    if (json.has("isDerived"))
20463      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
20464    if (json.has("_isDerived"))
20465      parseElementProperties(json.getAsJsonObject("_isDerived"), res.getIsDerivedElement());
20466    if (json.has("type"))
20467      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20468    if (json.has("preference"))
20469      res.setPreferenceElement(parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL, new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
20470    if (json.has("_preference"))
20471      parseElementProperties(json.getAsJsonObject("_preference"), res.getPreferenceElement());
20472    if (json.has("containerMaterial"))
20473      res.setContainerMaterial(parseCodeableConcept(json.getAsJsonObject("containerMaterial")));
20474    if (json.has("containerType"))
20475      res.setContainerType(parseCodeableConcept(json.getAsJsonObject("containerType")));
20476    if (json.has("containerCap"))
20477      res.setContainerCap(parseCodeableConcept(json.getAsJsonObject("containerCap")));
20478    if (json.has("containerDescription"))
20479      res.setContainerDescriptionElement(parseString(json.get("containerDescription").getAsString()));
20480    if (json.has("_containerDescription"))
20481      parseElementProperties(json.getAsJsonObject("_containerDescription"), res.getContainerDescriptionElement());
20482    if (json.has("containerCapacity"))
20483      res.setContainerCapacity(parseSimpleQuantity(json.getAsJsonObject("containerCapacity")));
20484    if (json.has("containerMinimumVolume"))
20485      res.setContainerMinimumVolume(parseSimpleQuantity(json.getAsJsonObject("containerMinimumVolume")));
20486    if (json.has("containerAdditive")) {
20487      JsonArray array = json.getAsJsonArray("containerAdditive");
20488      for (int i = 0; i < array.size(); i++) {
20489        res.getContainerAdditive().add(parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabContainerAdditiveComponent(array.get(i).getAsJsonObject(), owner));
20490      }
20491    };
20492    if (json.has("containerPreparation"))
20493      res.setContainerPreparationElement(parseString(json.get("containerPreparation").getAsString()));
20494    if (json.has("_containerPreparation"))
20495      parseElementProperties(json.getAsJsonObject("_containerPreparation"), res.getContainerPreparationElement());
20496    if (json.has("requirement"))
20497      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
20498    if (json.has("_requirement"))
20499      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
20500    if (json.has("retentionTime"))
20501      res.setRetentionTime(parseDuration(json.getAsJsonObject("retentionTime")));
20502    if (json.has("rejectionCriterion")) {
20503      JsonArray array = json.getAsJsonArray("rejectionCriterion");
20504      for (int i = 0; i < array.size(); i++) {
20505        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20506      }
20507    };
20508    if (json.has("handling")) {
20509      JsonArray array = json.getAsJsonArray("handling");
20510      for (int i = 0; i < array.size(); i++) {
20511        res.getHandling().add(parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabHandlingComponent(array.get(i).getAsJsonObject(), owner));
20512      }
20513    };
20514  }
20515
20516  protected SpecimenDefinition.SpecimenDefinitionSpecimenToLabContainerAdditiveComponent parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabContainerAdditiveComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
20517    SpecimenDefinition.SpecimenDefinitionSpecimenToLabContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionSpecimenToLabContainerAdditiveComponent();
20518    parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabContainerAdditiveComponentProperties(json, owner, res);
20519    return res;
20520  }
20521
20522  protected void parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabContainerAdditiveComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionSpecimenToLabContainerAdditiveComponent res) throws IOException, FHIRFormatError {
20523    parseBackboneElementProperties(json, res);
20524    Type additive = parseType("additive", json);
20525    if (additive != null)
20526      res.setAdditive(additive);
20527  }
20528
20529  protected SpecimenDefinition.SpecimenDefinitionSpecimenToLabHandlingComponent parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabHandlingComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
20530    SpecimenDefinition.SpecimenDefinitionSpecimenToLabHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionSpecimenToLabHandlingComponent();
20531    parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabHandlingComponentProperties(json, owner, res);
20532    return res;
20533  }
20534
20535  protected void parseSpecimenDefinitionSpecimenDefinitionSpecimenToLabHandlingComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionSpecimenToLabHandlingComponent res) throws IOException, FHIRFormatError {
20536    parseBackboneElementProperties(json, res);
20537    if (json.has("conditionSet"))
20538      res.setConditionSet(parseCodeableConcept(json.getAsJsonObject("conditionSet")));
20539    if (json.has("tempRange"))
20540      res.setTempRange(parseRange(json.getAsJsonObject("tempRange")));
20541    if (json.has("maxDuration"))
20542      res.setMaxDuration(parseDuration(json.getAsJsonObject("maxDuration")));
20543    if (json.has("lightExposure"))
20544      res.setLightExposureElement(parseString(json.get("lightExposure").getAsString()));
20545    if (json.has("_lightExposure"))
20546      parseElementProperties(json.getAsJsonObject("_lightExposure"), res.getLightExposureElement());
20547    if (json.has("instruction"))
20548      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
20549    if (json.has("_instruction"))
20550      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
20551  }
20552
20553  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
20554    StructureDefinition res = new StructureDefinition();
20555    parseStructureDefinitionProperties(json, res);
20556    return res;
20557  }
20558
20559  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
20560    parseDomainResourceProperties(json, res);
20561    if (json.has("url"))
20562      res.setUrlElement(parseUri(json.get("url").getAsString()));
20563    if (json.has("_url"))
20564      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
20565    if (json.has("identifier")) {
20566      JsonArray array = json.getAsJsonArray("identifier");
20567      for (int i = 0; i < array.size(); i++) {
20568        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20569      }
20570    };
20571    if (json.has("version"))
20572      res.setVersionElement(parseString(json.get("version").getAsString()));
20573    if (json.has("_version"))
20574      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
20575    if (json.has("name"))
20576      res.setNameElement(parseString(json.get("name").getAsString()));
20577    if (json.has("_name"))
20578      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20579    if (json.has("title"))
20580      res.setTitleElement(parseString(json.get("title").getAsString()));
20581    if (json.has("_title"))
20582      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20583    if (json.has("status"))
20584      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20585    if (json.has("_status"))
20586      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20587    if (json.has("experimental"))
20588      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20589    if (json.has("_experimental"))
20590      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
20591    if (json.has("date"))
20592      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20593    if (json.has("_date"))
20594      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
20595    if (json.has("publisher"))
20596      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20597    if (json.has("_publisher"))
20598      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
20599    if (json.has("contact")) {
20600      JsonArray array = json.getAsJsonArray("contact");
20601      for (int i = 0; i < array.size(); i++) {
20602        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20603      }
20604    };
20605    if (json.has("description"))
20606      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20607    if (json.has("_description"))
20608      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20609    if (json.has("useContext")) {
20610      JsonArray array = json.getAsJsonArray("useContext");
20611      for (int i = 0; i < array.size(); i++) {
20612        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20613      }
20614    };
20615    if (json.has("jurisdiction")) {
20616      JsonArray array = json.getAsJsonArray("jurisdiction");
20617      for (int i = 0; i < array.size(); i++) {
20618        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20619      }
20620    };
20621    if (json.has("purpose"))
20622      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20623    if (json.has("_purpose"))
20624      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
20625    if (json.has("copyright"))
20626      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20627    if (json.has("_copyright"))
20628      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
20629    if (json.has("keyword")) {
20630      JsonArray array = json.getAsJsonArray("keyword");
20631      for (int i = 0; i < array.size(); i++) {
20632        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
20633      }
20634    };
20635    if (json.has("fhirVersion"))
20636      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
20637    if (json.has("_fhirVersion"))
20638      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
20639    if (json.has("mapping")) {
20640      JsonArray array = json.getAsJsonArray("mapping");
20641      for (int i = 0; i < array.size(); i++) {
20642        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
20643      }
20644    };
20645    if (json.has("kind"))
20646      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
20647    if (json.has("_kind"))
20648      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
20649    if (json.has("abstract"))
20650      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
20651    if (json.has("_abstract"))
20652      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
20653    if (json.has("context")) {
20654      JsonArray array = json.getAsJsonArray("context");
20655      for (int i = 0; i < array.size(); i++) {
20656        res.getContext().add(parseStructureDefinitionStructureDefinitionContextComponent(array.get(i).getAsJsonObject(), res));
20657      }
20658    };
20659    if (json.has("contextInvariant")) {
20660      JsonArray array = json.getAsJsonArray("contextInvariant");
20661      for (int i = 0; i < array.size(); i++) {
20662        res.getContextInvariant().add(parseString(array.get(i).getAsString()));
20663      }
20664    };
20665    if (json.has("_contextInvariant")) {
20666      JsonArray array = json.getAsJsonArray("_contextInvariant");
20667      for (int i = 0; i < array.size(); i++) {
20668        if (i == res.getContextInvariant().size())
20669          res.getContextInvariant().add(parseString(null));
20670        if (array.get(i) instanceof JsonObject) 
20671          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
20672      }
20673    };
20674    if (json.has("type"))
20675      res.setTypeElement(parseUri(json.get("type").getAsString()));
20676    if (json.has("_type"))
20677      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20678    if (json.has("baseDefinition"))
20679      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
20680    if (json.has("_baseDefinition"))
20681      parseElementProperties(json.getAsJsonObject("_baseDefinition"), res.getBaseDefinitionElement());
20682    if (json.has("derivation"))
20683      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
20684    if (json.has("_derivation"))
20685      parseElementProperties(json.getAsJsonObject("_derivation"), res.getDerivationElement());
20686    if (json.has("snapshot"))
20687      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot"), res));
20688    if (json.has("differential"))
20689      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential"), res));
20690  }
20691
20692  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
20693    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
20694    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
20695    return res;
20696  }
20697
20698  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
20699    parseBackboneElementProperties(json, res);
20700    if (json.has("identity"))
20701      res.setIdentityElement(parseId(json.get("identity").getAsString()));
20702    if (json.has("_identity"))
20703      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
20704    if (json.has("uri"))
20705      res.setUriElement(parseUri(json.get("uri").getAsString()));
20706    if (json.has("_uri"))
20707      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
20708    if (json.has("name"))
20709      res.setNameElement(parseString(json.get("name").getAsString()));
20710    if (json.has("_name"))
20711      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20712    if (json.has("comment"))
20713      res.setCommentElement(parseString(json.get("comment").getAsString()));
20714    if (json.has("_comment"))
20715      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
20716  }
20717
20718  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionStructureDefinitionContextComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
20719    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
20720    parseStructureDefinitionStructureDefinitionContextComponentProperties(json, owner, res);
20721    return res;
20722  }
20723
20724  protected void parseStructureDefinitionStructureDefinitionContextComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionContextComponent res) throws IOException, FHIRFormatError {
20725    parseBackboneElementProperties(json, res);
20726    if (json.has("type"))
20727      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL, new StructureDefinition.ExtensionContextTypeEnumFactory()));
20728    if (json.has("_type"))
20729      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20730    if (json.has("expression"))
20731      res.setExpressionElement(parseString(json.get("expression").getAsString()));
20732    if (json.has("_expression"))
20733      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
20734  }
20735
20736  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
20737    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
20738    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
20739    return res;
20740  }
20741
20742  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
20743    parseBackboneElementProperties(json, res);
20744    if (json.has("element")) {
20745      JsonArray array = json.getAsJsonArray("element");
20746      for (int i = 0; i < array.size(); i++) {
20747        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
20748      }
20749    };
20750  }
20751
20752  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
20753    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
20754    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
20755    return res;
20756  }
20757
20758  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
20759    parseBackboneElementProperties(json, res);
20760    if (json.has("element")) {
20761      JsonArray array = json.getAsJsonArray("element");
20762      for (int i = 0; i < array.size(); i++) {
20763        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
20764      }
20765    };
20766  }
20767
20768  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
20769    StructureMap res = new StructureMap();
20770    parseStructureMapProperties(json, res);
20771    return res;
20772  }
20773
20774  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
20775    parseDomainResourceProperties(json, res);
20776    if (json.has("url"))
20777      res.setUrlElement(parseUri(json.get("url").getAsString()));
20778    if (json.has("_url"))
20779      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
20780    if (json.has("identifier")) {
20781      JsonArray array = json.getAsJsonArray("identifier");
20782      for (int i = 0; i < array.size(); i++) {
20783        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20784      }
20785    };
20786    if (json.has("version"))
20787      res.setVersionElement(parseString(json.get("version").getAsString()));
20788    if (json.has("_version"))
20789      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
20790    if (json.has("name"))
20791      res.setNameElement(parseString(json.get("name").getAsString()));
20792    if (json.has("_name"))
20793      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20794    if (json.has("title"))
20795      res.setTitleElement(parseString(json.get("title").getAsString()));
20796    if (json.has("_title"))
20797      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20798    if (json.has("status"))
20799      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20800    if (json.has("_status"))
20801      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20802    if (json.has("experimental"))
20803      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20804    if (json.has("_experimental"))
20805      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
20806    if (json.has("date"))
20807      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20808    if (json.has("_date"))
20809      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
20810    if (json.has("publisher"))
20811      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20812    if (json.has("_publisher"))
20813      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
20814    if (json.has("contact")) {
20815      JsonArray array = json.getAsJsonArray("contact");
20816      for (int i = 0; i < array.size(); i++) {
20817        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20818      }
20819    };
20820    if (json.has("description"))
20821      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20822    if (json.has("_description"))
20823      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20824    if (json.has("useContext")) {
20825      JsonArray array = json.getAsJsonArray("useContext");
20826      for (int i = 0; i < array.size(); i++) {
20827        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20828      }
20829    };
20830    if (json.has("jurisdiction")) {
20831      JsonArray array = json.getAsJsonArray("jurisdiction");
20832      for (int i = 0; i < array.size(); i++) {
20833        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20834      }
20835    };
20836    if (json.has("purpose"))
20837      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20838    if (json.has("_purpose"))
20839      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
20840    if (json.has("copyright"))
20841      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20842    if (json.has("_copyright"))
20843      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
20844    if (json.has("structure")) {
20845      JsonArray array = json.getAsJsonArray("structure");
20846      for (int i = 0; i < array.size(); i++) {
20847        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
20848      }
20849    };
20850    if (json.has("import")) {
20851      JsonArray array = json.getAsJsonArray("import");
20852      for (int i = 0; i < array.size(); i++) {
20853        res.getImport().add(parseCanonical(array.get(i).getAsString()));
20854      }
20855    };
20856    if (json.has("_import")) {
20857      JsonArray array = json.getAsJsonArray("_import");
20858      for (int i = 0; i < array.size(); i++) {
20859        if (i == res.getImport().size())
20860          res.getImport().add(parseCanonical(null));
20861        if (array.get(i) instanceof JsonObject) 
20862          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
20863      }
20864    };
20865    if (json.has("group")) {
20866      JsonArray array = json.getAsJsonArray("group");
20867      for (int i = 0; i < array.size(); i++) {
20868        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
20869      }
20870    };
20871  }
20872
20873  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
20874    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
20875    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
20876    return res;
20877  }
20878
20879  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
20880    parseBackboneElementProperties(json, res);
20881    if (json.has("url"))
20882      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
20883    if (json.has("_url"))
20884      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
20885    if (json.has("mode"))
20886      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
20887    if (json.has("_mode"))
20888      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
20889    if (json.has("alias"))
20890      res.setAliasElement(parseString(json.get("alias").getAsString()));
20891    if (json.has("_alias"))
20892      parseElementProperties(json.getAsJsonObject("_alias"), res.getAliasElement());
20893    if (json.has("documentation"))
20894      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
20895    if (json.has("_documentation"))
20896      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
20897  }
20898
20899  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
20900    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
20901    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
20902    return res;
20903  }
20904
20905  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
20906    parseBackboneElementProperties(json, res);
20907    if (json.has("name"))
20908      res.setNameElement(parseId(json.get("name").getAsString()));
20909    if (json.has("_name"))
20910      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20911    if (json.has("extends"))
20912      res.setExtendsElement(parseId(json.get("extends").getAsString()));
20913    if (json.has("_extends"))
20914      parseElementProperties(json.getAsJsonObject("_extends"), res.getExtendsElement());
20915    if (json.has("typeMode"))
20916      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
20917    if (json.has("_typeMode"))
20918      parseElementProperties(json.getAsJsonObject("_typeMode"), res.getTypeModeElement());
20919    if (json.has("documentation"))
20920      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
20921    if (json.has("_documentation"))
20922      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
20923    if (json.has("input")) {
20924      JsonArray array = json.getAsJsonArray("input");
20925      for (int i = 0; i < array.size(); i++) {
20926        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
20927      }
20928    };
20929    if (json.has("rule")) {
20930      JsonArray array = json.getAsJsonArray("rule");
20931      for (int i = 0; i < array.size(); i++) {
20932        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
20933      }
20934    };
20935  }
20936
20937  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
20938    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
20939    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
20940    return res;
20941  }
20942
20943  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
20944    parseBackboneElementProperties(json, res);
20945    if (json.has("name"))
20946      res.setNameElement(parseId(json.get("name").getAsString()));
20947    if (json.has("_name"))
20948      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20949    if (json.has("type"))
20950      res.setTypeElement(parseString(json.get("type").getAsString()));
20951    if (json.has("_type"))
20952      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20953    if (json.has("mode"))
20954      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
20955    if (json.has("_mode"))
20956      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
20957    if (json.has("documentation"))
20958      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
20959    if (json.has("_documentation"))
20960      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
20961  }
20962
20963  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
20964    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
20965    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
20966    return res;
20967  }
20968
20969  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
20970    parseBackboneElementProperties(json, res);
20971    if (json.has("name"))
20972      res.setNameElement(parseId(json.get("name").getAsString()));
20973    if (json.has("_name"))
20974      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20975    if (json.has("source")) {
20976      JsonArray array = json.getAsJsonArray("source");
20977      for (int i = 0; i < array.size(); i++) {
20978        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
20979      }
20980    };
20981    if (json.has("target")) {
20982      JsonArray array = json.getAsJsonArray("target");
20983      for (int i = 0; i < array.size(); i++) {
20984        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
20985      }
20986    };
20987    if (json.has("rule")) {
20988      JsonArray array = json.getAsJsonArray("rule");
20989      for (int i = 0; i < array.size(); i++) {
20990        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
20991      }
20992    };
20993    if (json.has("dependent")) {
20994      JsonArray array = json.getAsJsonArray("dependent");
20995      for (int i = 0; i < array.size(); i++) {
20996        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
20997      }
20998    };
20999    if (json.has("documentation"))
21000      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
21001    if (json.has("_documentation"))
21002      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
21003  }
21004
21005  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
21006    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
21007    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
21008    return res;
21009  }
21010
21011  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
21012    parseBackboneElementProperties(json, res);
21013    if (json.has("context"))
21014      res.setContextElement(parseId(json.get("context").getAsString()));
21015    if (json.has("_context"))
21016      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
21017    if (json.has("min"))
21018      res.setMinElement(parseInteger(json.get("min").getAsLong()));
21019    if (json.has("_min"))
21020      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
21021    if (json.has("max"))
21022      res.setMaxElement(parseString(json.get("max").getAsString()));
21023    if (json.has("_max"))
21024      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
21025    if (json.has("type"))
21026      res.setTypeElement(parseString(json.get("type").getAsString()));
21027    if (json.has("_type"))
21028      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21029    Type defaultValue = parseType("defaultValue", json);
21030    if (defaultValue != null)
21031      res.setDefaultValue(defaultValue);
21032    if (json.has("element"))
21033      res.setElementElement(parseString(json.get("element").getAsString()));
21034    if (json.has("_element"))
21035      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
21036    if (json.has("listMode"))
21037      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
21038    if (json.has("_listMode"))
21039      parseElementProperties(json.getAsJsonObject("_listMode"), res.getListModeElement());
21040    if (json.has("variable"))
21041      res.setVariableElement(parseId(json.get("variable").getAsString()));
21042    if (json.has("_variable"))
21043      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
21044    if (json.has("condition"))
21045      res.setConditionElement(parseString(json.get("condition").getAsString()));
21046    if (json.has("_condition"))
21047      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
21048    if (json.has("check"))
21049      res.setCheckElement(parseString(json.get("check").getAsString()));
21050    if (json.has("_check"))
21051      parseElementProperties(json.getAsJsonObject("_check"), res.getCheckElement());
21052  }
21053
21054  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
21055    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
21056    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
21057    return res;
21058  }
21059
21060  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
21061    parseBackboneElementProperties(json, res);
21062    if (json.has("context"))
21063      res.setContextElement(parseId(json.get("context").getAsString()));
21064    if (json.has("_context"))
21065      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
21066    if (json.has("contextType"))
21067      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
21068    if (json.has("_contextType"))
21069      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
21070    if (json.has("element"))
21071      res.setElementElement(parseString(json.get("element").getAsString()));
21072    if (json.has("_element"))
21073      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
21074    if (json.has("variable"))
21075      res.setVariableElement(parseId(json.get("variable").getAsString()));
21076    if (json.has("_variable"))
21077      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
21078    if (json.has("listMode")) {
21079      JsonArray array = json.getAsJsonArray("listMode");
21080      for (int i = 0; i < array.size(); i++) {
21081        res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
21082      }
21083    };
21084    if (json.has("_listMode")) {
21085      JsonArray array = json.getAsJsonArray("_listMode");
21086      for (int i = 0; i < array.size(); i++) {
21087        if (i == res.getListMode().size())
21088          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
21089        if (array.get(i) instanceof JsonObject) 
21090          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
21091      }
21092    };
21093    if (json.has("listRuleId"))
21094      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
21095    if (json.has("_listRuleId"))
21096      parseElementProperties(json.getAsJsonObject("_listRuleId"), res.getListRuleIdElement());
21097    if (json.has("transform"))
21098      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
21099    if (json.has("_transform"))
21100      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
21101    if (json.has("parameter")) {
21102      JsonArray array = json.getAsJsonArray("parameter");
21103      for (int i = 0; i < array.size(); i++) {
21104        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
21105      }
21106    };
21107  }
21108
21109  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
21110    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
21111    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
21112    return res;
21113  }
21114
21115  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
21116    parseBackboneElementProperties(json, res);
21117    Type value = parseType("value", json);
21118    if (value != null)
21119      res.setValue(value);
21120  }
21121
21122  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
21123    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
21124    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
21125    return res;
21126  }
21127
21128  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
21129    parseBackboneElementProperties(json, res);
21130    if (json.has("name"))
21131      res.setNameElement(parseId(json.get("name").getAsString()));
21132    if (json.has("_name"))
21133      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21134    if (json.has("variable")) {
21135      JsonArray array = json.getAsJsonArray("variable");
21136      for (int i = 0; i < array.size(); i++) {
21137        res.getVariable().add(parseString(array.get(i).getAsString()));
21138      }
21139    };
21140    if (json.has("_variable")) {
21141      JsonArray array = json.getAsJsonArray("_variable");
21142      for (int i = 0; i < array.size(); i++) {
21143        if (i == res.getVariable().size())
21144          res.getVariable().add(parseString(null));
21145        if (array.get(i) instanceof JsonObject) 
21146          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
21147      }
21148    };
21149  }
21150
21151  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
21152    Subscription res = new Subscription();
21153    parseSubscriptionProperties(json, res);
21154    return res;
21155  }
21156
21157  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
21158    parseDomainResourceProperties(json, res);
21159    if (json.has("status"))
21160      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
21161    if (json.has("_status"))
21162      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21163    if (json.has("contact")) {
21164      JsonArray array = json.getAsJsonArray("contact");
21165      for (int i = 0; i < array.size(); i++) {
21166        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
21167      }
21168    };
21169    if (json.has("end"))
21170      res.setEndElement(parseInstant(json.get("end").getAsString()));
21171    if (json.has("_end"))
21172      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
21173    if (json.has("reason"))
21174      res.setReasonElement(parseString(json.get("reason").getAsString()));
21175    if (json.has("_reason"))
21176      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
21177    if (json.has("criteria"))
21178      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
21179    if (json.has("_criteria"))
21180      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
21181    if (json.has("error"))
21182      res.setErrorElement(parseString(json.get("error").getAsString()));
21183    if (json.has("_error"))
21184      parseElementProperties(json.getAsJsonObject("_error"), res.getErrorElement());
21185    if (json.has("channel"))
21186      res.setChannel(parseSubscriptionSubscriptionChannelComponent(json.getAsJsonObject("channel"), res));
21187    if (json.has("tag")) {
21188      JsonArray array = json.getAsJsonArray("tag");
21189      for (int i = 0; i < array.size(); i++) {
21190        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
21191      }
21192    };
21193  }
21194
21195  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
21196    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
21197    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
21198    return res;
21199  }
21200
21201  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
21202    parseBackboneElementProperties(json, res);
21203    if (json.has("type"))
21204      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
21205    if (json.has("_type"))
21206      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21207    if (json.has("endpoint"))
21208      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
21209    if (json.has("_endpoint"))
21210      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
21211    if (json.has("payload"))
21212      res.setPayloadElement(parseString(json.get("payload").getAsString()));
21213    if (json.has("_payload"))
21214      parseElementProperties(json.getAsJsonObject("_payload"), res.getPayloadElement());
21215    if (json.has("header")) {
21216      JsonArray array = json.getAsJsonArray("header");
21217      for (int i = 0; i < array.size(); i++) {
21218        res.getHeader().add(parseString(array.get(i).getAsString()));
21219      }
21220    };
21221    if (json.has("_header")) {
21222      JsonArray array = json.getAsJsonArray("_header");
21223      for (int i = 0; i < array.size(); i++) {
21224        if (i == res.getHeader().size())
21225          res.getHeader().add(parseString(null));
21226        if (array.get(i) instanceof JsonObject) 
21227          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
21228      }
21229    };
21230  }
21231
21232  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
21233    Substance res = new Substance();
21234    parseSubstanceProperties(json, res);
21235    return res;
21236  }
21237
21238  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
21239    parseDomainResourceProperties(json, res);
21240    if (json.has("identifier")) {
21241      JsonArray array = json.getAsJsonArray("identifier");
21242      for (int i = 0; i < array.size(); i++) {
21243        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21244      }
21245    };
21246    if (json.has("status"))
21247      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
21248    if (json.has("_status"))
21249      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21250    if (json.has("category")) {
21251      JsonArray array = json.getAsJsonArray("category");
21252      for (int i = 0; i < array.size(); i++) {
21253        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21254      }
21255    };
21256    if (json.has("code"))
21257      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
21258    if (json.has("description"))
21259      res.setDescriptionElement(parseString(json.get("description").getAsString()));
21260    if (json.has("_description"))
21261      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21262    if (json.has("instance")) {
21263      JsonArray array = json.getAsJsonArray("instance");
21264      for (int i = 0; i < array.size(); i++) {
21265        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
21266      }
21267    };
21268    if (json.has("ingredient")) {
21269      JsonArray array = json.getAsJsonArray("ingredient");
21270      for (int i = 0; i < array.size(); i++) {
21271        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
21272      }
21273    };
21274  }
21275
21276  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
21277    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
21278    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
21279    return res;
21280  }
21281
21282  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
21283    parseBackboneElementProperties(json, res);
21284    if (json.has("identifier"))
21285      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
21286    if (json.has("expiry"))
21287      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
21288    if (json.has("_expiry"))
21289      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
21290    if (json.has("quantity"))
21291      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
21292  }
21293
21294  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
21295    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
21296    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
21297    return res;
21298  }
21299
21300  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
21301    parseBackboneElementProperties(json, res);
21302    if (json.has("quantity"))
21303      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
21304    Type substance = parseType("substance", json);
21305    if (substance != null)
21306      res.setSubstance(substance);
21307  }
21308
21309  protected SubstancePolymer parseSubstancePolymer(JsonObject json) throws IOException, FHIRFormatError {
21310    SubstancePolymer res = new SubstancePolymer();
21311    parseSubstancePolymerProperties(json, res);
21312    return res;
21313  }
21314
21315  protected void parseSubstancePolymerProperties(JsonObject json, SubstancePolymer res) throws IOException, FHIRFormatError {
21316    parseDomainResourceProperties(json, res);
21317    if (json.has("class"))
21318      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
21319    if (json.has("geometry"))
21320      res.setGeometry(parseCodeableConcept(json.getAsJsonObject("geometry")));
21321    if (json.has("copolymerConnectivity")) {
21322      JsonArray array = json.getAsJsonArray("copolymerConnectivity");
21323      for (int i = 0; i < array.size(); i++) {
21324        res.getCopolymerConnectivity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21325      }
21326    };
21327    if (json.has("modification")) {
21328      JsonArray array = json.getAsJsonArray("modification");
21329      for (int i = 0; i < array.size(); i++) {
21330        res.getModification().add(parseString(array.get(i).getAsString()));
21331      }
21332    };
21333    if (json.has("_modification")) {
21334      JsonArray array = json.getAsJsonArray("_modification");
21335      for (int i = 0; i < array.size(); i++) {
21336        if (i == res.getModification().size())
21337          res.getModification().add(parseString(null));
21338        if (array.get(i) instanceof JsonObject) 
21339          parseElementProperties(array.get(i).getAsJsonObject(), res.getModification().get(i));
21340      }
21341    };
21342    if (json.has("monomerSet")) {
21343      JsonArray array = json.getAsJsonArray("monomerSet");
21344      for (int i = 0; i < array.size(); i++) {
21345        res.getMonomerSet().add(parseSubstancePolymerSubstancePolymerMonomerSetComponent(array.get(i).getAsJsonObject(), res));
21346      }
21347    };
21348    if (json.has("repeat")) {
21349      JsonArray array = json.getAsJsonArray("repeat");
21350      for (int i = 0; i < array.size(); i++) {
21351        res.getRepeat().add(parseSubstancePolymerSubstancePolymerRepeatComponent(array.get(i).getAsJsonObject(), res));
21352      }
21353    };
21354  }
21355
21356  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerSubstancePolymerMonomerSetComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
21357    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
21358    parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(json, owner, res);
21359    return res;
21360  }
21361
21362  protected void parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetComponent res) throws IOException, FHIRFormatError {
21363    parseBackboneElementProperties(json, res);
21364    if (json.has("ratioType"))
21365      res.setRatioType(parseCodeableConcept(json.getAsJsonObject("ratioType")));
21366    if (json.has("startingMaterial")) {
21367      JsonArray array = json.getAsJsonArray("startingMaterial");
21368      for (int i = 0; i < array.size(); i++) {
21369        res.getStartingMaterial().add(parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(array.get(i).getAsJsonObject(), owner));
21370      }
21371    };
21372  }
21373
21374  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
21375    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
21376    parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(json, owner, res);
21377    return res;
21378  }
21379
21380  protected void parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res) throws IOException, FHIRFormatError {
21381    parseBackboneElementProperties(json, res);
21382    if (json.has("material"))
21383      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
21384    if (json.has("type"))
21385      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21386    if (json.has("isDefining"))
21387      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
21388    if (json.has("_isDefining"))
21389      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
21390    if (json.has("amount"))
21391      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
21392  }
21393
21394  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerSubstancePolymerRepeatComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
21395    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
21396    parseSubstancePolymerSubstancePolymerRepeatComponentProperties(json, owner, res);
21397    return res;
21398  }
21399
21400  protected void parseSubstancePolymerSubstancePolymerRepeatComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatComponent res) throws IOException, FHIRFormatError {
21401    parseBackboneElementProperties(json, res);
21402    if (json.has("numberOfUnits"))
21403      res.setNumberOfUnitsElement(parseInteger(json.get("numberOfUnits").getAsLong()));
21404    if (json.has("_numberOfUnits"))
21405      parseElementProperties(json.getAsJsonObject("_numberOfUnits"), res.getNumberOfUnitsElement());
21406    if (json.has("averageMolecularFormula"))
21407      res.setAverageMolecularFormulaElement(parseString(json.get("averageMolecularFormula").getAsString()));
21408    if (json.has("_averageMolecularFormula"))
21409      parseElementProperties(json.getAsJsonObject("_averageMolecularFormula"), res.getAverageMolecularFormulaElement());
21410    if (json.has("repeatUnitAmountType"))
21411      res.setRepeatUnitAmountType(parseCodeableConcept(json.getAsJsonObject("repeatUnitAmountType")));
21412    if (json.has("repeatUnit")) {
21413      JsonArray array = json.getAsJsonArray("repeatUnit");
21414      for (int i = 0; i < array.size(); i++) {
21415        res.getRepeatUnit().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(array.get(i).getAsJsonObject(), owner));
21416      }
21417    };
21418  }
21419
21420  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
21421    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
21422    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(json, owner, res);
21423    return res;
21424  }
21425
21426  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res) throws IOException, FHIRFormatError {
21427    parseBackboneElementProperties(json, res);
21428    if (json.has("orientationOfPolymerisation"))
21429      res.setOrientationOfPolymerisation(parseCodeableConcept(json.getAsJsonObject("orientationOfPolymerisation")));
21430    if (json.has("repeatUnit"))
21431      res.setRepeatUnitElement(parseString(json.get("repeatUnit").getAsString()));
21432    if (json.has("_repeatUnit"))
21433      parseElementProperties(json.getAsJsonObject("_repeatUnit"), res.getRepeatUnitElement());
21434    if (json.has("amount"))
21435      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
21436    if (json.has("degreeOfPolymerisation")) {
21437      JsonArray array = json.getAsJsonArray("degreeOfPolymerisation");
21438      for (int i = 0; i < array.size(); i++) {
21439        res.getDegreeOfPolymerisation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(array.get(i).getAsJsonObject(), owner));
21440      }
21441    };
21442    if (json.has("structuralRepresentation")) {
21443      JsonArray array = json.getAsJsonArray("structuralRepresentation");
21444      for (int i = 0; i < array.size(); i++) {
21445        res.getStructuralRepresentation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(array.get(i).getAsJsonObject(), owner));
21446      }
21447    };
21448  }
21449
21450  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
21451    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
21452    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(json, owner, res);
21453    return res;
21454  }
21455
21456  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res) throws IOException, FHIRFormatError {
21457    parseBackboneElementProperties(json, res);
21458    if (json.has("degree"))
21459      res.setDegree(parseCodeableConcept(json.getAsJsonObject("degree")));
21460    if (json.has("amount"))
21461      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
21462  }
21463
21464  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
21465    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
21466    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(json, owner, res);
21467    return res;
21468  }
21469
21470  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
21471    parseBackboneElementProperties(json, res);
21472    if (json.has("type"))
21473      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21474    if (json.has("representation"))
21475      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
21476    if (json.has("_representation"))
21477      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
21478    if (json.has("attachment"))
21479      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
21480  }
21481
21482  protected SubstanceReferenceInformation parseSubstanceReferenceInformation(JsonObject json) throws IOException, FHIRFormatError {
21483    SubstanceReferenceInformation res = new SubstanceReferenceInformation();
21484    parseSubstanceReferenceInformationProperties(json, res);
21485    return res;
21486  }
21487
21488  protected void parseSubstanceReferenceInformationProperties(JsonObject json, SubstanceReferenceInformation res) throws IOException, FHIRFormatError {
21489    parseDomainResourceProperties(json, res);
21490    if (json.has("comment"))
21491      res.setCommentElement(parseString(json.get("comment").getAsString()));
21492    if (json.has("_comment"))
21493      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
21494    if (json.has("gene")) {
21495      JsonArray array = json.getAsJsonArray("gene");
21496      for (int i = 0; i < array.size(); i++) {
21497        res.getGene().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(array.get(i).getAsJsonObject(), res));
21498      }
21499    };
21500    if (json.has("geneElement")) {
21501      JsonArray array = json.getAsJsonArray("geneElement");
21502      for (int i = 0; i < array.size(); i++) {
21503        res.getGeneElement().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(array.get(i).getAsJsonObject(), res));
21504      }
21505    };
21506    if (json.has("classification")) {
21507      JsonArray array = json.getAsJsonArray("classification");
21508      for (int i = 0; i < array.size(); i++) {
21509        res.getClassification().add(parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(array.get(i).getAsJsonObject(), res));
21510      }
21511    };
21512    if (json.has("relationship")) {
21513      JsonArray array = json.getAsJsonArray("relationship");
21514      for (int i = 0; i < array.size(); i++) {
21515        res.getRelationship().add(parseSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponent(array.get(i).getAsJsonObject(), res));
21516      }
21517    };
21518    if (json.has("target")) {
21519      JsonArray array = json.getAsJsonArray("target");
21520      for (int i = 0; i < array.size(); i++) {
21521        res.getTarget().add(parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(array.get(i).getAsJsonObject(), res));
21522      }
21523    };
21524  }
21525
21526  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
21527    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
21528    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(json, owner, res);
21529    return res;
21530  }
21531
21532  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res) throws IOException, FHIRFormatError {
21533    parseBackboneElementProperties(json, res);
21534    if (json.has("geneSequenceOrigin"))
21535      res.setGeneSequenceOrigin(parseCodeableConcept(json.getAsJsonObject("geneSequenceOrigin")));
21536    if (json.has("gene"))
21537      res.setGene(parseCodeableConcept(json.getAsJsonObject("gene")));
21538    if (json.has("source")) {
21539      JsonArray array = json.getAsJsonArray("source");
21540      for (int i = 0; i < array.size(); i++) {
21541        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
21542      }
21543    };
21544  }
21545
21546  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
21547    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
21548    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(json, owner, res);
21549    return res;
21550  }
21551
21552  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res) throws IOException, FHIRFormatError {
21553    parseBackboneElementProperties(json, res);
21554    if (json.has("type"))
21555      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21556    if (json.has("element"))
21557      res.setElement(parseIdentifier(json.getAsJsonObject("element")));
21558    if (json.has("source")) {
21559      JsonArray array = json.getAsJsonArray("source");
21560      for (int i = 0; i < array.size(); i++) {
21561        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
21562      }
21563    };
21564  }
21565
21566  protected SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
21567    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
21568    parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(json, owner, res);
21569    return res;
21570  }
21571
21572  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res) throws IOException, FHIRFormatError {
21573    parseBackboneElementProperties(json, res);
21574    if (json.has("domain"))
21575      res.setDomain(parseCodeableConcept(json.getAsJsonObject("domain")));
21576    if (json.has("classification"))
21577      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
21578    if (json.has("subtype")) {
21579      JsonArray array = json.getAsJsonArray("subtype");
21580      for (int i = 0; i < array.size(); i++) {
21581        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21582      }
21583    };
21584    if (json.has("source")) {
21585      JsonArray array = json.getAsJsonArray("source");
21586      for (int i = 0; i < array.size(); i++) {
21587        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
21588      }
21589    };
21590  }
21591
21592  protected SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent parseSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
21593    SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent();
21594    parseSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponentProperties(json, owner, res);
21595    return res;
21596  }
21597
21598  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent res) throws IOException, FHIRFormatError {
21599    parseBackboneElementProperties(json, res);
21600    Type substance = parseType("substance", json);
21601    if (substance != null)
21602      res.setSubstance(substance);
21603    if (json.has("relationship"))
21604      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
21605    if (json.has("interaction"))
21606      res.setInteraction(parseCodeableConcept(json.getAsJsonObject("interaction")));
21607    if (json.has("isDefining"))
21608      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
21609    if (json.has("_isDefining"))
21610      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
21611    Type amount = parseType("amount", json);
21612    if (amount != null)
21613      res.setAmount(amount);
21614    if (json.has("amountType"))
21615      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
21616    if (json.has("amountText"))
21617      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
21618    if (json.has("_amountText"))
21619      parseElementProperties(json.getAsJsonObject("_amountText"), res.getAmountTextElement());
21620    if (json.has("source")) {
21621      JsonArray array = json.getAsJsonArray("source");
21622      for (int i = 0; i < array.size(); i++) {
21623        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
21624      }
21625    };
21626  }
21627
21628  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
21629    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
21630    parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(json, owner, res);
21631    return res;
21632  }
21633
21634  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res) throws IOException, FHIRFormatError {
21635    parseBackboneElementProperties(json, res);
21636    if (json.has("target"))
21637      res.setTarget(parseIdentifier(json.getAsJsonObject("target")));
21638    if (json.has("type"))
21639      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21640    if (json.has("interaction"))
21641      res.setInteraction(parseCodeableConcept(json.getAsJsonObject("interaction")));
21642    if (json.has("organism"))
21643      res.setOrganism(parseCodeableConcept(json.getAsJsonObject("organism")));
21644    if (json.has("organismType"))
21645      res.setOrganismType(parseCodeableConcept(json.getAsJsonObject("organismType")));
21646    if (json.has("source")) {
21647      JsonArray array = json.getAsJsonArray("source");
21648      for (int i = 0; i < array.size(); i++) {
21649        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
21650      }
21651    };
21652    Type amount = parseType("amount", json);
21653    if (amount != null)
21654      res.setAmount(amount);
21655    if (json.has("amountType"))
21656      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
21657  }
21658
21659  protected SubstanceSpecification parseSubstanceSpecification(JsonObject json) throws IOException, FHIRFormatError {
21660    SubstanceSpecification res = new SubstanceSpecification();
21661    parseSubstanceSpecificationProperties(json, res);
21662    return res;
21663  }
21664
21665  protected void parseSubstanceSpecificationProperties(JsonObject json, SubstanceSpecification res) throws IOException, FHIRFormatError {
21666    parseDomainResourceProperties(json, res);
21667    if (json.has("comment"))
21668      res.setCommentElement(parseString(json.get("comment").getAsString()));
21669    if (json.has("_comment"))
21670      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
21671    if (json.has("stoichiometric"))
21672      res.setStoichiometricElement(parseBoolean(json.get("stoichiometric").getAsBoolean()));
21673    if (json.has("_stoichiometric"))
21674      parseElementProperties(json.getAsJsonObject("_stoichiometric"), res.getStoichiometricElement());
21675    if (json.has("identifier"))
21676      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
21677    if (json.has("type"))
21678      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21679    if (json.has("referenceSource")) {
21680      JsonArray array = json.getAsJsonArray("referenceSource");
21681      for (int i = 0; i < array.size(); i++) {
21682        res.getReferenceSource().add(parseString(array.get(i).getAsString()));
21683      }
21684    };
21685    if (json.has("_referenceSource")) {
21686      JsonArray array = json.getAsJsonArray("_referenceSource");
21687      for (int i = 0; i < array.size(); i++) {
21688        if (i == res.getReferenceSource().size())
21689          res.getReferenceSource().add(parseString(null));
21690        if (array.get(i) instanceof JsonObject) 
21691          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferenceSource().get(i));
21692      }
21693    };
21694    if (json.has("moiety")) {
21695      JsonArray array = json.getAsJsonArray("moiety");
21696      for (int i = 0; i < array.size(); i++) {
21697        res.getMoiety().add(parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(array.get(i).getAsJsonObject(), res));
21698      }
21699    };
21700    if (json.has("property")) {
21701      JsonArray array = json.getAsJsonArray("property");
21702      for (int i = 0; i < array.size(); i++) {
21703        res.getProperty().add(parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(array.get(i).getAsJsonObject(), res));
21704      }
21705    };
21706    if (json.has("referenceInformation"))
21707      res.setReferenceInformation(parseReference(json.getAsJsonObject("referenceInformation")));
21708    if (json.has("structure"))
21709      res.setStructure(parseSubstanceSpecificationSubstanceSpecificationStructureComponent(json.getAsJsonObject("structure"), res));
21710    if (json.has("substanceCode")) {
21711      JsonArray array = json.getAsJsonArray("substanceCode");
21712      for (int i = 0; i < array.size(); i++) {
21713        res.getSubstanceCode().add(parseSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponent(array.get(i).getAsJsonObject(), res));
21714      }
21715    };
21716    if (json.has("substanceName")) {
21717      JsonArray array = json.getAsJsonArray("substanceName");
21718      for (int i = 0; i < array.size(); i++) {
21719        res.getSubstanceName().add(parseSubstanceSpecificationSubstanceSpecificationSubstanceNameComponent(array.get(i).getAsJsonObject(), res));
21720      }
21721    };
21722    if (json.has("molecularWeight")) {
21723      JsonArray array = json.getAsJsonArray("molecularWeight");
21724      for (int i = 0; i < array.size(); i++) {
21725        res.getMolecularWeight().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(array.get(i).getAsJsonObject(), res));
21726      }
21727    };
21728    if (json.has("polymer"))
21729      res.setPolymer(parseReference(json.getAsJsonObject("polymer")));
21730  }
21731
21732  protected SubstanceSpecification.SubstanceSpecificationMoietyComponent parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
21733    SubstanceSpecification.SubstanceSpecificationMoietyComponent res = new SubstanceSpecification.SubstanceSpecificationMoietyComponent();
21734    parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(json, owner, res);
21735    return res;
21736  }
21737
21738  protected void parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationMoietyComponent res) throws IOException, FHIRFormatError {
21739    parseBackboneElementProperties(json, res);
21740    if (json.has("role"))
21741      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
21742    if (json.has("identifier"))
21743      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
21744    if (json.has("name"))
21745      res.setNameElement(parseString(json.get("name").getAsString()));
21746    if (json.has("_name"))
21747      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21748    if (json.has("stereochemistry"))
21749      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
21750    if (json.has("opticalActivity"))
21751      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
21752    if (json.has("molecularFormula"))
21753      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
21754    if (json.has("_molecularFormula"))
21755      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
21756    if (json.has("amount"))
21757      res.setAmountElement(parseString(json.get("amount").getAsString()));
21758    if (json.has("_amount"))
21759      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
21760  }
21761
21762  protected SubstanceSpecification.SubstanceSpecificationPropertyComponent parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
21763    SubstanceSpecification.SubstanceSpecificationPropertyComponent res = new SubstanceSpecification.SubstanceSpecificationPropertyComponent();
21764    parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(json, owner, res);
21765    return res;
21766  }
21767
21768  protected void parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationPropertyComponent res) throws IOException, FHIRFormatError {
21769    parseBackboneElementProperties(json, res);
21770    if (json.has("type"))
21771      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21772    if (json.has("name"))
21773      res.setName(parseCodeableConcept(json.getAsJsonObject("name")));
21774    if (json.has("parameters"))
21775      res.setParametersElement(parseString(json.get("parameters").getAsString()));
21776    if (json.has("_parameters"))
21777      parseElementProperties(json.getAsJsonObject("_parameters"), res.getParametersElement());
21778    if (json.has("substanceId"))
21779      res.setSubstanceId(parseIdentifier(json.getAsJsonObject("substanceId")));
21780    if (json.has("substanceName"))
21781      res.setSubstanceNameElement(parseString(json.get("substanceName").getAsString()));
21782    if (json.has("_substanceName"))
21783      parseElementProperties(json.getAsJsonObject("_substanceName"), res.getSubstanceNameElement());
21784    if (json.has("amount"))
21785      res.setAmountElement(parseString(json.get("amount").getAsString()));
21786    if (json.has("_amount"))
21787      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
21788  }
21789
21790  protected SubstanceSpecification.SubstanceSpecificationStructureComponent parseSubstanceSpecificationSubstanceSpecificationStructureComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
21791    SubstanceSpecification.SubstanceSpecificationStructureComponent res = new SubstanceSpecification.SubstanceSpecificationStructureComponent();
21792    parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(json, owner, res);
21793    return res;
21794  }
21795
21796  protected void parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureComponent res) throws IOException, FHIRFormatError {
21797    parseBackboneElementProperties(json, res);
21798    if (json.has("stereochemistry"))
21799      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
21800    if (json.has("opticalActivity"))
21801      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
21802    if (json.has("molecularFormula"))
21803      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
21804    if (json.has("_molecularFormula"))
21805      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
21806    if (json.has("molecularFormulaByMoiety"))
21807      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
21808    if (json.has("_molecularFormulaByMoiety"))
21809      parseElementProperties(json.getAsJsonObject("_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
21810    if (json.has("isotope")) {
21811      JsonArray array = json.getAsJsonArray("isotope");
21812      for (int i = 0; i < array.size(); i++) {
21813        res.getIsotope().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(array.get(i).getAsJsonObject(), owner));
21814      }
21815    };
21816    if (json.has("molecularWeight"))
21817      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight"), owner));
21818    if (json.has("referenceSource")) {
21819      JsonArray array = json.getAsJsonArray("referenceSource");
21820      for (int i = 0; i < array.size(); i++) {
21821        res.getReferenceSource().add(parseReference(array.get(i).getAsJsonObject()));
21822      }
21823    };
21824    if (json.has("structuralRepresentation")) {
21825      JsonArray array = json.getAsJsonArray("structuralRepresentation");
21826      for (int i = 0; i < array.size(); i++) {
21827        res.getStructuralRepresentation().add(parseSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponent(array.get(i).getAsJsonObject(), owner));
21828      }
21829    };
21830  }
21831
21832  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
21833    SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent();
21834    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(json, owner, res);
21835    return res;
21836  }
21837
21838  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res) throws IOException, FHIRFormatError {
21839    parseBackboneElementProperties(json, res);
21840    if (json.has("nuclideId"))
21841      res.setNuclideId(parseIdentifier(json.getAsJsonObject("nuclideId")));
21842    if (json.has("nuclideName"))
21843      res.setNuclideName(parseCodeableConcept(json.getAsJsonObject("nuclideName")));
21844    if (json.has("substitutionType"))
21845      res.setSubstitutionType(parseCodeableConcept(json.getAsJsonObject("substitutionType")));
21846    if (json.has("nuclideHalfLife"))
21847      res.setNuclideHalfLife(parseQuantity(json.getAsJsonObject("nuclideHalfLife")));
21848    if (json.has("amount"))
21849      res.setAmountElement(parseString(json.get("amount").getAsString()));
21850    if (json.has("_amount"))
21851      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
21852    if (json.has("molecularWeight"))
21853      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight"), owner));
21854  }
21855
21856  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
21857    SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent();
21858    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(json, owner, res);
21859    return res;
21860  }
21861
21862  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res) throws IOException, FHIRFormatError {
21863    parseBackboneElementProperties(json, res);
21864    if (json.has("method"))
21865      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
21866    if (json.has("type"))
21867      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21868    if (json.has("amount"))
21869      res.setAmountElement(parseString(json.get("amount").getAsString()));
21870    if (json.has("_amount"))
21871      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
21872  }
21873
21874  protected SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent parseSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
21875    SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent res = new SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent();
21876    parseSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponentProperties(json, owner, res);
21877    return res;
21878  }
21879
21880  protected void parseSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
21881    parseBackboneElementProperties(json, res);
21882    if (json.has("type"))
21883      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21884    if (json.has("representation"))
21885      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
21886    if (json.has("_representation"))
21887      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
21888    if (json.has("attachment"))
21889      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
21890  }
21891
21892  protected SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent parseSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
21893    SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent res = new SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent();
21894    parseSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponentProperties(json, owner, res);
21895    return res;
21896  }
21897
21898  protected void parseSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent res) throws IOException, FHIRFormatError {
21899    parseBackboneElementProperties(json, res);
21900    if (json.has("code"))
21901      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
21902    if (json.has("status"))
21903      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
21904    if (json.has("statusDate"))
21905      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
21906    if (json.has("_statusDate"))
21907      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
21908    if (json.has("comment"))
21909      res.setCommentElement(parseString(json.get("comment").getAsString()));
21910    if (json.has("_comment"))
21911      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
21912    if (json.has("referenceSource")) {
21913      JsonArray array = json.getAsJsonArray("referenceSource");
21914      for (int i = 0; i < array.size(); i++) {
21915        res.getReferenceSource().add(parseString(array.get(i).getAsString()));
21916      }
21917    };
21918    if (json.has("_referenceSource")) {
21919      JsonArray array = json.getAsJsonArray("_referenceSource");
21920      for (int i = 0; i < array.size(); i++) {
21921        if (i == res.getReferenceSource().size())
21922          res.getReferenceSource().add(parseString(null));
21923        if (array.get(i) instanceof JsonObject) 
21924          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferenceSource().get(i));
21925      }
21926    };
21927  }
21928
21929  protected SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent parseSubstanceSpecificationSubstanceSpecificationSubstanceNameComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
21930    SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent res = new SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent();
21931    parseSubstanceSpecificationSubstanceSpecificationSubstanceNameComponentProperties(json, owner, res);
21932    return res;
21933  }
21934
21935  protected void parseSubstanceSpecificationSubstanceSpecificationSubstanceNameComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent res) throws IOException, FHIRFormatError {
21936    parseBackboneElementProperties(json, res);
21937    if (json.has("name"))
21938      res.setNameElement(parseString(json.get("name").getAsString()));
21939    if (json.has("_name"))
21940      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21941    if (json.has("type"))
21942      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21943    if (json.has("language")) {
21944      JsonArray array = json.getAsJsonArray("language");
21945      for (int i = 0; i < array.size(); i++) {
21946        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21947      }
21948    };
21949    if (json.has("domain")) {
21950      JsonArray array = json.getAsJsonArray("domain");
21951      for (int i = 0; i < array.size(); i++) {
21952        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21953      }
21954    };
21955    if (json.has("jurisdiction")) {
21956      JsonArray array = json.getAsJsonArray("jurisdiction");
21957      for (int i = 0; i < array.size(); i++) {
21958        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21959      }
21960    };
21961    if (json.has("officialName")) {
21962      JsonArray array = json.getAsJsonArray("officialName");
21963      for (int i = 0; i < array.size(); i++) {
21964        res.getOfficialName().add(parseSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponent(array.get(i).getAsJsonObject(), owner));
21965      }
21966    };
21967    if (json.has("referenceSource")) {
21968      JsonArray array = json.getAsJsonArray("referenceSource");
21969      for (int i = 0; i < array.size(); i++) {
21970        res.getReferenceSource().add(parseString(array.get(i).getAsString()));
21971      }
21972    };
21973    if (json.has("_referenceSource")) {
21974      JsonArray array = json.getAsJsonArray("_referenceSource");
21975      for (int i = 0; i < array.size(); i++) {
21976        if (i == res.getReferenceSource().size())
21977          res.getReferenceSource().add(parseString(null));
21978        if (array.get(i) instanceof JsonObject) 
21979          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferenceSource().get(i));
21980      }
21981    };
21982  }
21983
21984  protected SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent parseSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
21985    SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent res = new SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent();
21986    parseSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponentProperties(json, owner, res);
21987    return res;
21988  }
21989
21990  protected void parseSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent res) throws IOException, FHIRFormatError {
21991    parseBackboneElementProperties(json, res);
21992    if (json.has("authority"))
21993      res.setAuthority(parseCodeableConcept(json.getAsJsonObject("authority")));
21994    if (json.has("status"))
21995      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
21996    if (json.has("date"))
21997      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21998    if (json.has("_date"))
21999      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
22000  }
22001
22002  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
22003    SupplyDelivery res = new SupplyDelivery();
22004    parseSupplyDeliveryProperties(json, res);
22005    return res;
22006  }
22007
22008  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
22009    parseDomainResourceProperties(json, res);
22010    if (json.has("identifier")) {
22011      JsonArray array = json.getAsJsonArray("identifier");
22012      for (int i = 0; i < array.size(); i++) {
22013        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22014      }
22015    };
22016    if (json.has("basedOn")) {
22017      JsonArray array = json.getAsJsonArray("basedOn");
22018      for (int i = 0; i < array.size(); i++) {
22019        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22020      }
22021    };
22022    if (json.has("partOf")) {
22023      JsonArray array = json.getAsJsonArray("partOf");
22024      for (int i = 0; i < array.size(); i++) {
22025        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22026      }
22027    };
22028    if (json.has("status"))
22029      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
22030    if (json.has("_status"))
22031      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22032    if (json.has("patient"))
22033      res.setPatient(parseReference(json.getAsJsonObject("patient")));
22034    if (json.has("type"))
22035      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22036    if (json.has("suppliedItem"))
22037      res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(json.getAsJsonObject("suppliedItem"), res));
22038    Type occurrence = parseType("occurrence", json);
22039    if (occurrence != null)
22040      res.setOccurrence(occurrence);
22041    if (json.has("supplier"))
22042      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
22043    if (json.has("destination"))
22044      res.setDestination(parseReference(json.getAsJsonObject("destination")));
22045    if (json.has("receiver")) {
22046      JsonArray array = json.getAsJsonArray("receiver");
22047      for (int i = 0; i < array.size(); i++) {
22048        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
22049      }
22050    };
22051  }
22052
22053  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
22054    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
22055    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
22056    return res;
22057  }
22058
22059  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
22060    parseBackboneElementProperties(json, res);
22061    if (json.has("quantity"))
22062      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
22063    Type item = parseType("item", json);
22064    if (item != null)
22065      res.setItem(item);
22066  }
22067
22068  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
22069    SupplyRequest res = new SupplyRequest();
22070    parseSupplyRequestProperties(json, res);
22071    return res;
22072  }
22073
22074  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
22075    parseDomainResourceProperties(json, res);
22076    if (json.has("identifier"))
22077      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
22078    if (json.has("status"))
22079      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
22080    if (json.has("_status"))
22081      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22082    if (json.has("category"))
22083      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
22084    if (json.has("priority"))
22085      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
22086    if (json.has("_priority"))
22087      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
22088    Type item = parseType("item", json);
22089    if (item != null)
22090      res.setItem(item);
22091    if (json.has("quantity"))
22092      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
22093    if (json.has("parameter")) {
22094      JsonArray array = json.getAsJsonArray("parameter");
22095      for (int i = 0; i < array.size(); i++) {
22096        res.getParameter().add(parseSupplyRequestSupplyRequestParameterComponent(array.get(i).getAsJsonObject(), res));
22097      }
22098    };
22099    Type occurrence = parseType("occurrence", json);
22100    if (occurrence != null)
22101      res.setOccurrence(occurrence);
22102    if (json.has("authoredOn"))
22103      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
22104    if (json.has("_authoredOn"))
22105      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
22106    if (json.has("requester"))
22107      res.setRequester(parseReference(json.getAsJsonObject("requester")));
22108    if (json.has("supplier")) {
22109      JsonArray array = json.getAsJsonArray("supplier");
22110      for (int i = 0; i < array.size(); i++) {
22111        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
22112      }
22113    };
22114    if (json.has("reasonCode")) {
22115      JsonArray array = json.getAsJsonArray("reasonCode");
22116      for (int i = 0; i < array.size(); i++) {
22117        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22118      }
22119    };
22120    if (json.has("reasonReference")) {
22121      JsonArray array = json.getAsJsonArray("reasonReference");
22122      for (int i = 0; i < array.size(); i++) {
22123        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
22124      }
22125    };
22126    if (json.has("deliverFrom"))
22127      res.setDeliverFrom(parseReference(json.getAsJsonObject("deliverFrom")));
22128    if (json.has("deliverTo"))
22129      res.setDeliverTo(parseReference(json.getAsJsonObject("deliverTo")));
22130  }
22131
22132  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestSupplyRequestParameterComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
22133    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
22134    parseSupplyRequestSupplyRequestParameterComponentProperties(json, owner, res);
22135    return res;
22136  }
22137
22138  protected void parseSupplyRequestSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
22139    parseBackboneElementProperties(json, res);
22140    if (json.has("code"))
22141      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
22142    Type value = parseType("value", json);
22143    if (value != null)
22144      res.setValue(value);
22145  }
22146
22147  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
22148    Task res = new Task();
22149    parseTaskProperties(json, res);
22150    return res;
22151  }
22152
22153  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
22154    parseDomainResourceProperties(json, res);
22155    if (json.has("identifier")) {
22156      JsonArray array = json.getAsJsonArray("identifier");
22157      for (int i = 0; i < array.size(); i++) {
22158        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22159      }
22160    };
22161    Type instantiates = parseType("instantiates", json);
22162    if (instantiates != null)
22163      res.setInstantiates(instantiates);
22164    if (json.has("basedOn")) {
22165      JsonArray array = json.getAsJsonArray("basedOn");
22166      for (int i = 0; i < array.size(); i++) {
22167        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
22168      }
22169    };
22170    if (json.has("groupIdentifier"))
22171      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
22172    if (json.has("partOf")) {
22173      JsonArray array = json.getAsJsonArray("partOf");
22174      for (int i = 0; i < array.size(); i++) {
22175        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22176      }
22177    };
22178    if (json.has("status"))
22179      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
22180    if (json.has("_status"))
22181      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22182    if (json.has("statusReason"))
22183      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
22184    if (json.has("businessStatus"))
22185      res.setBusinessStatus(parseCodeableConcept(json.getAsJsonObject("businessStatus")));
22186    if (json.has("intent"))
22187      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
22188    if (json.has("_intent"))
22189      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
22190    if (json.has("priority"))
22191      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
22192    if (json.has("_priority"))
22193      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
22194    if (json.has("code"))
22195      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
22196    if (json.has("description"))
22197      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22198    if (json.has("_description"))
22199      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22200    if (json.has("focus"))
22201      res.setFocus(parseReference(json.getAsJsonObject("focus")));
22202    if (json.has("for"))
22203      res.setFor(parseReference(json.getAsJsonObject("for")));
22204    if (json.has("context"))
22205      res.setContext(parseReference(json.getAsJsonObject("context")));
22206    if (json.has("executionPeriod"))
22207      res.setExecutionPeriod(parsePeriod(json.getAsJsonObject("executionPeriod")));
22208    if (json.has("authoredOn"))
22209      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
22210    if (json.has("_authoredOn"))
22211      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
22212    if (json.has("lastModified"))
22213      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
22214    if (json.has("_lastModified"))
22215      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
22216    if (json.has("requester"))
22217      res.setRequester(parseReference(json.getAsJsonObject("requester")));
22218    if (json.has("performerType")) {
22219      JsonArray array = json.getAsJsonArray("performerType");
22220      for (int i = 0; i < array.size(); i++) {
22221        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22222      }
22223    };
22224    if (json.has("owner"))
22225      res.setOwner(parseReference(json.getAsJsonObject("owner")));
22226    if (json.has("reasonCode"))
22227      res.setReasonCode(parseCodeableConcept(json.getAsJsonObject("reasonCode")));
22228    if (json.has("reasonReference"))
22229      res.setReasonReference(parseReference(json.getAsJsonObject("reasonReference")));
22230    if (json.has("note")) {
22231      JsonArray array = json.getAsJsonArray("note");
22232      for (int i = 0; i < array.size(); i++) {
22233        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22234      }
22235    };
22236    if (json.has("relevantHistory")) {
22237      JsonArray array = json.getAsJsonArray("relevantHistory");
22238      for (int i = 0; i < array.size(); i++) {
22239        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
22240      }
22241    };
22242    if (json.has("restriction"))
22243      res.setRestriction(parseTaskTaskRestrictionComponent(json.getAsJsonObject("restriction"), res));
22244    if (json.has("input")) {
22245      JsonArray array = json.getAsJsonArray("input");
22246      for (int i = 0; i < array.size(); i++) {
22247        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
22248      }
22249    };
22250    if (json.has("output")) {
22251      JsonArray array = json.getAsJsonArray("output");
22252      for (int i = 0; i < array.size(); i++) {
22253        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
22254      }
22255    };
22256  }
22257
22258  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
22259    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
22260    parseTaskTaskRestrictionComponentProperties(json, owner, res);
22261    return res;
22262  }
22263
22264  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
22265    parseBackboneElementProperties(json, res);
22266    if (json.has("repetitions"))
22267      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
22268    if (json.has("_repetitions"))
22269      parseElementProperties(json.getAsJsonObject("_repetitions"), res.getRepetitionsElement());
22270    if (json.has("period"))
22271      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
22272    if (json.has("recipient")) {
22273      JsonArray array = json.getAsJsonArray("recipient");
22274      for (int i = 0; i < array.size(); i++) {
22275        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
22276      }
22277    };
22278  }
22279
22280  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
22281    Task.ParameterComponent res = new Task.ParameterComponent();
22282    parseTaskParameterComponentProperties(json, owner, res);
22283    return res;
22284  }
22285
22286  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res) throws IOException, FHIRFormatError {
22287    parseBackboneElementProperties(json, res);
22288    if (json.has("type"))
22289      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22290    Type value = parseType("value", json);
22291    if (value != null)
22292      res.setValue(value);
22293  }
22294
22295  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
22296    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
22297    parseTaskTaskOutputComponentProperties(json, owner, res);
22298    return res;
22299  }
22300
22301  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
22302    parseBackboneElementProperties(json, res);
22303    if (json.has("type"))
22304      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22305    Type value = parseType("value", json);
22306    if (value != null)
22307      res.setValue(value);
22308  }
22309
22310  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
22311    TerminologyCapabilities res = new TerminologyCapabilities();
22312    parseTerminologyCapabilitiesProperties(json, res);
22313    return res;
22314  }
22315
22316  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res) throws IOException, FHIRFormatError {
22317    parseDomainResourceProperties(json, res);
22318    if (json.has("url"))
22319      res.setUrlElement(parseUri(json.get("url").getAsString()));
22320    if (json.has("_url"))
22321      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
22322    if (json.has("version"))
22323      res.setVersionElement(parseString(json.get("version").getAsString()));
22324    if (json.has("_version"))
22325      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
22326    if (json.has("name"))
22327      res.setNameElement(parseString(json.get("name").getAsString()));
22328    if (json.has("_name"))
22329      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22330    if (json.has("title"))
22331      res.setTitleElement(parseString(json.get("title").getAsString()));
22332    if (json.has("_title"))
22333      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22334    if (json.has("status"))
22335      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22336    if (json.has("_status"))
22337      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22338    if (json.has("experimental"))
22339      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22340    if (json.has("_experimental"))
22341      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
22342    if (json.has("date"))
22343      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22344    if (json.has("_date"))
22345      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
22346    if (json.has("publisher"))
22347      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22348    if (json.has("_publisher"))
22349      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
22350    if (json.has("contact")) {
22351      JsonArray array = json.getAsJsonArray("contact");
22352      for (int i = 0; i < array.size(); i++) {
22353        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22354      }
22355    };
22356    if (json.has("description"))
22357      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22358    if (json.has("_description"))
22359      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22360    if (json.has("useContext")) {
22361      JsonArray array = json.getAsJsonArray("useContext");
22362      for (int i = 0; i < array.size(); i++) {
22363        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22364      }
22365    };
22366    if (json.has("jurisdiction")) {
22367      JsonArray array = json.getAsJsonArray("jurisdiction");
22368      for (int i = 0; i < array.size(); i++) {
22369        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22370      }
22371    };
22372    if (json.has("purpose"))
22373      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22374    if (json.has("_purpose"))
22375      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
22376    if (json.has("copyright"))
22377      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22378    if (json.has("_copyright"))
22379      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
22380    if (json.has("lockedDate"))
22381      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
22382    if (json.has("_lockedDate"))
22383      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
22384    if (json.has("codeSystem")) {
22385      JsonArray array = json.getAsJsonArray("codeSystem");
22386      for (int i = 0; i < array.size(); i++) {
22387        res.getCodeSystem().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(array.get(i).getAsJsonObject(), res));
22388      }
22389    };
22390    if (json.has("expansion"))
22391      res.setExpansion(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(json.getAsJsonObject("expansion"), res));
22392    if (json.has("codeSearch"))
22393      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(), TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
22394    if (json.has("_codeSearch"))
22395      parseElementProperties(json.getAsJsonObject("_codeSearch"), res.getCodeSearchElement());
22396    if (json.has("validateCode"))
22397      res.setValidateCode(parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(json.getAsJsonObject("validateCode"), res));
22398    if (json.has("translation"))
22399      res.setTranslation(parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(json.getAsJsonObject("translation"), res));
22400    if (json.has("closure"))
22401      res.setClosure(parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(json.getAsJsonObject("closure"), res));
22402  }
22403
22404  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
22405    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
22406    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(json, owner, res);
22407    return res;
22408  }
22409
22410  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res) throws IOException, FHIRFormatError {
22411    parseBackboneElementProperties(json, res);
22412    if (json.has("uri"))
22413      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
22414    if (json.has("_uri"))
22415      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
22416    if (json.has("version")) {
22417      JsonArray array = json.getAsJsonArray("version");
22418      for (int i = 0; i < array.size(); i++) {
22419        res.getVersion().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(array.get(i).getAsJsonObject(), owner));
22420      }
22421    };
22422  }
22423
22424  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
22425    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
22426    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, owner, res);
22427    return res;
22428  }
22429
22430  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res) throws IOException, FHIRFormatError {
22431    parseBackboneElementProperties(json, res);
22432    if (json.has("code"))
22433      res.setCodeElement(parseString(json.get("code").getAsString()));
22434    if (json.has("_code"))
22435      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
22436    if (json.has("isDefault"))
22437      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
22438    if (json.has("_isDefault"))
22439      parseElementProperties(json.getAsJsonObject("_isDefault"), res.getIsDefaultElement());
22440    if (json.has("compositional"))
22441      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
22442    if (json.has("_compositional"))
22443      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
22444    if (json.has("language")) {
22445      JsonArray array = json.getAsJsonArray("language");
22446      for (int i = 0; i < array.size(); i++) {
22447        res.getLanguage().add(parseCode(array.get(i).getAsString()));
22448      }
22449    };
22450    if (json.has("_language")) {
22451      JsonArray array = json.getAsJsonArray("_language");
22452      for (int i = 0; i < array.size(); i++) {
22453        if (i == res.getLanguage().size())
22454          res.getLanguage().add(parseCode(null));
22455        if (array.get(i) instanceof JsonObject) 
22456          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
22457      }
22458    };
22459    if (json.has("filter")) {
22460      JsonArray array = json.getAsJsonArray("filter");
22461      for (int i = 0; i < array.size(); i++) {
22462        res.getFilter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(array.get(i).getAsJsonObject(), owner));
22463      }
22464    };
22465    if (json.has("property")) {
22466      JsonArray array = json.getAsJsonArray("property");
22467      for (int i = 0; i < array.size(); i++) {
22468        res.getProperty().add(parseCode(array.get(i).getAsString()));
22469      }
22470    };
22471    if (json.has("_property")) {
22472      JsonArray array = json.getAsJsonArray("_property");
22473      for (int i = 0; i < array.size(); i++) {
22474        if (i == res.getProperty().size())
22475          res.getProperty().add(parseCode(null));
22476        if (array.get(i) instanceof JsonObject) 
22477          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
22478      }
22479    };
22480  }
22481
22482  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
22483    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
22484    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, owner, res);
22485    return res;
22486  }
22487
22488  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res) throws IOException, FHIRFormatError {
22489    parseBackboneElementProperties(json, res);
22490    if (json.has("code"))
22491      res.setCodeElement(parseCode(json.get("code").getAsString()));
22492    if (json.has("_code"))
22493      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
22494    if (json.has("op")) {
22495      JsonArray array = json.getAsJsonArray("op");
22496      for (int i = 0; i < array.size(); i++) {
22497        res.getOp().add(parseCode(array.get(i).getAsString()));
22498      }
22499    };
22500    if (json.has("_op")) {
22501      JsonArray array = json.getAsJsonArray("_op");
22502      for (int i = 0; i < array.size(); i++) {
22503        if (i == res.getOp().size())
22504          res.getOp().add(parseCode(null));
22505        if (array.get(i) instanceof JsonObject) 
22506          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
22507      }
22508    };
22509  }
22510
22511  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
22512    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
22513    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(json, owner, res);
22514    return res;
22515  }
22516
22517  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res) throws IOException, FHIRFormatError {
22518    parseBackboneElementProperties(json, res);
22519    if (json.has("hierarchical"))
22520      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
22521    if (json.has("_hierarchical"))
22522      parseElementProperties(json.getAsJsonObject("_hierarchical"), res.getHierarchicalElement());
22523    if (json.has("paging"))
22524      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
22525    if (json.has("_paging"))
22526      parseElementProperties(json.getAsJsonObject("_paging"), res.getPagingElement());
22527    if (json.has("incomplete"))
22528      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
22529    if (json.has("_incomplete"))
22530      parseElementProperties(json.getAsJsonObject("_incomplete"), res.getIncompleteElement());
22531    if (json.has("definition"))
22532      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
22533    if (json.has("_definition"))
22534      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
22535    if (json.has("profile")) {
22536      JsonArray array = json.getAsJsonArray("profile");
22537      for (int i = 0; i < array.size(); i++) {
22538        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
22539      }
22540    };
22541    if (json.has("_profile")) {
22542      JsonArray array = json.getAsJsonArray("_profile");
22543      for (int i = 0; i < array.size(); i++) {
22544        if (i == res.getProfile().size())
22545          res.getProfile().add(parseCanonical(null));
22546        if (array.get(i) instanceof JsonObject) 
22547          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
22548      }
22549    };
22550    if (json.has("textFilter"))
22551      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
22552    if (json.has("_textFilter"))
22553      parseElementProperties(json.getAsJsonObject("_textFilter"), res.getTextFilterElement());
22554  }
22555
22556  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
22557    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
22558    parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(json, owner, res);
22559    return res;
22560  }
22561
22562  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res) throws IOException, FHIRFormatError {
22563    parseBackboneElementProperties(json, res);
22564    if (json.has("translations"))
22565      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
22566    if (json.has("_translations"))
22567      parseElementProperties(json.getAsJsonObject("_translations"), res.getTranslationsElement());
22568  }
22569
22570  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
22571    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
22572    parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(json, owner, res);
22573    return res;
22574  }
22575
22576  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res) throws IOException, FHIRFormatError {
22577    parseBackboneElementProperties(json, res);
22578    if (json.has("needsMap"))
22579      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
22580    if (json.has("_needsMap"))
22581      parseElementProperties(json.getAsJsonObject("_needsMap"), res.getNeedsMapElement());
22582  }
22583
22584  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
22585    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
22586    parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(json, owner, res);
22587    return res;
22588  }
22589
22590  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res) throws IOException, FHIRFormatError {
22591    parseBackboneElementProperties(json, res);
22592    if (json.has("translation"))
22593      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
22594    if (json.has("_translation"))
22595      parseElementProperties(json.getAsJsonObject("_translation"), res.getTranslationElement());
22596  }
22597
22598  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
22599    TestReport res = new TestReport();
22600    parseTestReportProperties(json, res);
22601    return res;
22602  }
22603
22604  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
22605    parseDomainResourceProperties(json, res);
22606    if (json.has("identifier"))
22607      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
22608    if (json.has("name"))
22609      res.setNameElement(parseString(json.get("name").getAsString()));
22610    if (json.has("_name"))
22611      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22612    if (json.has("status"))
22613      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
22614    if (json.has("_status"))
22615      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22616    if (json.has("testScript"))
22617      res.setTestScript(parseReference(json.getAsJsonObject("testScript")));
22618    if (json.has("result"))
22619      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
22620    if (json.has("_result"))
22621      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
22622    if (json.has("score"))
22623      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
22624    if (json.has("_score"))
22625      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
22626    if (json.has("tester"))
22627      res.setTesterElement(parseString(json.get("tester").getAsString()));
22628    if (json.has("_tester"))
22629      parseElementProperties(json.getAsJsonObject("_tester"), res.getTesterElement());
22630    if (json.has("issued"))
22631      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
22632    if (json.has("_issued"))
22633      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
22634    if (json.has("participant")) {
22635      JsonArray array = json.getAsJsonArray("participant");
22636      for (int i = 0; i < array.size(); i++) {
22637        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
22638      }
22639    };
22640    if (json.has("setup"))
22641      res.setSetup(parseTestReportTestReportSetupComponent(json.getAsJsonObject("setup"), res));
22642    if (json.has("test")) {
22643      JsonArray array = json.getAsJsonArray("test");
22644      for (int i = 0; i < array.size(); i++) {
22645        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
22646      }
22647    };
22648    if (json.has("teardown"))
22649      res.setTeardown(parseTestReportTestReportTeardownComponent(json.getAsJsonObject("teardown"), res));
22650  }
22651
22652  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
22653    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
22654    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
22655    return res;
22656  }
22657
22658  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
22659    parseBackboneElementProperties(json, res);
22660    if (json.has("type"))
22661      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
22662    if (json.has("_type"))
22663      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22664    if (json.has("uri"))
22665      res.setUriElement(parseUri(json.get("uri").getAsString()));
22666    if (json.has("_uri"))
22667      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
22668    if (json.has("display"))
22669      res.setDisplayElement(parseString(json.get("display").getAsString()));
22670    if (json.has("_display"))
22671      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
22672  }
22673
22674  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
22675    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
22676    parseTestReportTestReportSetupComponentProperties(json, owner, res);
22677    return res;
22678  }
22679
22680  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
22681    parseBackboneElementProperties(json, res);
22682    if (json.has("action")) {
22683      JsonArray array = json.getAsJsonArray("action");
22684      for (int i = 0; i < array.size(); i++) {
22685        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
22686      }
22687    };
22688  }
22689
22690  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
22691    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
22692    parseTestReportSetupActionComponentProperties(json, owner, res);
22693    return res;
22694  }
22695
22696  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
22697    parseBackboneElementProperties(json, res);
22698    if (json.has("operation"))
22699      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
22700    if (json.has("assert"))
22701      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
22702  }
22703
22704  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
22705    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
22706    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
22707    return res;
22708  }
22709
22710  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
22711    parseBackboneElementProperties(json, res);
22712    if (json.has("result"))
22713      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
22714    if (json.has("_result"))
22715      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
22716    if (json.has("message"))
22717      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
22718    if (json.has("_message"))
22719      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
22720    if (json.has("detail"))
22721      res.setDetailElement(parseUri(json.get("detail").getAsString()));
22722    if (json.has("_detail"))
22723      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
22724  }
22725
22726  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
22727    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
22728    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
22729    return res;
22730  }
22731
22732  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
22733    parseBackboneElementProperties(json, res);
22734    if (json.has("result"))
22735      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
22736    if (json.has("_result"))
22737      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
22738    if (json.has("message"))
22739      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
22740    if (json.has("_message"))
22741      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
22742    if (json.has("detail"))
22743      res.setDetailElement(parseString(json.get("detail").getAsString()));
22744    if (json.has("_detail"))
22745      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
22746  }
22747
22748  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
22749    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
22750    parseTestReportTestReportTestComponentProperties(json, owner, res);
22751    return res;
22752  }
22753
22754  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
22755    parseBackboneElementProperties(json, res);
22756    if (json.has("name"))
22757      res.setNameElement(parseString(json.get("name").getAsString()));
22758    if (json.has("_name"))
22759      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22760    if (json.has("description"))
22761      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22762    if (json.has("_description"))
22763      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22764    if (json.has("action")) {
22765      JsonArray array = json.getAsJsonArray("action");
22766      for (int i = 0; i < array.size(); i++) {
22767        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
22768      }
22769    };
22770  }
22771
22772  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
22773    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
22774    parseTestReportTestActionComponentProperties(json, owner, res);
22775    return res;
22776  }
22777
22778  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
22779    parseBackboneElementProperties(json, res);
22780    if (json.has("operation"))
22781      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
22782    if (json.has("assert"))
22783      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
22784  }
22785
22786  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
22787    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
22788    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
22789    return res;
22790  }
22791
22792  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
22793    parseBackboneElementProperties(json, res);
22794    if (json.has("action")) {
22795      JsonArray array = json.getAsJsonArray("action");
22796      for (int i = 0; i < array.size(); i++) {
22797        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
22798      }
22799    };
22800  }
22801
22802  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
22803    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
22804    parseTestReportTeardownActionComponentProperties(json, owner, res);
22805    return res;
22806  }
22807
22808  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
22809    parseBackboneElementProperties(json, res);
22810    if (json.has("operation"))
22811      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
22812  }
22813
22814  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
22815    TestScript res = new TestScript();
22816    parseTestScriptProperties(json, res);
22817    return res;
22818  }
22819
22820  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
22821    parseDomainResourceProperties(json, res);
22822    if (json.has("url"))
22823      res.setUrlElement(parseUri(json.get("url").getAsString()));
22824    if (json.has("_url"))
22825      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
22826    if (json.has("identifier"))
22827      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
22828    if (json.has("version"))
22829      res.setVersionElement(parseString(json.get("version").getAsString()));
22830    if (json.has("_version"))
22831      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
22832    if (json.has("name"))
22833      res.setNameElement(parseString(json.get("name").getAsString()));
22834    if (json.has("_name"))
22835      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22836    if (json.has("title"))
22837      res.setTitleElement(parseString(json.get("title").getAsString()));
22838    if (json.has("_title"))
22839      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22840    if (json.has("status"))
22841      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22842    if (json.has("_status"))
22843      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22844    if (json.has("experimental"))
22845      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22846    if (json.has("_experimental"))
22847      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
22848    if (json.has("date"))
22849      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22850    if (json.has("_date"))
22851      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
22852    if (json.has("publisher"))
22853      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22854    if (json.has("_publisher"))
22855      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
22856    if (json.has("contact")) {
22857      JsonArray array = json.getAsJsonArray("contact");
22858      for (int i = 0; i < array.size(); i++) {
22859        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22860      }
22861    };
22862    if (json.has("description"))
22863      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22864    if (json.has("_description"))
22865      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22866    if (json.has("useContext")) {
22867      JsonArray array = json.getAsJsonArray("useContext");
22868      for (int i = 0; i < array.size(); i++) {
22869        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22870      }
22871    };
22872    if (json.has("jurisdiction")) {
22873      JsonArray array = json.getAsJsonArray("jurisdiction");
22874      for (int i = 0; i < array.size(); i++) {
22875        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22876      }
22877    };
22878    if (json.has("purpose"))
22879      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22880    if (json.has("_purpose"))
22881      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
22882    if (json.has("copyright"))
22883      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22884    if (json.has("_copyright"))
22885      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
22886    if (json.has("origin")) {
22887      JsonArray array = json.getAsJsonArray("origin");
22888      for (int i = 0; i < array.size(); i++) {
22889        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
22890      }
22891    };
22892    if (json.has("destination")) {
22893      JsonArray array = json.getAsJsonArray("destination");
22894      for (int i = 0; i < array.size(); i++) {
22895        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
22896      }
22897    };
22898    if (json.has("metadata"))
22899      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), res));
22900    if (json.has("fixture")) {
22901      JsonArray array = json.getAsJsonArray("fixture");
22902      for (int i = 0; i < array.size(); i++) {
22903        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
22904      }
22905    };
22906    if (json.has("profile")) {
22907      JsonArray array = json.getAsJsonArray("profile");
22908      for (int i = 0; i < array.size(); i++) {
22909        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
22910      }
22911    };
22912    if (json.has("variable")) {
22913      JsonArray array = json.getAsJsonArray("variable");
22914      for (int i = 0; i < array.size(); i++) {
22915        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
22916      }
22917    };
22918    if (json.has("rule")) {
22919      JsonArray array = json.getAsJsonArray("rule");
22920      for (int i = 0; i < array.size(); i++) {
22921        res.getRule().add(parseTestScriptTestScriptRuleComponent(array.get(i).getAsJsonObject(), res));
22922      }
22923    };
22924    if (json.has("ruleset")) {
22925      JsonArray array = json.getAsJsonArray("ruleset");
22926      for (int i = 0; i < array.size(); i++) {
22927        res.getRuleset().add(parseTestScriptTestScriptRulesetComponent(array.get(i).getAsJsonObject(), res));
22928      }
22929    };
22930    if (json.has("setup"))
22931      res.setSetup(parseTestScriptTestScriptSetupComponent(json.getAsJsonObject("setup"), res));
22932    if (json.has("test")) {
22933      JsonArray array = json.getAsJsonArray("test");
22934      for (int i = 0; i < array.size(); i++) {
22935        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
22936      }
22937    };
22938    if (json.has("teardown"))
22939      res.setTeardown(parseTestScriptTestScriptTeardownComponent(json.getAsJsonObject("teardown"), res));
22940  }
22941
22942  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
22943    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
22944    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
22945    return res;
22946  }
22947
22948  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
22949    parseBackboneElementProperties(json, res);
22950    if (json.has("index"))
22951      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
22952    if (json.has("_index"))
22953      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
22954    if (json.has("profile"))
22955      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
22956  }
22957
22958  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
22959    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
22960    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
22961    return res;
22962  }
22963
22964  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
22965    parseBackboneElementProperties(json, res);
22966    if (json.has("index"))
22967      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
22968    if (json.has("_index"))
22969      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
22970    if (json.has("profile"))
22971      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
22972  }
22973
22974  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
22975    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
22976    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
22977    return res;
22978  }
22979
22980  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
22981    parseBackboneElementProperties(json, res);
22982    if (json.has("link")) {
22983      JsonArray array = json.getAsJsonArray("link");
22984      for (int i = 0; i < array.size(); i++) {
22985        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
22986      }
22987    };
22988    if (json.has("capability")) {
22989      JsonArray array = json.getAsJsonArray("capability");
22990      for (int i = 0; i < array.size(); i++) {
22991        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
22992      }
22993    };
22994  }
22995
22996  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
22997    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
22998    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
22999    return res;
23000  }
23001
23002  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
23003    parseBackboneElementProperties(json, res);
23004    if (json.has("url"))
23005      res.setUrlElement(parseUri(json.get("url").getAsString()));
23006    if (json.has("_url"))
23007      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23008    if (json.has("description"))
23009      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23010    if (json.has("_description"))
23011      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23012  }
23013
23014  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23015    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
23016    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
23017    return res;
23018  }
23019
23020  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
23021    parseBackboneElementProperties(json, res);
23022    if (json.has("required"))
23023      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
23024    if (json.has("_required"))
23025      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
23026    if (json.has("validated"))
23027      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
23028    if (json.has("_validated"))
23029      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
23030    if (json.has("description"))
23031      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23032    if (json.has("_description"))
23033      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23034    if (json.has("origin")) {
23035      JsonArray array = json.getAsJsonArray("origin");
23036      for (int i = 0; i < array.size(); i++) {
23037        res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
23038      }
23039    };
23040    if (json.has("_origin")) {
23041      JsonArray array = json.getAsJsonArray("_origin");
23042      for (int i = 0; i < array.size(); i++) {
23043        if (i == res.getOrigin().size())
23044          res.getOrigin().add(parseInteger(null));
23045        if (array.get(i) instanceof JsonObject) 
23046          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
23047      }
23048    };
23049    if (json.has("destination"))
23050      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
23051    if (json.has("_destination"))
23052      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
23053    if (json.has("link")) {
23054      JsonArray array = json.getAsJsonArray("link");
23055      for (int i = 0; i < array.size(); i++) {
23056        res.getLink().add(parseUri(array.get(i).getAsString()));
23057      }
23058    };
23059    if (json.has("_link")) {
23060      JsonArray array = json.getAsJsonArray("_link");
23061      for (int i = 0; i < array.size(); i++) {
23062        if (i == res.getLink().size())
23063          res.getLink().add(parseUri(null));
23064        if (array.get(i) instanceof JsonObject) 
23065          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
23066      }
23067    };
23068    if (json.has("capabilities"))
23069      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
23070    if (json.has("_capabilities"))
23071      parseElementProperties(json.getAsJsonObject("_capabilities"), res.getCapabilitiesElement());
23072  }
23073
23074  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23075    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
23076    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
23077    return res;
23078  }
23079
23080  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
23081    parseBackboneElementProperties(json, res);
23082    if (json.has("autocreate"))
23083      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
23084    if (json.has("_autocreate"))
23085      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
23086    if (json.has("autodelete"))
23087      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
23088    if (json.has("_autodelete"))
23089      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
23090    if (json.has("resource"))
23091      res.setResource(parseReference(json.getAsJsonObject("resource")));
23092  }
23093
23094  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23095    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
23096    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
23097    return res;
23098  }
23099
23100  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
23101    parseBackboneElementProperties(json, res);
23102    if (json.has("name"))
23103      res.setNameElement(parseString(json.get("name").getAsString()));
23104    if (json.has("_name"))
23105      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23106    if (json.has("defaultValue"))
23107      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
23108    if (json.has("_defaultValue"))
23109      parseElementProperties(json.getAsJsonObject("_defaultValue"), res.getDefaultValueElement());
23110    if (json.has("description"))
23111      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23112    if (json.has("_description"))
23113      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23114    if (json.has("expression"))
23115      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23116    if (json.has("_expression"))
23117      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
23118    if (json.has("headerField"))
23119      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
23120    if (json.has("_headerField"))
23121      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
23122    if (json.has("hint"))
23123      res.setHintElement(parseString(json.get("hint").getAsString()));
23124    if (json.has("_hint"))
23125      parseElementProperties(json.getAsJsonObject("_hint"), res.getHintElement());
23126    if (json.has("path"))
23127      res.setPathElement(parseString(json.get("path").getAsString()));
23128    if (json.has("_path"))
23129      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
23130    if (json.has("sourceId"))
23131      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
23132    if (json.has("_sourceId"))
23133      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
23134  }
23135
23136  protected TestScript.TestScriptRuleComponent parseTestScriptTestScriptRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23137    TestScript.TestScriptRuleComponent res = new TestScript.TestScriptRuleComponent();
23138    parseTestScriptTestScriptRuleComponentProperties(json, owner, res);
23139    return res;
23140  }
23141
23142  protected void parseTestScriptTestScriptRuleComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptRuleComponent res) throws IOException, FHIRFormatError {
23143    parseBackboneElementProperties(json, res);
23144    if (json.has("resource"))
23145      res.setResource(parseReference(json.getAsJsonObject("resource")));
23146    if (json.has("param")) {
23147      JsonArray array = json.getAsJsonArray("param");
23148      for (int i = 0; i < array.size(); i++) {
23149        res.getParam().add(parseTestScriptRuleParamComponent(array.get(i).getAsJsonObject(), owner));
23150      }
23151    };
23152  }
23153
23154  protected TestScript.RuleParamComponent parseTestScriptRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23155    TestScript.RuleParamComponent res = new TestScript.RuleParamComponent();
23156    parseTestScriptRuleParamComponentProperties(json, owner, res);
23157    return res;
23158  }
23159
23160  protected void parseTestScriptRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.RuleParamComponent res) throws IOException, FHIRFormatError {
23161    parseBackboneElementProperties(json, res);
23162    if (json.has("name"))
23163      res.setNameElement(parseString(json.get("name").getAsString()));
23164    if (json.has("_name"))
23165      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23166    if (json.has("value"))
23167      res.setValueElement(parseString(json.get("value").getAsString()));
23168    if (json.has("_value"))
23169      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
23170  }
23171
23172  protected TestScript.TestScriptRulesetComponent parseTestScriptTestScriptRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23173    TestScript.TestScriptRulesetComponent res = new TestScript.TestScriptRulesetComponent();
23174    parseTestScriptTestScriptRulesetComponentProperties(json, owner, res);
23175    return res;
23176  }
23177
23178  protected void parseTestScriptTestScriptRulesetComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptRulesetComponent res) throws IOException, FHIRFormatError {
23179    parseBackboneElementProperties(json, res);
23180    if (json.has("resource"))
23181      res.setResource(parseReference(json.getAsJsonObject("resource")));
23182    if (json.has("rule")) {
23183      JsonArray array = json.getAsJsonArray("rule");
23184      for (int i = 0; i < array.size(); i++) {
23185        res.getRule().add(parseTestScriptRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
23186      }
23187    };
23188  }
23189
23190  protected TestScript.RulesetRuleComponent parseTestScriptRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23191    TestScript.RulesetRuleComponent res = new TestScript.RulesetRuleComponent();
23192    parseTestScriptRulesetRuleComponentProperties(json, owner, res);
23193    return res;
23194  }
23195
23196  protected void parseTestScriptRulesetRuleComponentProperties(JsonObject json, TestScript owner, TestScript.RulesetRuleComponent res) throws IOException, FHIRFormatError {
23197    parseBackboneElementProperties(json, res);
23198    if (json.has("ruleId"))
23199      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
23200    if (json.has("_ruleId"))
23201      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
23202    if (json.has("param")) {
23203      JsonArray array = json.getAsJsonArray("param");
23204      for (int i = 0; i < array.size(); i++) {
23205        res.getParam().add(parseTestScriptRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
23206      }
23207    };
23208  }
23209
23210  protected TestScript.RulesetRuleParamComponent parseTestScriptRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23211    TestScript.RulesetRuleParamComponent res = new TestScript.RulesetRuleParamComponent();
23212    parseTestScriptRulesetRuleParamComponentProperties(json, owner, res);
23213    return res;
23214  }
23215
23216  protected void parseTestScriptRulesetRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.RulesetRuleParamComponent res) throws IOException, FHIRFormatError {
23217    parseBackboneElementProperties(json, res);
23218    if (json.has("name"))
23219      res.setNameElement(parseString(json.get("name").getAsString()));
23220    if (json.has("_name"))
23221      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23222    if (json.has("value"))
23223      res.setValueElement(parseString(json.get("value").getAsString()));
23224    if (json.has("_value"))
23225      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
23226  }
23227
23228  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23229    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
23230    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
23231    return res;
23232  }
23233
23234  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
23235    parseBackboneElementProperties(json, res);
23236    if (json.has("action")) {
23237      JsonArray array = json.getAsJsonArray("action");
23238      for (int i = 0; i < array.size(); i++) {
23239        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
23240      }
23241    };
23242  }
23243
23244  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23245    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
23246    parseTestScriptSetupActionComponentProperties(json, owner, res);
23247    return res;
23248  }
23249
23250  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
23251    parseBackboneElementProperties(json, res);
23252    if (json.has("operation"))
23253      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
23254    if (json.has("assert"))
23255      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
23256  }
23257
23258  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23259    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
23260    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
23261    return res;
23262  }
23263
23264  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
23265    parseBackboneElementProperties(json, res);
23266    if (json.has("type"))
23267      res.setType(parseCoding(json.getAsJsonObject("type")));
23268    if (json.has("resource"))
23269      res.setResourceElement(parseCode(json.get("resource").getAsString()));
23270    if (json.has("_resource"))
23271      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
23272    if (json.has("label"))
23273      res.setLabelElement(parseString(json.get("label").getAsString()));
23274    if (json.has("_label"))
23275      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
23276    if (json.has("description"))
23277      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23278    if (json.has("_description"))
23279      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23280    if (json.has("accept"))
23281      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
23282    if (json.has("_accept"))
23283      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
23284    if (json.has("contentType"))
23285      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
23286    if (json.has("_contentType"))
23287      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
23288    if (json.has("destination"))
23289      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
23290    if (json.has("_destination"))
23291      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
23292    if (json.has("encodeRequestUrl"))
23293      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
23294    if (json.has("_encodeRequestUrl"))
23295      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
23296    if (json.has("origin"))
23297      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
23298    if (json.has("_origin"))
23299      parseElementProperties(json.getAsJsonObject("_origin"), res.getOriginElement());
23300    if (json.has("params"))
23301      res.setParamsElement(parseString(json.get("params").getAsString()));
23302    if (json.has("_params"))
23303      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
23304    if (json.has("requestHeader")) {
23305      JsonArray array = json.getAsJsonArray("requestHeader");
23306      for (int i = 0; i < array.size(); i++) {
23307        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
23308      }
23309    };
23310    if (json.has("requestId"))
23311      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
23312    if (json.has("_requestId"))
23313      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
23314    if (json.has("responseId"))
23315      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
23316    if (json.has("_responseId"))
23317      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
23318    if (json.has("sourceId"))
23319      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
23320    if (json.has("_sourceId"))
23321      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
23322    if (json.has("targetId"))
23323      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
23324    if (json.has("_targetId"))
23325      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
23326    if (json.has("url"))
23327      res.setUrlElement(parseString(json.get("url").getAsString()));
23328    if (json.has("_url"))
23329      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23330  }
23331
23332  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23333    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
23334    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
23335    return res;
23336  }
23337
23338  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
23339    parseBackboneElementProperties(json, res);
23340    if (json.has("field"))
23341      res.setFieldElement(parseString(json.get("field").getAsString()));
23342    if (json.has("_field"))
23343      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
23344    if (json.has("value"))
23345      res.setValueElement(parseString(json.get("value").getAsString()));
23346    if (json.has("_value"))
23347      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
23348  }
23349
23350  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23351    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
23352    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
23353    return res;
23354  }
23355
23356  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
23357    parseBackboneElementProperties(json, res);
23358    if (json.has("label"))
23359      res.setLabelElement(parseString(json.get("label").getAsString()));
23360    if (json.has("_label"))
23361      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
23362    if (json.has("description"))
23363      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23364    if (json.has("_description"))
23365      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23366    if (json.has("direction"))
23367      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
23368    if (json.has("_direction"))
23369      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
23370    if (json.has("compareToSourceId"))
23371      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
23372    if (json.has("_compareToSourceId"))
23373      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
23374    if (json.has("compareToSourceExpression"))
23375      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
23376    if (json.has("_compareToSourceExpression"))
23377      parseElementProperties(json.getAsJsonObject("_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
23378    if (json.has("compareToSourcePath"))
23379      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
23380    if (json.has("_compareToSourcePath"))
23381      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
23382    if (json.has("contentType"))
23383      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
23384    if (json.has("_contentType"))
23385      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
23386    if (json.has("expression"))
23387      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23388    if (json.has("_expression"))
23389      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
23390    if (json.has("headerField"))
23391      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
23392    if (json.has("_headerField"))
23393      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
23394    if (json.has("minimumId"))
23395      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
23396    if (json.has("_minimumId"))
23397      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
23398    if (json.has("navigationLinks"))
23399      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
23400    if (json.has("_navigationLinks"))
23401      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
23402    if (json.has("operator"))
23403      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
23404    if (json.has("_operator"))
23405      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
23406    if (json.has("path"))
23407      res.setPathElement(parseString(json.get("path").getAsString()));
23408    if (json.has("_path"))
23409      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
23410    if (json.has("requestMethod"))
23411      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
23412    if (json.has("_requestMethod"))
23413      parseElementProperties(json.getAsJsonObject("_requestMethod"), res.getRequestMethodElement());
23414    if (json.has("requestURL"))
23415      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
23416    if (json.has("_requestURL"))
23417      parseElementProperties(json.getAsJsonObject("_requestURL"), res.getRequestURLElement());
23418    if (json.has("resource"))
23419      res.setResourceElement(parseCode(json.get("resource").getAsString()));
23420    if (json.has("_resource"))
23421      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
23422    if (json.has("response"))
23423      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
23424    if (json.has("_response"))
23425      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
23426    if (json.has("responseCode"))
23427      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
23428    if (json.has("_responseCode"))
23429      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
23430    if (json.has("rule"))
23431      res.setRule(parseTestScriptActionAssertRuleComponent(json.getAsJsonObject("rule"), owner));
23432    if (json.has("ruleset"))
23433      res.setRuleset(parseTestScriptActionAssertRulesetComponent(json.getAsJsonObject("ruleset"), owner));
23434    if (json.has("sourceId"))
23435      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
23436    if (json.has("_sourceId"))
23437      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
23438    if (json.has("validateProfileId"))
23439      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
23440    if (json.has("_validateProfileId"))
23441      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
23442    if (json.has("value"))
23443      res.setValueElement(parseString(json.get("value").getAsString()));
23444    if (json.has("_value"))
23445      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
23446    if (json.has("warningOnly"))
23447      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
23448    if (json.has("_warningOnly"))
23449      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
23450  }
23451
23452  protected TestScript.ActionAssertRuleComponent parseTestScriptActionAssertRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23453    TestScript.ActionAssertRuleComponent res = new TestScript.ActionAssertRuleComponent();
23454    parseTestScriptActionAssertRuleComponentProperties(json, owner, res);
23455    return res;
23456  }
23457
23458  protected void parseTestScriptActionAssertRuleComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRuleComponent res) throws IOException, FHIRFormatError {
23459    parseBackboneElementProperties(json, res);
23460    if (json.has("ruleId"))
23461      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
23462    if (json.has("_ruleId"))
23463      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
23464    if (json.has("param")) {
23465      JsonArray array = json.getAsJsonArray("param");
23466      for (int i = 0; i < array.size(); i++) {
23467        res.getParam().add(parseTestScriptActionAssertRuleParamComponent(array.get(i).getAsJsonObject(), owner));
23468      }
23469    };
23470  }
23471
23472  protected TestScript.ActionAssertRuleParamComponent parseTestScriptActionAssertRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23473    TestScript.ActionAssertRuleParamComponent res = new TestScript.ActionAssertRuleParamComponent();
23474    parseTestScriptActionAssertRuleParamComponentProperties(json, owner, res);
23475    return res;
23476  }
23477
23478  protected void parseTestScriptActionAssertRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRuleParamComponent res) throws IOException, FHIRFormatError {
23479    parseBackboneElementProperties(json, res);
23480    if (json.has("name"))
23481      res.setNameElement(parseString(json.get("name").getAsString()));
23482    if (json.has("_name"))
23483      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23484    if (json.has("value"))
23485      res.setValueElement(parseString(json.get("value").getAsString()));
23486    if (json.has("_value"))
23487      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
23488  }
23489
23490  protected TestScript.ActionAssertRulesetComponent parseTestScriptActionAssertRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23491    TestScript.ActionAssertRulesetComponent res = new TestScript.ActionAssertRulesetComponent();
23492    parseTestScriptActionAssertRulesetComponentProperties(json, owner, res);
23493    return res;
23494  }
23495
23496  protected void parseTestScriptActionAssertRulesetComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetComponent res) throws IOException, FHIRFormatError {
23497    parseBackboneElementProperties(json, res);
23498    if (json.has("rulesetId"))
23499      res.setRulesetIdElement(parseId(json.get("rulesetId").getAsString()));
23500    if (json.has("_rulesetId"))
23501      parseElementProperties(json.getAsJsonObject("_rulesetId"), res.getRulesetIdElement());
23502    if (json.has("rule")) {
23503      JsonArray array = json.getAsJsonArray("rule");
23504      for (int i = 0; i < array.size(); i++) {
23505        res.getRule().add(parseTestScriptActionAssertRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
23506      }
23507    };
23508  }
23509
23510  protected TestScript.ActionAssertRulesetRuleComponent parseTestScriptActionAssertRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23511    TestScript.ActionAssertRulesetRuleComponent res = new TestScript.ActionAssertRulesetRuleComponent();
23512    parseTestScriptActionAssertRulesetRuleComponentProperties(json, owner, res);
23513    return res;
23514  }
23515
23516  protected void parseTestScriptActionAssertRulesetRuleComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetRuleComponent res) throws IOException, FHIRFormatError {
23517    parseBackboneElementProperties(json, res);
23518    if (json.has("ruleId"))
23519      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
23520    if (json.has("_ruleId"))
23521      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
23522    if (json.has("param")) {
23523      JsonArray array = json.getAsJsonArray("param");
23524      for (int i = 0; i < array.size(); i++) {
23525        res.getParam().add(parseTestScriptActionAssertRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
23526      }
23527    };
23528  }
23529
23530  protected TestScript.ActionAssertRulesetRuleParamComponent parseTestScriptActionAssertRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23531    TestScript.ActionAssertRulesetRuleParamComponent res = new TestScript.ActionAssertRulesetRuleParamComponent();
23532    parseTestScriptActionAssertRulesetRuleParamComponentProperties(json, owner, res);
23533    return res;
23534  }
23535
23536  protected void parseTestScriptActionAssertRulesetRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetRuleParamComponent res) throws IOException, FHIRFormatError {
23537    parseBackboneElementProperties(json, res);
23538    if (json.has("name"))
23539      res.setNameElement(parseString(json.get("name").getAsString()));
23540    if (json.has("_name"))
23541      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23542    if (json.has("value"))
23543      res.setValueElement(parseString(json.get("value").getAsString()));
23544    if (json.has("_value"))
23545      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
23546  }
23547
23548  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23549    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
23550    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
23551    return res;
23552  }
23553
23554  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
23555    parseBackboneElementProperties(json, res);
23556    if (json.has("name"))
23557      res.setNameElement(parseString(json.get("name").getAsString()));
23558    if (json.has("_name"))
23559      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23560    if (json.has("description"))
23561      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23562    if (json.has("_description"))
23563      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23564    if (json.has("action")) {
23565      JsonArray array = json.getAsJsonArray("action");
23566      for (int i = 0; i < array.size(); i++) {
23567        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
23568      }
23569    };
23570  }
23571
23572  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23573    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
23574    parseTestScriptTestActionComponentProperties(json, owner, res);
23575    return res;
23576  }
23577
23578  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
23579    parseBackboneElementProperties(json, res);
23580    if (json.has("operation"))
23581      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
23582    if (json.has("assert"))
23583      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
23584  }
23585
23586  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23587    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
23588    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
23589    return res;
23590  }
23591
23592  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
23593    parseBackboneElementProperties(json, res);
23594    if (json.has("action")) {
23595      JsonArray array = json.getAsJsonArray("action");
23596      for (int i = 0; i < array.size(); i++) {
23597        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
23598      }
23599    };
23600  }
23601
23602  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
23603    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
23604    parseTestScriptTeardownActionComponentProperties(json, owner, res);
23605    return res;
23606  }
23607
23608  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
23609    parseBackboneElementProperties(json, res);
23610    if (json.has("operation"))
23611      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
23612  }
23613
23614  protected UserSession parseUserSession(JsonObject json) throws IOException, FHIRFormatError {
23615    UserSession res = new UserSession();
23616    parseUserSessionProperties(json, res);
23617    return res;
23618  }
23619
23620  protected void parseUserSessionProperties(JsonObject json, UserSession res) throws IOException, FHIRFormatError {
23621    parseDomainResourceProperties(json, res);
23622    if (json.has("identifier"))
23623      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
23624    if (json.has("user"))
23625      res.setUser(parseReference(json.getAsJsonObject("user")));
23626    if (json.has("status"))
23627      res.setStatus(parseUserSessionUserSessionStatusComponent(json.getAsJsonObject("status"), res));
23628    if (json.has("workstation"))
23629      res.setWorkstation(parseIdentifier(json.getAsJsonObject("workstation")));
23630    if (json.has("focus")) {
23631      JsonArray array = json.getAsJsonArray("focus");
23632      for (int i = 0; i < array.size(); i++) {
23633        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
23634      }
23635    };
23636    if (json.has("created"))
23637      res.setCreatedElement(parseInstant(json.get("created").getAsString()));
23638    if (json.has("_created"))
23639      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
23640    if (json.has("expires"))
23641      res.setExpiresElement(parseInstant(json.get("expires").getAsString()));
23642    if (json.has("_expires"))
23643      parseElementProperties(json.getAsJsonObject("_expires"), res.getExpiresElement());
23644    if (json.has("context")) {
23645      JsonArray array = json.getAsJsonArray("context");
23646      for (int i = 0; i < array.size(); i++) {
23647        res.getContext().add(parseUserSessionUserSessionContextComponent(array.get(i).getAsJsonObject(), res));
23648      }
23649    };
23650  }
23651
23652  protected UserSession.UserSessionStatusComponent parseUserSessionUserSessionStatusComponent(JsonObject json, UserSession owner) throws IOException, FHIRFormatError {
23653    UserSession.UserSessionStatusComponent res = new UserSession.UserSessionStatusComponent();
23654    parseUserSessionUserSessionStatusComponentProperties(json, owner, res);
23655    return res;
23656  }
23657
23658  protected void parseUserSessionUserSessionStatusComponentProperties(JsonObject json, UserSession owner, UserSession.UserSessionStatusComponent res) throws IOException, FHIRFormatError {
23659    parseBackboneElementProperties(json, res);
23660    if (json.has("code"))
23661      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), UserSession.UserSessionStatus.NULL, new UserSession.UserSessionStatusEnumFactory()));
23662    if (json.has("_code"))
23663      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
23664    if (json.has("source"))
23665      res.setSourceElement(parseEnumeration(json.get("source").getAsString(), UserSession.UserSessionStatusSource.NULL, new UserSession.UserSessionStatusSourceEnumFactory()));
23666    if (json.has("_source"))
23667      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
23668  }
23669
23670  protected UserSession.UserSessionContextComponent parseUserSessionUserSessionContextComponent(JsonObject json, UserSession owner) throws IOException, FHIRFormatError {
23671    UserSession.UserSessionContextComponent res = new UserSession.UserSessionContextComponent();
23672    parseUserSessionUserSessionContextComponentProperties(json, owner, res);
23673    return res;
23674  }
23675
23676  protected void parseUserSessionUserSessionContextComponentProperties(JsonObject json, UserSession owner, UserSession.UserSessionContextComponent res) throws IOException, FHIRFormatError {
23677    parseBackboneElementProperties(json, res);
23678    if (json.has("type"))
23679      res.setTypeElement(parseString(json.get("type").getAsString()));
23680    if (json.has("_type"))
23681      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23682    Type value = parseType("value", json);
23683    if (value != null)
23684      res.setValue(value);
23685  }
23686
23687  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
23688    ValueSet res = new ValueSet();
23689    parseValueSetProperties(json, res);
23690    return res;
23691  }
23692
23693  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
23694    parseDomainResourceProperties(json, res);
23695    if (json.has("url"))
23696      res.setUrlElement(parseUri(json.get("url").getAsString()));
23697    if (json.has("_url"))
23698      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23699    if (json.has("identifier")) {
23700      JsonArray array = json.getAsJsonArray("identifier");
23701      for (int i = 0; i < array.size(); i++) {
23702        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23703      }
23704    };
23705    if (json.has("version"))
23706      res.setVersionElement(parseString(json.get("version").getAsString()));
23707    if (json.has("_version"))
23708      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23709    if (json.has("name"))
23710      res.setNameElement(parseString(json.get("name").getAsString()));
23711    if (json.has("_name"))
23712      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23713    if (json.has("title"))
23714      res.setTitleElement(parseString(json.get("title").getAsString()));
23715    if (json.has("_title"))
23716      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
23717    if (json.has("status"))
23718      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23719    if (json.has("_status"))
23720      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23721    if (json.has("experimental"))
23722      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23723    if (json.has("_experimental"))
23724      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
23725    if (json.has("date"))
23726      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23727    if (json.has("_date"))
23728      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
23729    if (json.has("publisher"))
23730      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23731    if (json.has("_publisher"))
23732      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
23733    if (json.has("contact")) {
23734      JsonArray array = json.getAsJsonArray("contact");
23735      for (int i = 0; i < array.size(); i++) {
23736        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23737      }
23738    };
23739    if (json.has("description"))
23740      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23741    if (json.has("_description"))
23742      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23743    if (json.has("useContext")) {
23744      JsonArray array = json.getAsJsonArray("useContext");
23745      for (int i = 0; i < array.size(); i++) {
23746        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23747      }
23748    };
23749    if (json.has("jurisdiction")) {
23750      JsonArray array = json.getAsJsonArray("jurisdiction");
23751      for (int i = 0; i < array.size(); i++) {
23752        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23753      }
23754    };
23755    if (json.has("immutable"))
23756      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
23757    if (json.has("_immutable"))
23758      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
23759    if (json.has("purpose"))
23760      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23761    if (json.has("_purpose"))
23762      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
23763    if (json.has("copyright"))
23764      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23765    if (json.has("_copyright"))
23766      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
23767    if (json.has("extensible"))
23768      res.setExtensibleElement(parseBoolean(json.get("extensible").getAsBoolean()));
23769    if (json.has("_extensible"))
23770      parseElementProperties(json.getAsJsonObject("_extensible"), res.getExtensibleElement());
23771    if (json.has("compose"))
23772      res.setCompose(parseValueSetValueSetComposeComponent(json.getAsJsonObject("compose"), res));
23773    if (json.has("expansion"))
23774      res.setExpansion(parseValueSetValueSetExpansionComponent(json.getAsJsonObject("expansion"), res));
23775  }
23776
23777  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
23778    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
23779    parseValueSetValueSetComposeComponentProperties(json, owner, res);
23780    return res;
23781  }
23782
23783  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
23784    parseBackboneElementProperties(json, res);
23785    if (json.has("lockedDate"))
23786      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
23787    if (json.has("_lockedDate"))
23788      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
23789    if (json.has("inactive"))
23790      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
23791    if (json.has("_inactive"))
23792      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
23793    if (json.has("include")) {
23794      JsonArray array = json.getAsJsonArray("include");
23795      for (int i = 0; i < array.size(); i++) {
23796        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
23797      }
23798    };
23799    if (json.has("exclude")) {
23800      JsonArray array = json.getAsJsonArray("exclude");
23801      for (int i = 0; i < array.size(); i++) {
23802        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
23803      }
23804    };
23805  }
23806
23807  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
23808    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
23809    parseValueSetConceptSetComponentProperties(json, owner, res);
23810    return res;
23811  }
23812
23813  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
23814    parseBackboneElementProperties(json, res);
23815    if (json.has("system"))
23816      res.setSystemElement(parseUri(json.get("system").getAsString()));
23817    if (json.has("_system"))
23818      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
23819    if (json.has("version"))
23820      res.setVersionElement(parseString(json.get("version").getAsString()));
23821    if (json.has("_version"))
23822      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23823    if (json.has("concept")) {
23824      JsonArray array = json.getAsJsonArray("concept");
23825      for (int i = 0; i < array.size(); i++) {
23826        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
23827      }
23828    };
23829    if (json.has("filter")) {
23830      JsonArray array = json.getAsJsonArray("filter");
23831      for (int i = 0; i < array.size(); i++) {
23832        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
23833      }
23834    };
23835    if (json.has("valueSet")) {
23836      JsonArray array = json.getAsJsonArray("valueSet");
23837      for (int i = 0; i < array.size(); i++) {
23838        res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
23839      }
23840    };
23841    if (json.has("_valueSet")) {
23842      JsonArray array = json.getAsJsonArray("_valueSet");
23843      for (int i = 0; i < array.size(); i++) {
23844        if (i == res.getValueSet().size())
23845          res.getValueSet().add(parseCanonical(null));
23846        if (array.get(i) instanceof JsonObject) 
23847          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
23848      }
23849    };
23850  }
23851
23852  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
23853    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
23854    parseValueSetConceptReferenceComponentProperties(json, owner, res);
23855    return res;
23856  }
23857
23858  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
23859    parseBackboneElementProperties(json, res);
23860    if (json.has("code"))
23861      res.setCodeElement(parseCode(json.get("code").getAsString()));
23862    if (json.has("_code"))
23863      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
23864    if (json.has("display"))
23865      res.setDisplayElement(parseString(json.get("display").getAsString()));
23866    if (json.has("_display"))
23867      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
23868    if (json.has("designation")) {
23869      JsonArray array = json.getAsJsonArray("designation");
23870      for (int i = 0; i < array.size(); i++) {
23871        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
23872      }
23873    };
23874  }
23875
23876  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
23877    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
23878    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
23879    return res;
23880  }
23881
23882  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
23883    parseBackboneElementProperties(json, res);
23884    if (json.has("language"))
23885      res.setLanguageElement(parseCode(json.get("language").getAsString()));
23886    if (json.has("_language"))
23887      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
23888    if (json.has("use"))
23889      res.setUse(parseCoding(json.getAsJsonObject("use")));
23890    if (json.has("value"))
23891      res.setValueElement(parseString(json.get("value").getAsString()));
23892    if (json.has("_value"))
23893      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
23894  }
23895
23896  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
23897    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
23898    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
23899    return res;
23900  }
23901
23902  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
23903    parseBackboneElementProperties(json, res);
23904    if (json.has("property"))
23905      res.setPropertyElement(parseCode(json.get("property").getAsString()));
23906    if (json.has("_property"))
23907      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
23908    if (json.has("op"))
23909      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
23910    if (json.has("_op"))
23911      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
23912    if (json.has("value"))
23913      res.setValueElement(parseString(json.get("value").getAsString()));
23914    if (json.has("_value"))
23915      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
23916  }
23917
23918  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
23919    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
23920    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
23921    return res;
23922  }
23923
23924  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
23925    parseBackboneElementProperties(json, res);
23926    if (json.has("identifier"))
23927      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
23928    if (json.has("_identifier"))
23929      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
23930    if (json.has("timestamp"))
23931      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
23932    if (json.has("_timestamp"))
23933      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
23934    if (json.has("total"))
23935      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
23936    if (json.has("_total"))
23937      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
23938    if (json.has("offset"))
23939      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
23940    if (json.has("_offset"))
23941      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
23942    if (json.has("parameter")) {
23943      JsonArray array = json.getAsJsonArray("parameter");
23944      for (int i = 0; i < array.size(); i++) {
23945        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
23946      }
23947    };
23948    if (json.has("contains")) {
23949      JsonArray array = json.getAsJsonArray("contains");
23950      for (int i = 0; i < array.size(); i++) {
23951        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
23952      }
23953    };
23954  }
23955
23956  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
23957    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
23958    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
23959    return res;
23960  }
23961
23962  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
23963    parseBackboneElementProperties(json, res);
23964    if (json.has("name"))
23965      res.setNameElement(parseString(json.get("name").getAsString()));
23966    if (json.has("_name"))
23967      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23968    Type value = parseType("value", json);
23969    if (value != null)
23970      res.setValue(value);
23971  }
23972
23973  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
23974    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
23975    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
23976    return res;
23977  }
23978
23979  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
23980    parseBackboneElementProperties(json, res);
23981    if (json.has("system"))
23982      res.setSystemElement(parseUri(json.get("system").getAsString()));
23983    if (json.has("_system"))
23984      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
23985    if (json.has("abstract"))
23986      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
23987    if (json.has("_abstract"))
23988      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
23989    if (json.has("inactive"))
23990      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
23991    if (json.has("_inactive"))
23992      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
23993    if (json.has("version"))
23994      res.setVersionElement(parseString(json.get("version").getAsString()));
23995    if (json.has("_version"))
23996      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23997    if (json.has("code"))
23998      res.setCodeElement(parseCode(json.get("code").getAsString()));
23999    if (json.has("_code"))
24000      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
24001    if (json.has("display"))
24002      res.setDisplayElement(parseString(json.get("display").getAsString()));
24003    if (json.has("_display"))
24004      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
24005    if (json.has("designation")) {
24006      JsonArray array = json.getAsJsonArray("designation");
24007      for (int i = 0; i < array.size(); i++) {
24008        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
24009      }
24010    };
24011    if (json.has("contains")) {
24012      JsonArray array = json.getAsJsonArray("contains");
24013      for (int i = 0; i < array.size(); i++) {
24014        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
24015      }
24016    };
24017  }
24018
24019  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
24020    VerificationResult res = new VerificationResult();
24021    parseVerificationResultProperties(json, res);
24022    return res;
24023  }
24024
24025  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res) throws IOException, FHIRFormatError {
24026    parseDomainResourceProperties(json, res);
24027    if (json.has("target")) {
24028      JsonArray array = json.getAsJsonArray("target");
24029      for (int i = 0; i < array.size(); i++) {
24030        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
24031      }
24032    };
24033    if (json.has("targetLocation")) {
24034      JsonArray array = json.getAsJsonArray("targetLocation");
24035      for (int i = 0; i < array.size(); i++) {
24036        res.getTargetLocation().add(parseString(array.get(i).getAsString()));
24037      }
24038    };
24039    if (json.has("_targetLocation")) {
24040      JsonArray array = json.getAsJsonArray("_targetLocation");
24041      for (int i = 0; i < array.size(); i++) {
24042        if (i == res.getTargetLocation().size())
24043          res.getTargetLocation().add(parseString(null));
24044        if (array.get(i) instanceof JsonObject) 
24045          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
24046      }
24047    };
24048    if (json.has("need"))
24049      res.setNeedElement(parseEnumeration(json.get("need").getAsString(), VerificationResult.Need.NULL, new VerificationResult.NeedEnumFactory()));
24050    if (json.has("_need"))
24051      parseElementProperties(json.getAsJsonObject("_need"), res.getNeedElement());
24052    if (json.has("status"))
24053      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.Status.NULL, new VerificationResult.StatusEnumFactory()));
24054    if (json.has("_status"))
24055      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24056    if (json.has("statusDate"))
24057      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
24058    if (json.has("_statusDate"))
24059      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
24060    if (json.has("validationType"))
24061      res.setValidationTypeElement(parseEnumeration(json.get("validationType").getAsString(), VerificationResult.ValidationType.NULL, new VerificationResult.ValidationTypeEnumFactory()));
24062    if (json.has("_validationType"))
24063      parseElementProperties(json.getAsJsonObject("_validationType"), res.getValidationTypeElement());
24064    if (json.has("validationProcess")) {
24065      JsonArray array = json.getAsJsonArray("validationProcess");
24066      for (int i = 0; i < array.size(); i++) {
24067        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24068      }
24069    };
24070    if (json.has("frequency"))
24071      res.setFrequency(parseTiming(json.getAsJsonObject("frequency")));
24072    if (json.has("lastPerformed"))
24073      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
24074    if (json.has("_lastPerformed"))
24075      parseElementProperties(json.getAsJsonObject("_lastPerformed"), res.getLastPerformedElement());
24076    if (json.has("nextScheduled"))
24077      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
24078    if (json.has("_nextScheduled"))
24079      parseElementProperties(json.getAsJsonObject("_nextScheduled"), res.getNextScheduledElement());
24080    if (json.has("failureAction"))
24081      res.setFailureActionElement(parseEnumeration(json.get("failureAction").getAsString(), VerificationResult.FailureAction.NULL, new VerificationResult.FailureActionEnumFactory()));
24082    if (json.has("_failureAction"))
24083      parseElementProperties(json.getAsJsonObject("_failureAction"), res.getFailureActionElement());
24084    if (json.has("primarySource")) {
24085      JsonArray array = json.getAsJsonArray("primarySource");
24086      for (int i = 0; i < array.size(); i++) {
24087        res.getPrimarySource().add(parseVerificationResultVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject(), res));
24088      }
24089    };
24090    if (json.has("attestation"))
24091      res.setAttestation(parseVerificationResultVerificationResultAttestationComponent(json.getAsJsonObject("attestation"), res));
24092    if (json.has("validator")) {
24093      JsonArray array = json.getAsJsonArray("validator");
24094      for (int i = 0; i < array.size(); i++) {
24095        res.getValidator().add(parseVerificationResultVerificationResultValidatorComponent(array.get(i).getAsJsonObject(), res));
24096      }
24097    };
24098  }
24099
24100  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultVerificationResultPrimarySourceComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
24101    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
24102    parseVerificationResultVerificationResultPrimarySourceComponentProperties(json, owner, res);
24103    return res;
24104  }
24105
24106  protected void parseVerificationResultVerificationResultPrimarySourceComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultPrimarySourceComponent res) throws IOException, FHIRFormatError {
24107    parseBackboneElementProperties(json, res);
24108    if (json.has("identifier"))
24109      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24110    if (json.has("organization"))
24111      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
24112    if (json.has("type")) {
24113      JsonArray array = json.getAsJsonArray("type");
24114      for (int i = 0; i < array.size(); i++) {
24115        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24116      }
24117    };
24118    if (json.has("validationProcess")) {
24119      JsonArray array = json.getAsJsonArray("validationProcess");
24120      for (int i = 0; i < array.size(); i++) {
24121        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24122      }
24123    };
24124    if (json.has("validationStatus"))
24125      res.setValidationStatusElement(parseEnumeration(json.get("validationStatus").getAsString(), VerificationResult.ValidationStatus.NULL, new VerificationResult.ValidationStatusEnumFactory()));
24126    if (json.has("_validationStatus"))
24127      parseElementProperties(json.getAsJsonObject("_validationStatus"), res.getValidationStatusElement());
24128    if (json.has("validationDate"))
24129      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
24130    if (json.has("_validationDate"))
24131      parseElementProperties(json.getAsJsonObject("_validationDate"), res.getValidationDateElement());
24132    if (json.has("canPushUpdates"))
24133      res.setCanPushUpdatesElement(parseEnumeration(json.get("canPushUpdates").getAsString(), VerificationResult.CanPushUpdates.NULL, new VerificationResult.CanPushUpdatesEnumFactory()));
24134    if (json.has("_canPushUpdates"))
24135      parseElementProperties(json.getAsJsonObject("_canPushUpdates"), res.getCanPushUpdatesElement());
24136    if (json.has("pushTypeAvailable")) {
24137      JsonArray array = json.getAsJsonArray("pushTypeAvailable");
24138      for (int i = 0; i < array.size(); i++) {
24139        res.getPushTypeAvailable().add(parseEnumeration(array.get(i).getAsString(), VerificationResult.PushTypeAvailable.NULL, new VerificationResult.PushTypeAvailableEnumFactory()));
24140      }
24141    };
24142    if (json.has("_pushTypeAvailable")) {
24143      JsonArray array = json.getAsJsonArray("_pushTypeAvailable");
24144      for (int i = 0; i < array.size(); i++) {
24145        if (i == res.getPushTypeAvailable().size())
24146          res.getPushTypeAvailable().add(parseEnumeration(null, VerificationResult.PushTypeAvailable.NULL, new VerificationResult.PushTypeAvailableEnumFactory()));
24147        if (array.get(i) instanceof JsonObject) 
24148          parseElementProperties(array.get(i).getAsJsonObject(), res.getPushTypeAvailable().get(i));
24149      }
24150    };
24151  }
24152
24153  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultVerificationResultAttestationComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
24154    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
24155    parseVerificationResultVerificationResultAttestationComponentProperties(json, owner, res);
24156    return res;
24157  }
24158
24159  protected void parseVerificationResultVerificationResultAttestationComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultAttestationComponent res) throws IOException, FHIRFormatError {
24160    parseBackboneElementProperties(json, res);
24161    if (json.has("source"))
24162      res.setSource(parseReference(json.getAsJsonObject("source")));
24163    if (json.has("organization"))
24164      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
24165    if (json.has("method"))
24166      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
24167    if (json.has("date"))
24168      res.setDateElement(parseDate(json.get("date").getAsString()));
24169    if (json.has("_date"))
24170      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
24171    if (json.has("sourceIdentityCertificate"))
24172      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
24173    if (json.has("_sourceIdentityCertificate"))
24174      parseElementProperties(json.getAsJsonObject("_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
24175    if (json.has("proxyIdentityCertificate"))
24176      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
24177    if (json.has("_proxyIdentityCertificate"))
24178      parseElementProperties(json.getAsJsonObject("_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
24179  }
24180
24181  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultVerificationResultValidatorComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
24182    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
24183    parseVerificationResultVerificationResultValidatorComponentProperties(json, owner, res);
24184    return res;
24185  }
24186
24187  protected void parseVerificationResultVerificationResultValidatorComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultValidatorComponent res) throws IOException, FHIRFormatError {
24188    parseBackboneElementProperties(json, res);
24189    if (json.has("identifier"))
24190      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24191    if (json.has("organization"))
24192      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
24193    if (json.has("identityCertificate"))
24194      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
24195    if (json.has("_identityCertificate"))
24196      parseElementProperties(json.getAsJsonObject("_identityCertificate"), res.getIdentityCertificateElement());
24197    if (json.has("dateValidated"))
24198      res.setDateValidatedElement(parseDate(json.get("dateValidated").getAsString()));
24199    if (json.has("_dateValidated"))
24200      parseElementProperties(json.getAsJsonObject("_dateValidated"), res.getDateValidatedElement());
24201  }
24202
24203  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
24204    VisionPrescription res = new VisionPrescription();
24205    parseVisionPrescriptionProperties(json, res);
24206    return res;
24207  }
24208
24209  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
24210    parseDomainResourceProperties(json, res);
24211    if (json.has("identifier")) {
24212      JsonArray array = json.getAsJsonArray("identifier");
24213      for (int i = 0; i < array.size(); i++) {
24214        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24215      }
24216    };
24217    if (json.has("status"))
24218      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
24219    if (json.has("_status"))
24220      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24221    if (json.has("patient"))
24222      res.setPatient(parseReference(json.getAsJsonObject("patient")));
24223    if (json.has("encounter"))
24224      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
24225    if (json.has("dateWritten"))
24226      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
24227    if (json.has("_dateWritten"))
24228      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
24229    if (json.has("prescriber"))
24230      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
24231    Type reason = parseType("reason", json);
24232    if (reason != null)
24233      res.setReason(reason);
24234    if (json.has("dispense")) {
24235      JsonArray array = json.getAsJsonArray("dispense");
24236      for (int i = 0; i < array.size(); i++) {
24237        res.getDispense().add(parseVisionPrescriptionVisionPrescriptionDispenseComponent(array.get(i).getAsJsonObject(), res));
24238      }
24239    };
24240  }
24241
24242  protected VisionPrescription.VisionPrescriptionDispenseComponent parseVisionPrescriptionVisionPrescriptionDispenseComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
24243    VisionPrescription.VisionPrescriptionDispenseComponent res = new VisionPrescription.VisionPrescriptionDispenseComponent();
24244    parseVisionPrescriptionVisionPrescriptionDispenseComponentProperties(json, owner, res);
24245    return res;
24246  }
24247
24248  protected void parseVisionPrescriptionVisionPrescriptionDispenseComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.VisionPrescriptionDispenseComponent res) throws IOException, FHIRFormatError {
24249    parseBackboneElementProperties(json, res);
24250    if (json.has("product"))
24251      res.setProduct(parseCodeableConcept(json.getAsJsonObject("product")));
24252    if (json.has("eye"))
24253      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
24254    if (json.has("_eye"))
24255      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
24256    if (json.has("sphere"))
24257      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
24258    if (json.has("_sphere"))
24259      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
24260    if (json.has("cylinder"))
24261      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
24262    if (json.has("_cylinder"))
24263      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
24264    if (json.has("axis"))
24265      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
24266    if (json.has("_axis"))
24267      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
24268    if (json.has("prism")) {
24269      JsonArray array = json.getAsJsonArray("prism");
24270      for (int i = 0; i < array.size(); i++) {
24271        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject(), owner));
24272      }
24273    };
24274    if (json.has("add"))
24275      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
24276    if (json.has("_add"))
24277      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
24278    if (json.has("power"))
24279      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
24280    if (json.has("_power"))
24281      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
24282    if (json.has("backCurve"))
24283      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
24284    if (json.has("_backCurve"))
24285      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
24286    if (json.has("diameter"))
24287      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
24288    if (json.has("_diameter"))
24289      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
24290    if (json.has("duration"))
24291      res.setDuration(parseSimpleQuantity(json.getAsJsonObject("duration")));
24292    if (json.has("color"))
24293      res.setColorElement(parseString(json.get("color").getAsString()));
24294    if (json.has("_color"))
24295      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
24296    if (json.has("brand"))
24297      res.setBrandElement(parseString(json.get("brand").getAsString()));
24298    if (json.has("_brand"))
24299      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
24300    if (json.has("note")) {
24301      JsonArray array = json.getAsJsonArray("note");
24302      for (int i = 0; i < array.size(); i++) {
24303        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24304      }
24305    };
24306  }
24307
24308  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
24309    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
24310    parseVisionPrescriptionPrismComponentProperties(json, owner, res);
24311    return res;
24312  }
24313
24314  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
24315    parseBackboneElementProperties(json, res);
24316    if (json.has("amount"))
24317      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
24318    if (json.has("_amount"))
24319      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
24320    if (json.has("base"))
24321      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
24322    if (json.has("_base"))
24323      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
24324  }
24325
24326  @Override
24327  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
24328    String t = json.get("resourceType").getAsString();
24329    if (Utilities.noString(t))
24330      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
24331    if (t.equals("Parameters"))
24332      return parseParameters(json);
24333    else if (t.equals("Account"))
24334      return parseAccount(json);
24335    else if (t.equals("ActivityDefinition"))
24336      return parseActivityDefinition(json);
24337    else if (t.equals("AdverseEvent"))
24338      return parseAdverseEvent(json);
24339    else if (t.equals("AllergyIntolerance"))
24340      return parseAllergyIntolerance(json);
24341    else if (t.equals("Appointment"))
24342      return parseAppointment(json);
24343    else if (t.equals("AppointmentResponse"))
24344      return parseAppointmentResponse(json);
24345    else if (t.equals("AuditEvent"))
24346      return parseAuditEvent(json);
24347    else if (t.equals("Basic"))
24348      return parseBasic(json);
24349    else if (t.equals("Binary"))
24350      return parseBinary(json);
24351    else if (t.equals("BiologicallyDerivedProduct"))
24352      return parseBiologicallyDerivedProduct(json);
24353    else if (t.equals("BodyStructure"))
24354      return parseBodyStructure(json);
24355    else if (t.equals("Bundle"))
24356      return parseBundle(json);
24357    else if (t.equals("CapabilityStatement"))
24358      return parseCapabilityStatement(json);
24359    else if (t.equals("CarePlan"))
24360      return parseCarePlan(json);
24361    else if (t.equals("CareTeam"))
24362      return parseCareTeam(json);
24363    else if (t.equals("ChargeItem"))
24364      return parseChargeItem(json);
24365    else if (t.equals("Claim"))
24366      return parseClaim(json);
24367    else if (t.equals("ClaimResponse"))
24368      return parseClaimResponse(json);
24369    else if (t.equals("ClinicalImpression"))
24370      return parseClinicalImpression(json);
24371    else if (t.equals("CodeSystem"))
24372      return parseCodeSystem(json);
24373    else if (t.equals("Communication"))
24374      return parseCommunication(json);
24375    else if (t.equals("CommunicationRequest"))
24376      return parseCommunicationRequest(json);
24377    else if (t.equals("CompartmentDefinition"))
24378      return parseCompartmentDefinition(json);
24379    else if (t.equals("Composition"))
24380      return parseComposition(json);
24381    else if (t.equals("ConceptMap"))
24382      return parseConceptMap(json);
24383    else if (t.equals("Condition"))
24384      return parseCondition(json);
24385    else if (t.equals("Consent"))
24386      return parseConsent(json);
24387    else if (t.equals("Contract"))
24388      return parseContract(json);
24389    else if (t.equals("Coverage"))
24390      return parseCoverage(json);
24391    else if (t.equals("DetectedIssue"))
24392      return parseDetectedIssue(json);
24393    else if (t.equals("Device"))
24394      return parseDevice(json);
24395    else if (t.equals("DeviceComponent"))
24396      return parseDeviceComponent(json);
24397    else if (t.equals("DeviceMetric"))
24398      return parseDeviceMetric(json);
24399    else if (t.equals("DeviceRequest"))
24400      return parseDeviceRequest(json);
24401    else if (t.equals("DeviceUseStatement"))
24402      return parseDeviceUseStatement(json);
24403    else if (t.equals("DiagnosticReport"))
24404      return parseDiagnosticReport(json);
24405    else if (t.equals("DocumentManifest"))
24406      return parseDocumentManifest(json);
24407    else if (t.equals("DocumentReference"))
24408      return parseDocumentReference(json);
24409    else if (t.equals("EligibilityRequest"))
24410      return parseEligibilityRequest(json);
24411    else if (t.equals("EligibilityResponse"))
24412      return parseEligibilityResponse(json);
24413    else if (t.equals("Encounter"))
24414      return parseEncounter(json);
24415    else if (t.equals("Endpoint"))
24416      return parseEndpoint(json);
24417    else if (t.equals("EnrollmentRequest"))
24418      return parseEnrollmentRequest(json);
24419    else if (t.equals("EnrollmentResponse"))
24420      return parseEnrollmentResponse(json);
24421    else if (t.equals("EntryDefinition"))
24422      return parseEntryDefinition(json);
24423    else if (t.equals("EpisodeOfCare"))
24424      return parseEpisodeOfCare(json);
24425    else if (t.equals("EventDefinition"))
24426      return parseEventDefinition(json);
24427    else if (t.equals("ExampleScenario"))
24428      return parseExampleScenario(json);
24429    else if (t.equals("ExpansionProfile"))
24430      return parseExpansionProfile(json);
24431    else if (t.equals("ExplanationOfBenefit"))
24432      return parseExplanationOfBenefit(json);
24433    else if (t.equals("FamilyMemberHistory"))
24434      return parseFamilyMemberHistory(json);
24435    else if (t.equals("Flag"))
24436      return parseFlag(json);
24437    else if (t.equals("Goal"))
24438      return parseGoal(json);
24439    else if (t.equals("GraphDefinition"))
24440      return parseGraphDefinition(json);
24441    else if (t.equals("Group"))
24442      return parseGroup(json);
24443    else if (t.equals("GuidanceResponse"))
24444      return parseGuidanceResponse(json);
24445    else if (t.equals("HealthcareService"))
24446      return parseHealthcareService(json);
24447    else if (t.equals("ImagingStudy"))
24448      return parseImagingStudy(json);
24449    else if (t.equals("Immunization"))
24450      return parseImmunization(json);
24451    else if (t.equals("ImmunizationEvaluation"))
24452      return parseImmunizationEvaluation(json);
24453    else if (t.equals("ImmunizationRecommendation"))
24454      return parseImmunizationRecommendation(json);
24455    else if (t.equals("ImplementationGuide"))
24456      return parseImplementationGuide(json);
24457    else if (t.equals("Invoice"))
24458      return parseInvoice(json);
24459    else if (t.equals("ItemInstance"))
24460      return parseItemInstance(json);
24461    else if (t.equals("Library"))
24462      return parseLibrary(json);
24463    else if (t.equals("Linkage"))
24464      return parseLinkage(json);
24465    else if (t.equals("List"))
24466      return parseListResource(json);
24467    else if (t.equals("Location"))
24468      return parseLocation(json);
24469    else if (t.equals("Measure"))
24470      return parseMeasure(json);
24471    else if (t.equals("MeasureReport"))
24472      return parseMeasureReport(json);
24473    else if (t.equals("Media"))
24474      return parseMedia(json);
24475    else if (t.equals("Medication"))
24476      return parseMedication(json);
24477    else if (t.equals("MedicationAdministration"))
24478      return parseMedicationAdministration(json);
24479    else if (t.equals("MedicationDispense"))
24480      return parseMedicationDispense(json);
24481    else if (t.equals("MedicationKnowledge"))
24482      return parseMedicationKnowledge(json);
24483    else if (t.equals("MedicationRequest"))
24484      return parseMedicationRequest(json);
24485    else if (t.equals("MedicationStatement"))
24486      return parseMedicationStatement(json);
24487    else if (t.equals("MedicinalProduct"))
24488      return parseMedicinalProduct(json);
24489    else if (t.equals("MedicinalProductAuthorization"))
24490      return parseMedicinalProductAuthorization(json);
24491    else if (t.equals("MedicinalProductClinicals"))
24492      return parseMedicinalProductClinicals(json);
24493    else if (t.equals("MedicinalProductDeviceSpec"))
24494      return parseMedicinalProductDeviceSpec(json);
24495    else if (t.equals("MedicinalProductIngredient"))
24496      return parseMedicinalProductIngredient(json);
24497    else if (t.equals("MedicinalProductPackaged"))
24498      return parseMedicinalProductPackaged(json);
24499    else if (t.equals("MedicinalProductPharmaceutical"))
24500      return parseMedicinalProductPharmaceutical(json);
24501    else if (t.equals("MessageDefinition"))
24502      return parseMessageDefinition(json);
24503    else if (t.equals("MessageHeader"))
24504      return parseMessageHeader(json);
24505    else if (t.equals("NamingSystem"))
24506      return parseNamingSystem(json);
24507    else if (t.equals("NutritionOrder"))
24508      return parseNutritionOrder(json);
24509    else if (t.equals("Observation"))
24510      return parseObservation(json);
24511    else if (t.equals("ObservationDefinition"))
24512      return parseObservationDefinition(json);
24513    else if (t.equals("OccupationalData"))
24514      return parseOccupationalData(json);
24515    else if (t.equals("OperationDefinition"))
24516      return parseOperationDefinition(json);
24517    else if (t.equals("OperationOutcome"))
24518      return parseOperationOutcome(json);
24519    else if (t.equals("Organization"))
24520      return parseOrganization(json);
24521    else if (t.equals("OrganizationRole"))
24522      return parseOrganizationRole(json);
24523    else if (t.equals("Patient"))
24524      return parsePatient(json);
24525    else if (t.equals("PaymentNotice"))
24526      return parsePaymentNotice(json);
24527    else if (t.equals("PaymentReconciliation"))
24528      return parsePaymentReconciliation(json);
24529    else if (t.equals("Person"))
24530      return parsePerson(json);
24531    else if (t.equals("PlanDefinition"))
24532      return parsePlanDefinition(json);
24533    else if (t.equals("Practitioner"))
24534      return parsePractitioner(json);
24535    else if (t.equals("PractitionerRole"))
24536      return parsePractitionerRole(json);
24537    else if (t.equals("Procedure"))
24538      return parseProcedure(json);
24539    else if (t.equals("ProcessRequest"))
24540      return parseProcessRequest(json);
24541    else if (t.equals("ProcessResponse"))
24542      return parseProcessResponse(json);
24543    else if (t.equals("ProductPlan"))
24544      return parseProductPlan(json);
24545    else if (t.equals("Provenance"))
24546      return parseProvenance(json);
24547    else if (t.equals("Questionnaire"))
24548      return parseQuestionnaire(json);
24549    else if (t.equals("QuestionnaireResponse"))
24550      return parseQuestionnaireResponse(json);
24551    else if (t.equals("RelatedPerson"))
24552      return parseRelatedPerson(json);
24553    else if (t.equals("RequestGroup"))
24554      return parseRequestGroup(json);
24555    else if (t.equals("ResearchStudy"))
24556      return parseResearchStudy(json);
24557    else if (t.equals("ResearchSubject"))
24558      return parseResearchSubject(json);
24559    else if (t.equals("RiskAssessment"))
24560      return parseRiskAssessment(json);
24561    else if (t.equals("Schedule"))
24562      return parseSchedule(json);
24563    else if (t.equals("SearchParameter"))
24564      return parseSearchParameter(json);
24565    else if (t.equals("Sequence"))
24566      return parseSequence(json);
24567    else if (t.equals("ServiceRequest"))
24568      return parseServiceRequest(json);
24569    else if (t.equals("Slot"))
24570      return parseSlot(json);
24571    else if (t.equals("Specimen"))
24572      return parseSpecimen(json);
24573    else if (t.equals("SpecimenDefinition"))
24574      return parseSpecimenDefinition(json);
24575    else if (t.equals("StructureDefinition"))
24576      return parseStructureDefinition(json);
24577    else if (t.equals("StructureMap"))
24578      return parseStructureMap(json);
24579    else if (t.equals("Subscription"))
24580      return parseSubscription(json);
24581    else if (t.equals("Substance"))
24582      return parseSubstance(json);
24583    else if (t.equals("SubstancePolymer"))
24584      return parseSubstancePolymer(json);
24585    else if (t.equals("SubstanceReferenceInformation"))
24586      return parseSubstanceReferenceInformation(json);
24587    else if (t.equals("SubstanceSpecification"))
24588      return parseSubstanceSpecification(json);
24589    else if (t.equals("SupplyDelivery"))
24590      return parseSupplyDelivery(json);
24591    else if (t.equals("SupplyRequest"))
24592      return parseSupplyRequest(json);
24593    else if (t.equals("Task"))
24594      return parseTask(json);
24595    else if (t.equals("TerminologyCapabilities"))
24596      return parseTerminologyCapabilities(json);
24597    else if (t.equals("TestReport"))
24598      return parseTestReport(json);
24599    else if (t.equals("TestScript"))
24600      return parseTestScript(json);
24601    else if (t.equals("UserSession"))
24602      return parseUserSession(json);
24603    else if (t.equals("ValueSet"))
24604      return parseValueSet(json);
24605    else if (t.equals("VerificationResult"))
24606      return parseVerificationResult(json);
24607    else if (t.equals("VisionPrescription"))
24608      return parseVisionPrescription(json);
24609    else if (t.equals("Binary"))
24610      return parseBinary(json);
24611    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
24612  }
24613
24614  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
24615    if (json.has(prefix+"Extension"))
24616      return parseExtension(json.getAsJsonObject(prefix+"Extension"));
24617    else if (json.has(prefix+"Narrative"))
24618      return parseNarrative(json.getAsJsonObject(prefix+"Narrative"));
24619    else if (json.has(prefix+"Meta"))
24620      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
24621    else if (json.has(prefix+"Address"))
24622      return parseAddress(json.getAsJsonObject(prefix+"Address"));
24623    else if (json.has(prefix+"Contributor"))
24624      return parseContributor(json.getAsJsonObject(prefix+"Contributor"));
24625    else if (json.has(prefix+"Attachment"))
24626      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
24627    else if (json.has(prefix+"Count"))
24628      return parseCount(json.getAsJsonObject(prefix+"Count"));
24629    else if (json.has(prefix+"DataRequirement"))
24630      return parseDataRequirement(json.getAsJsonObject(prefix+"DataRequirement"));
24631    else if (json.has(prefix+"Dosage"))
24632      return parseDosage(json.getAsJsonObject(prefix+"Dosage"));
24633    else if (json.has(prefix+"Money"))
24634      return parseMoney(json.getAsJsonObject(prefix+"Money"));
24635    else if (json.has(prefix+"HumanName"))
24636      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
24637    else if (json.has(prefix+"ContactPoint"))
24638      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
24639    else if (json.has(prefix+"Identifier"))
24640      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
24641    else if (json.has(prefix+"Coding"))
24642      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
24643    else if (json.has(prefix+"SampledData"))
24644      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
24645    else if (json.has(prefix+"Ratio"))
24646      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
24647    else if (json.has(prefix+"Distance"))
24648      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
24649    else if (json.has(prefix+"Age"))
24650      return parseAge(json.getAsJsonObject(prefix+"Age"));
24651    else if (json.has(prefix+"Reference"))
24652      return parseReference(json.getAsJsonObject(prefix+"Reference"));
24653    else if (json.has(prefix+"TriggerDefinition"))
24654      return parseTriggerDefinition(json.getAsJsonObject(prefix+"TriggerDefinition"));
24655    else if (json.has(prefix+"Quantity"))
24656      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
24657    else if (json.has(prefix+"Period"))
24658      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
24659    else if (json.has(prefix+"Duration"))
24660      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
24661    else if (json.has(prefix+"Range"))
24662      return parseRange(json.getAsJsonObject(prefix+"Range"));
24663    else if (json.has(prefix+"RelatedArtifact"))
24664      return parseRelatedArtifact(json.getAsJsonObject(prefix+"RelatedArtifact"));
24665    else if (json.has(prefix+"Annotation"))
24666      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
24667    else if (json.has(prefix+"ContactDetail"))
24668      return parseContactDetail(json.getAsJsonObject(prefix+"ContactDetail"));
24669    else if (json.has(prefix+"UsageContext"))
24670      return parseUsageContext(json.getAsJsonObject(prefix+"UsageContext"));
24671    else if (json.has(prefix+"Signature"))
24672      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
24673    else if (json.has(prefix+"Timing"))
24674      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
24675    else if (json.has(prefix+"CodeableConcept"))
24676      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
24677    else if (json.has(prefix+"ParameterDefinition"))
24678      return parseParameterDefinition(json.getAsJsonObject(prefix+"ParameterDefinition"));
24679    else if (json.has(prefix+"SimpleQuantity"))
24680      return parseSimpleQuantity(json.getAsJsonObject(prefix+"SimpleQuantity"));
24681    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
24682      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
24683      if (json.has("_"+prefix+"Date"))
24684        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
24685      return t;
24686    }
24687    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
24688      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
24689      if (json.has("_"+prefix+"DateTime"))
24690        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
24691      return t;
24692    }
24693    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
24694      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
24695      if (json.has("_"+prefix+"Code"))
24696        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
24697      return t;
24698    }
24699    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
24700      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
24701      if (json.has("_"+prefix+"String"))
24702        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
24703      return t;
24704    }
24705    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
24706      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
24707      if (json.has("_"+prefix+"Integer"))
24708        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
24709      return t;
24710    }
24711    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
24712      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
24713      if (json.has("_"+prefix+"Oid"))
24714        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
24715      return t;
24716    }
24717    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
24718      Type t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
24719      if (json.has("_"+prefix+"Canonical"))
24720        parseElementProperties(json.getAsJsonObject("_"+prefix+"Canonical"), t);
24721      return t;
24722    }
24723    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
24724      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
24725      if (json.has("_"+prefix+"Uri"))
24726        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
24727      return t;
24728    }
24729    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
24730      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
24731      if (json.has("_"+prefix+"Uuid"))
24732        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
24733      return t;
24734    }
24735    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
24736      Type t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
24737      if (json.has("_"+prefix+"Url"))
24738        parseElementProperties(json.getAsJsonObject("_"+prefix+"Url"), t);
24739      return t;
24740    }
24741    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
24742      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
24743      if (json.has("_"+prefix+"Instant"))
24744        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
24745      return t;
24746    }
24747    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
24748      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
24749      if (json.has("_"+prefix+"Boolean"))
24750        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
24751      return t;
24752    }
24753    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
24754      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
24755      if (json.has("_"+prefix+"Base64Binary"))
24756        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
24757      return t;
24758    }
24759    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
24760      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
24761      if (json.has("_"+prefix+"UnsignedInt"))
24762        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
24763      return t;
24764    }
24765    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
24766      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
24767      if (json.has("_"+prefix+"Markdown"))
24768        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
24769      return t;
24770    }
24771    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
24772      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
24773      if (json.has("_"+prefix+"Time"))
24774        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
24775      return t;
24776    }
24777    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
24778      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
24779      if (json.has("_"+prefix+"Id"))
24780        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
24781      return t;
24782    }
24783    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
24784      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
24785      if (json.has("_"+prefix+"PositiveInt"))
24786        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
24787      return t;
24788    }
24789    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
24790      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
24791      if (json.has("_"+prefix+"Decimal"))
24792        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
24793      return t;
24794    }
24795    return null;
24796  }
24797
24798  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
24799    if (type.equals("Extension"))
24800      return parseExtension(json);
24801    else if (type.equals("Narrative"))
24802      return parseNarrative(json);
24803    else if (type.equals("Meta"))
24804      return parseMeta(json);
24805    else if (type.equals("Address"))
24806      return parseAddress(json);
24807    else if (type.equals("Contributor"))
24808      return parseContributor(json);
24809    else if (type.equals("Attachment"))
24810      return parseAttachment(json);
24811    else if (type.equals("Count"))
24812      return parseCount(json);
24813    else if (type.equals("DataRequirement"))
24814      return parseDataRequirement(json);
24815    else if (type.equals("Dosage"))
24816      return parseDosage(json);
24817    else if (type.equals("Money"))
24818      return parseMoney(json);
24819    else if (type.equals("HumanName"))
24820      return parseHumanName(json);
24821    else if (type.equals("ContactPoint"))
24822      return parseContactPoint(json);
24823    else if (type.equals("Identifier"))
24824      return parseIdentifier(json);
24825    else if (type.equals("Coding"))
24826      return parseCoding(json);
24827    else if (type.equals("SampledData"))
24828      return parseSampledData(json);
24829    else if (type.equals("Ratio"))
24830      return parseRatio(json);
24831    else if (type.equals("Distance"))
24832      return parseDistance(json);
24833    else if (type.equals("Age"))
24834      return parseAge(json);
24835    else if (type.equals("Reference"))
24836      return parseReference(json);
24837    else if (type.equals("TriggerDefinition"))
24838      return parseTriggerDefinition(json);
24839    else if (type.equals("Quantity"))
24840      return parseQuantity(json);
24841    else if (type.equals("Period"))
24842      return parsePeriod(json);
24843    else if (type.equals("Duration"))
24844      return parseDuration(json);
24845    else if (type.equals("Range"))
24846      return parseRange(json);
24847    else if (type.equals("RelatedArtifact"))
24848      return parseRelatedArtifact(json);
24849    else if (type.equals("Annotation"))
24850      return parseAnnotation(json);
24851    else if (type.equals("ContactDetail"))
24852      return parseContactDetail(json);
24853    else if (type.equals("UsageContext"))
24854      return parseUsageContext(json);
24855    else if (type.equals("Signature"))
24856      return parseSignature(json);
24857    else if (type.equals("Timing"))
24858      return parseTiming(json);
24859    else if (type.equals("CodeableConcept"))
24860      return parseCodeableConcept(json);
24861    else if (type.equals("ParameterDefinition"))
24862      return parseParameterDefinition(json);
24863    else if (type.equals("SimpleQuantity"))
24864      return parseSimpleQuantity(json);
24865    throw new FHIRFormatError("Unknown Type "+type);
24866  }
24867
24868  @Override
24869  protected Type parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
24870    throw new UnsupportedOperationException();
24871  }
24872
24873  protected boolean hasTypeName(JsonObject json, String prefix) {
24874        if (json.has(prefix+"Extension"))
24875      return true;
24876    if (json.has(prefix+"Narrative"))
24877      return true;
24878    if (json.has(prefix+"Meta"))
24879      return true;
24880    if (json.has(prefix+"Address"))
24881      return true;
24882    if (json.has(prefix+"Contributor"))
24883      return true;
24884    if (json.has(prefix+"Attachment"))
24885      return true;
24886    if (json.has(prefix+"Count"))
24887      return true;
24888    if (json.has(prefix+"DataRequirement"))
24889      return true;
24890    if (json.has(prefix+"Dosage"))
24891      return true;
24892    if (json.has(prefix+"Money"))
24893      return true;
24894    if (json.has(prefix+"HumanName"))
24895      return true;
24896    if (json.has(prefix+"ContactPoint"))
24897      return true;
24898    if (json.has(prefix+"Identifier"))
24899      return true;
24900    if (json.has(prefix+"Coding"))
24901      return true;
24902    if (json.has(prefix+"SampledData"))
24903      return true;
24904    if (json.has(prefix+"Ratio"))
24905      return true;
24906    if (json.has(prefix+"Distance"))
24907      return true;
24908    if (json.has(prefix+"Age"))
24909      return true;
24910    if (json.has(prefix+"Reference"))
24911      return true;
24912    if (json.has(prefix+"TriggerDefinition"))
24913      return true;
24914    if (json.has(prefix+"Quantity"))
24915      return true;
24916    if (json.has(prefix+"Period"))
24917      return true;
24918    if (json.has(prefix+"Duration"))
24919      return true;
24920    if (json.has(prefix+"Range"))
24921      return true;
24922    if (json.has(prefix+"RelatedArtifact"))
24923      return true;
24924    if (json.has(prefix+"Annotation"))
24925      return true;
24926    if (json.has(prefix+"ContactDetail"))
24927      return true;
24928    if (json.has(prefix+"UsageContext"))
24929      return true;
24930    if (json.has(prefix+"Signature"))
24931      return true;
24932    if (json.has(prefix+"Timing"))
24933      return true;
24934    if (json.has(prefix+"CodeableConcept"))
24935      return true;
24936    if (json.has(prefix+"ParameterDefinition"))
24937      return true;
24938    if (json.has(prefix+"SimpleQuantity"))
24939      return true;
24940    if (json.has(prefix+"Parameters"))
24941      return true;
24942    if (json.has(prefix+"Account"))
24943      return true;
24944    if (json.has(prefix+"ActivityDefinition"))
24945      return true;
24946    if (json.has(prefix+"AdverseEvent"))
24947      return true;
24948    if (json.has(prefix+"AllergyIntolerance"))
24949      return true;
24950    if (json.has(prefix+"Appointment"))
24951      return true;
24952    if (json.has(prefix+"AppointmentResponse"))
24953      return true;
24954    if (json.has(prefix+"AuditEvent"))
24955      return true;
24956    if (json.has(prefix+"Basic"))
24957      return true;
24958    if (json.has(prefix+"Binary"))
24959      return true;
24960    if (json.has(prefix+"BiologicallyDerivedProduct"))
24961      return true;
24962    if (json.has(prefix+"BodyStructure"))
24963      return true;
24964    if (json.has(prefix+"Bundle"))
24965      return true;
24966    if (json.has(prefix+"CapabilityStatement"))
24967      return true;
24968    if (json.has(prefix+"CarePlan"))
24969      return true;
24970    if (json.has(prefix+"CareTeam"))
24971      return true;
24972    if (json.has(prefix+"ChargeItem"))
24973      return true;
24974    if (json.has(prefix+"Claim"))
24975      return true;
24976    if (json.has(prefix+"ClaimResponse"))
24977      return true;
24978    if (json.has(prefix+"ClinicalImpression"))
24979      return true;
24980    if (json.has(prefix+"CodeSystem"))
24981      return true;
24982    if (json.has(prefix+"Communication"))
24983      return true;
24984    if (json.has(prefix+"CommunicationRequest"))
24985      return true;
24986    if (json.has(prefix+"CompartmentDefinition"))
24987      return true;
24988    if (json.has(prefix+"Composition"))
24989      return true;
24990    if (json.has(prefix+"ConceptMap"))
24991      return true;
24992    if (json.has(prefix+"Condition"))
24993      return true;
24994    if (json.has(prefix+"Consent"))
24995      return true;
24996    if (json.has(prefix+"Contract"))
24997      return true;
24998    if (json.has(prefix+"Coverage"))
24999      return true;
25000    if (json.has(prefix+"DetectedIssue"))
25001      return true;
25002    if (json.has(prefix+"Device"))
25003      return true;
25004    if (json.has(prefix+"DeviceComponent"))
25005      return true;
25006    if (json.has(prefix+"DeviceMetric"))
25007      return true;
25008    if (json.has(prefix+"DeviceRequest"))
25009      return true;
25010    if (json.has(prefix+"DeviceUseStatement"))
25011      return true;
25012    if (json.has(prefix+"DiagnosticReport"))
25013      return true;
25014    if (json.has(prefix+"DocumentManifest"))
25015      return true;
25016    if (json.has(prefix+"DocumentReference"))
25017      return true;
25018    if (json.has(prefix+"EligibilityRequest"))
25019      return true;
25020    if (json.has(prefix+"EligibilityResponse"))
25021      return true;
25022    if (json.has(prefix+"Encounter"))
25023      return true;
25024    if (json.has(prefix+"Endpoint"))
25025      return true;
25026    if (json.has(prefix+"EnrollmentRequest"))
25027      return true;
25028    if (json.has(prefix+"EnrollmentResponse"))
25029      return true;
25030    if (json.has(prefix+"EntryDefinition"))
25031      return true;
25032    if (json.has(prefix+"EpisodeOfCare"))
25033      return true;
25034    if (json.has(prefix+"EventDefinition"))
25035      return true;
25036    if (json.has(prefix+"ExampleScenario"))
25037      return true;
25038    if (json.has(prefix+"ExpansionProfile"))
25039      return true;
25040    if (json.has(prefix+"ExplanationOfBenefit"))
25041      return true;
25042    if (json.has(prefix+"FamilyMemberHistory"))
25043      return true;
25044    if (json.has(prefix+"Flag"))
25045      return true;
25046    if (json.has(prefix+"Goal"))
25047      return true;
25048    if (json.has(prefix+"GraphDefinition"))
25049      return true;
25050    if (json.has(prefix+"Group"))
25051      return true;
25052    if (json.has(prefix+"GuidanceResponse"))
25053      return true;
25054    if (json.has(prefix+"HealthcareService"))
25055      return true;
25056    if (json.has(prefix+"ImagingStudy"))
25057      return true;
25058    if (json.has(prefix+"Immunization"))
25059      return true;
25060    if (json.has(prefix+"ImmunizationEvaluation"))
25061      return true;
25062    if (json.has(prefix+"ImmunizationRecommendation"))
25063      return true;
25064    if (json.has(prefix+"ImplementationGuide"))
25065      return true;
25066    if (json.has(prefix+"Invoice"))
25067      return true;
25068    if (json.has(prefix+"ItemInstance"))
25069      return true;
25070    if (json.has(prefix+"Library"))
25071      return true;
25072    if (json.has(prefix+"Linkage"))
25073      return true;
25074    if (json.has(prefix+"List"))
25075      return true;
25076    if (json.has(prefix+"Location"))
25077      return true;
25078    if (json.has(prefix+"Measure"))
25079      return true;
25080    if (json.has(prefix+"MeasureReport"))
25081      return true;
25082    if (json.has(prefix+"Media"))
25083      return true;
25084    if (json.has(prefix+"Medication"))
25085      return true;
25086    if (json.has(prefix+"MedicationAdministration"))
25087      return true;
25088    if (json.has(prefix+"MedicationDispense"))
25089      return true;
25090    if (json.has(prefix+"MedicationKnowledge"))
25091      return true;
25092    if (json.has(prefix+"MedicationRequest"))
25093      return true;
25094    if (json.has(prefix+"MedicationStatement"))
25095      return true;
25096    if (json.has(prefix+"MedicinalProduct"))
25097      return true;
25098    if (json.has(prefix+"MedicinalProductAuthorization"))
25099      return true;
25100    if (json.has(prefix+"MedicinalProductClinicals"))
25101      return true;
25102    if (json.has(prefix+"MedicinalProductDeviceSpec"))
25103      return true;
25104    if (json.has(prefix+"MedicinalProductIngredient"))
25105      return true;
25106    if (json.has(prefix+"MedicinalProductPackaged"))
25107      return true;
25108    if (json.has(prefix+"MedicinalProductPharmaceutical"))
25109      return true;
25110    if (json.has(prefix+"MessageDefinition"))
25111      return true;
25112    if (json.has(prefix+"MessageHeader"))
25113      return true;
25114    if (json.has(prefix+"NamingSystem"))
25115      return true;
25116    if (json.has(prefix+"NutritionOrder"))
25117      return true;
25118    if (json.has(prefix+"Observation"))
25119      return true;
25120    if (json.has(prefix+"ObservationDefinition"))
25121      return true;
25122    if (json.has(prefix+"OccupationalData"))
25123      return true;
25124    if (json.has(prefix+"OperationDefinition"))
25125      return true;
25126    if (json.has(prefix+"OperationOutcome"))
25127      return true;
25128    if (json.has(prefix+"Organization"))
25129      return true;
25130    if (json.has(prefix+"OrganizationRole"))
25131      return true;
25132    if (json.has(prefix+"Patient"))
25133      return true;
25134    if (json.has(prefix+"PaymentNotice"))
25135      return true;
25136    if (json.has(prefix+"PaymentReconciliation"))
25137      return true;
25138    if (json.has(prefix+"Person"))
25139      return true;
25140    if (json.has(prefix+"PlanDefinition"))
25141      return true;
25142    if (json.has(prefix+"Practitioner"))
25143      return true;
25144    if (json.has(prefix+"PractitionerRole"))
25145      return true;
25146    if (json.has(prefix+"Procedure"))
25147      return true;
25148    if (json.has(prefix+"ProcessRequest"))
25149      return true;
25150    if (json.has(prefix+"ProcessResponse"))
25151      return true;
25152    if (json.has(prefix+"ProductPlan"))
25153      return true;
25154    if (json.has(prefix+"Provenance"))
25155      return true;
25156    if (json.has(prefix+"Questionnaire"))
25157      return true;
25158    if (json.has(prefix+"QuestionnaireResponse"))
25159      return true;
25160    if (json.has(prefix+"RelatedPerson"))
25161      return true;
25162    if (json.has(prefix+"RequestGroup"))
25163      return true;
25164    if (json.has(prefix+"ResearchStudy"))
25165      return true;
25166    if (json.has(prefix+"ResearchSubject"))
25167      return true;
25168    if (json.has(prefix+"RiskAssessment"))
25169      return true;
25170    if (json.has(prefix+"Schedule"))
25171      return true;
25172    if (json.has(prefix+"SearchParameter"))
25173      return true;
25174    if (json.has(prefix+"Sequence"))
25175      return true;
25176    if (json.has(prefix+"ServiceRequest"))
25177      return true;
25178    if (json.has(prefix+"Slot"))
25179      return true;
25180    if (json.has(prefix+"Specimen"))
25181      return true;
25182    if (json.has(prefix+"SpecimenDefinition"))
25183      return true;
25184    if (json.has(prefix+"StructureDefinition"))
25185      return true;
25186    if (json.has(prefix+"StructureMap"))
25187      return true;
25188    if (json.has(prefix+"Subscription"))
25189      return true;
25190    if (json.has(prefix+"Substance"))
25191      return true;
25192    if (json.has(prefix+"SubstancePolymer"))
25193      return true;
25194    if (json.has(prefix+"SubstanceReferenceInformation"))
25195      return true;
25196    if (json.has(prefix+"SubstanceSpecification"))
25197      return true;
25198    if (json.has(prefix+"SupplyDelivery"))
25199      return true;
25200    if (json.has(prefix+"SupplyRequest"))
25201      return true;
25202    if (json.has(prefix+"Task"))
25203      return true;
25204    if (json.has(prefix+"TerminologyCapabilities"))
25205      return true;
25206    if (json.has(prefix+"TestReport"))
25207      return true;
25208    if (json.has(prefix+"TestScript"))
25209      return true;
25210    if (json.has(prefix+"UserSession"))
25211      return true;
25212    if (json.has(prefix+"ValueSet"))
25213      return true;
25214    if (json.has(prefix+"VerificationResult"))
25215      return true;
25216    if (json.has(prefix+"VisionPrescription"))
25217      return true;
25218    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
25219      return true;
25220    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
25221      return true;
25222    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
25223      return true;
25224    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
25225      return true;
25226    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
25227      return true;
25228    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
25229      return true;
25230    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
25231      return true;
25232    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
25233      return true;
25234    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
25235      return true;
25236    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
25237      return true;
25238    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
25239      return true;
25240    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
25241      return true;
25242    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
25243      return true;
25244    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
25245      return true;
25246    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
25247      return true;
25248    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
25249      return true;
25250    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
25251      return true;
25252    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
25253      return true;
25254    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
25255      return true;
25256    return false;
25257  }
25258  protected void composeElement(Element element) throws IOException {
25259    if (element.hasId())
25260      prop("id", element.getId());
25261      if (makeComments(element)) {
25262        openArray("fhir_comments");
25263        for (String s : element.getFormatCommentsPre())
25264          prop(null,  s);
25265        for (String s : element.getFormatCommentsPost())
25266          prop(null,  s);
25267         closeArray();
25268      }
25269    if (element.hasExtension()) {
25270      openArray("extension");
25271      for (Extension e : element.getExtension())
25272        composeExtension(null, e);
25273      closeArray();
25274    }
25275  }
25276
25277  protected void composeBackboneElementInner(BackboneElement element) throws IOException {
25278    composeBackbone(element);
25279  }
25280
25281  protected void composeBackbone(BackboneElement element) throws IOException {
25282    composeElement(element);
25283    if (element.hasModifierExtension()) {
25284      openArray("modifierExtension");
25285      for (Extension e : element.getModifierExtension())
25286        composeExtension(null, e);
25287      closeArray();
25288    }
25289  }
25290
25291  protected void composeBackbone(BackboneType element) throws IOException {
25292    composeElement(element);
25293    if (element.hasModifierExtension()) {
25294      openArray("modifierExtension");
25295      for (Extension e : element.getModifierExtension())
25296        composeExtension(null, e);
25297      closeArray();
25298    }
25299  }
25300
25301  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
25302    if (value != null && value.getValue() != null) {
25303      prop(name, e.toCode(value.getValue()));
25304    } else if (inArray)   
25305      writeNull(name);
25306  }    
25307
25308  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
25309    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25310      open(inArray ? null : "_"+name);
25311      composeElement(value);
25312      close();
25313    } else if (inArray)   
25314      writeNull(name);
25315  }    
25316
25317  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
25318    if (value != null && value.hasValue()) {
25319        prop(name, value.asStringValue());
25320    }    
25321    else if (inArray) 
25322      writeNull(name); 
25323  }    
25324
25325  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
25326    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25327      open(inArray ? null : "_"+name);
25328      composeElement(value);
25329      close();
25330    }
25331    else if (inArray) 
25332      writeNull(name); 
25333  }
25334
25335  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
25336    if (value != null && value.hasValue()) {
25337        prop(name, value.asStringValue());
25338    }    
25339    else if (inArray) 
25340      writeNull(name); 
25341  }    
25342
25343  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
25344    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25345      open(inArray ? null : "_"+name);
25346      composeElement(value);
25347      close();
25348    }
25349    else if (inArray) 
25350      writeNull(name); 
25351  }
25352
25353  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
25354    if (value != null && value.hasValue()) {
25355        prop(name, toString(value.getValue()));
25356    }    
25357    else if (inArray) 
25358      writeNull(name); 
25359  }    
25360
25361  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
25362    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25363      open(inArray ? null : "_"+name);
25364      composeElement(value);
25365      close();
25366    }
25367    else if (inArray) 
25368      writeNull(name); 
25369  }
25370
25371  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
25372    if (value != null && value.hasValue()) {
25373        prop(name, toString(value.getValue()));
25374    }    
25375    else if (inArray) 
25376      writeNull(name); 
25377  }    
25378
25379  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
25380    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25381      open(inArray ? null : "_"+name);
25382      composeElement(value);
25383      close();
25384    }
25385    else if (inArray) 
25386      writeNull(name); 
25387  }
25388
25389  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
25390    if (value != null && value.hasValue()) {
25391        prop(name, Integer.valueOf(value.getValue()));
25392    }    
25393    else if (inArray) 
25394      writeNull(name); 
25395  }    
25396
25397  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
25398    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25399      open(inArray ? null : "_"+name);
25400      composeElement(value);
25401      close();
25402    }
25403    else if (inArray) 
25404      writeNull(name); 
25405  }
25406
25407  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
25408    if (value != null && value.hasValue()) {
25409        prop(name, toString(value.getValue()));
25410    }    
25411    else if (inArray) 
25412      writeNull(name); 
25413  }    
25414
25415  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
25416    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25417      open(inArray ? null : "_"+name);
25418      composeElement(value);
25419      close();
25420    }
25421    else if (inArray) 
25422      writeNull(name); 
25423  }
25424
25425  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
25426    if (value != null && value.hasValue()) {
25427        prop(name, toString(value.getValue()));
25428    }    
25429    else if (inArray) 
25430      writeNull(name); 
25431  }    
25432
25433  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
25434    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25435      open(inArray ? null : "_"+name);
25436      composeElement(value);
25437      close();
25438    }
25439    else if (inArray) 
25440      writeNull(name); 
25441  }
25442
25443  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
25444    if (value != null && value.hasValue()) {
25445        prop(name, toString(value.getValue()));
25446    }    
25447    else if (inArray) 
25448      writeNull(name); 
25449  }    
25450
25451  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
25452    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25453      open(inArray ? null : "_"+name);
25454      composeElement(value);
25455      close();
25456    }
25457    else if (inArray) 
25458      writeNull(name); 
25459  }
25460
25461  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
25462    if (value != null && value.hasValue()) {
25463        prop(name, toString(value.getValue()));
25464    }    
25465    else if (inArray) 
25466      writeNull(name); 
25467  }    
25468
25469  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
25470    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25471      open(inArray ? null : "_"+name);
25472      composeElement(value);
25473      close();
25474    }
25475    else if (inArray) 
25476      writeNull(name); 
25477  }
25478
25479  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
25480    if (value != null && value.hasValue()) {
25481        prop(name, toString(value.getValue()));
25482    }    
25483    else if (inArray) 
25484      writeNull(name); 
25485  }    
25486
25487  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
25488    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25489      open(inArray ? null : "_"+name);
25490      composeElement(value);
25491      close();
25492    }
25493    else if (inArray) 
25494      writeNull(name); 
25495  }
25496
25497  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
25498    if (value != null && value.hasValue()) {
25499        prop(name, value.asStringValue());
25500    }    
25501    else if (inArray) 
25502      writeNull(name); 
25503  }    
25504
25505  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
25506    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25507      open(inArray ? null : "_"+name);
25508      composeElement(value);
25509      close();
25510    }
25511    else if (inArray) 
25512      writeNull(name); 
25513  }
25514
25515  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
25516    if (value != null && value.hasValue()) {
25517        prop(name, value.getValue());
25518    }    
25519    else if (inArray) 
25520      writeNull(name); 
25521  }    
25522
25523  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
25524    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25525      open(inArray ? null : "_"+name);
25526      composeElement(value);
25527      close();
25528    }
25529    else if (inArray) 
25530      writeNull(name); 
25531  }
25532
25533  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
25534    if (value != null && value.hasValue()) {
25535        prop(name, toString(value.getValue()));
25536    }    
25537    else if (inArray) 
25538      writeNull(name); 
25539  }    
25540
25541  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
25542    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25543      open(inArray ? null : "_"+name);
25544      composeElement(value);
25545      close();
25546    }
25547    else if (inArray) 
25548      writeNull(name); 
25549  }
25550
25551  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
25552    if (value != null && value.hasValue()) {
25553        prop(name, Integer.valueOf(value.getValue()));
25554    }    
25555    else if (inArray) 
25556      writeNull(name); 
25557  }    
25558
25559  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
25560    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25561      open(inArray ? null : "_"+name);
25562      composeElement(value);
25563      close();
25564    }
25565    else if (inArray) 
25566      writeNull(name); 
25567  }
25568
25569  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
25570    if (value != null && value.hasValue()) {
25571        prop(name, toString(value.getValue()));
25572    }    
25573    else if (inArray) 
25574      writeNull(name); 
25575  }    
25576
25577  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
25578    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25579      open(inArray ? null : "_"+name);
25580      composeElement(value);
25581      close();
25582    }
25583    else if (inArray) 
25584      writeNull(name); 
25585  }
25586
25587  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
25588    if (value != null && value.hasValue()) {
25589        prop(name, value.asStringValue());
25590    }    
25591    else if (inArray) 
25592      writeNull(name); 
25593  }    
25594
25595  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
25596    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25597      open(inArray ? null : "_"+name);
25598      composeElement(value);
25599      close();
25600    }
25601    else if (inArray) 
25602      writeNull(name); 
25603  }
25604
25605  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
25606    if (value != null && value.hasValue()) {
25607        prop(name, toString(value.getValue()));
25608    }    
25609    else if (inArray) 
25610      writeNull(name); 
25611  }    
25612
25613  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
25614    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25615      open(inArray ? null : "_"+name);
25616      composeElement(value);
25617      close();
25618    }
25619    else if (inArray) 
25620      writeNull(name); 
25621  }
25622
25623  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
25624    if (value != null && value.hasValue()) {
25625        prop(name, Integer.valueOf(value.getValue()));
25626    }    
25627    else if (inArray) 
25628      writeNull(name); 
25629  }    
25630
25631  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
25632    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25633      open(inArray ? null : "_"+name);
25634      composeElement(value);
25635      close();
25636    }
25637    else if (inArray) 
25638      writeNull(name); 
25639  }
25640
25641  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
25642    if (value != null && value.hasValue()) {
25643        prop(name, value.getValue());
25644    }    
25645    else if (inArray) 
25646      writeNull(name); 
25647  }    
25648
25649  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
25650    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
25651      open(inArray ? null : "_"+name);
25652      composeElement(value);
25653      close();
25654    }
25655    else if (inArray) 
25656      writeNull(name); 
25657  }
25658
25659  protected void composeExtension(String name, Extension element) throws IOException {
25660    if (element != null) {
25661      open(name);
25662      composeExtensionInner(element);
25663      close();
25664    }
25665  }
25666
25667  protected void composeExtensionInner(Extension element) throws IOException {
25668      composeElement(element);
25669      if (element.hasUrlElement()) {
25670        composeUriCore("url", element.getUrlElement(), false);
25671        composeUriExtras("url", element.getUrlElement(), false);
25672      }
25673      if (element.hasValue()) {
25674        composeType("value", element.getValue());
25675      }
25676  }
25677
25678  protected void composeNarrative(String name, Narrative element) throws IOException {
25679    if (element != null) {
25680      open(name);
25681      composeNarrativeInner(element);
25682      close();
25683    }
25684  }
25685
25686  protected void composeNarrativeInner(Narrative element) throws IOException {
25687      composeElement(element);
25688      if (element.hasStatusElement()) {
25689        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
25690        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
25691      }
25692      if (element.hasDiv()) {
25693        XhtmlNode node = element.getDiv();
25694        if (node.getNsDecl() == null) {
25695          node.attribute("xmlns", XHTML_NS);
25696        }
25697        composeXhtml("div", node);
25698      }
25699  }
25700
25701  protected void composeCount(String name, Count element) throws IOException {
25702    if (element != null) {
25703      open(name);
25704      composeCountInner(element);
25705      close();
25706    }
25707  }
25708
25709  protected void composeCountInner(Count element) throws IOException {
25710      composeQuantityInner(element);
25711  }
25712
25713  protected void composeMoney(String name, Money element) throws IOException {
25714    if (element != null) {
25715      open(name);
25716      composeMoneyInner(element);
25717      close();
25718    }
25719  }
25720
25721  protected void composeMoneyInner(Money element) throws IOException {
25722      composeQuantityInner(element);
25723  }
25724
25725  protected void composeDistance(String name, Distance element) throws IOException {
25726    if (element != null) {
25727      open(name);
25728      composeDistanceInner(element);
25729      close();
25730    }
25731  }
25732
25733  protected void composeDistanceInner(Distance element) throws IOException {
25734      composeQuantityInner(element);
25735  }
25736
25737  protected void composeAge(String name, Age element) throws IOException {
25738    if (element != null) {
25739      open(name);
25740      composeAgeInner(element);
25741      close();
25742    }
25743  }
25744
25745  protected void composeAgeInner(Age element) throws IOException {
25746      composeQuantityInner(element);
25747  }
25748
25749  protected void composeDuration(String name, Duration element) throws IOException {
25750    if (element != null) {
25751      open(name);
25752      composeDurationInner(element);
25753      close();
25754    }
25755  }
25756
25757  protected void composeDurationInner(Duration element) throws IOException {
25758      composeQuantityInner(element);
25759  }
25760
25761  protected void composeMeta(String name, Meta element) throws IOException {
25762    if (element != null) {
25763      open(name);
25764      composeMetaInner(element);
25765      close();
25766    }
25767  }
25768
25769  protected void composeMetaInner(Meta element) throws IOException {
25770      composeElement(element);
25771      if (element.hasVersionIdElement()) {
25772        composeIdCore("versionId", element.getVersionIdElement(), false);
25773        composeIdExtras("versionId", element.getVersionIdElement(), false);
25774      }
25775      if (element.hasLastUpdatedElement()) {
25776        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
25777        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
25778      }
25779      if (element.hasSourceElement()) {
25780        composeUriCore("source", element.getSourceElement(), false);
25781        composeUriExtras("source", element.getSourceElement(), false);
25782      }
25783      if (element.hasProfile()) {
25784        openArray("profile");
25785        for (CanonicalType e : element.getProfile()) 
25786          composeCanonicalCore(null, e, true);
25787        closeArray();
25788        if (anyHasExtras(element.getProfile())) {
25789          openArray("_profile");
25790          for (CanonicalType e : element.getProfile()) 
25791            composeCanonicalExtras(null, e, true);
25792          closeArray();
25793        }
25794      };
25795      if (element.hasSecurity()) {
25796        openArray("security");
25797        for (Coding e : element.getSecurity()) 
25798          composeCoding(null, e);
25799        closeArray();
25800      };
25801      if (element.hasTag()) {
25802        openArray("tag");
25803        for (Coding e : element.getTag()) 
25804          composeCoding(null, e);
25805        closeArray();
25806      };
25807  }
25808
25809  protected void composeAddress(String name, Address element) throws IOException {
25810    if (element != null) {
25811      open(name);
25812      composeAddressInner(element);
25813      close();
25814    }
25815  }
25816
25817  protected void composeAddressInner(Address element) throws IOException {
25818      composeElement(element);
25819      if (element.hasUseElement()) {
25820        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
25821        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
25822      }
25823      if (element.hasTypeElement()) {
25824        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
25825        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
25826      }
25827      if (element.hasTextElement()) {
25828        composeStringCore("text", element.getTextElement(), false);
25829        composeStringExtras("text", element.getTextElement(), false);
25830      }
25831      if (element.hasLine()) {
25832        openArray("line");
25833        for (StringType e : element.getLine()) 
25834          composeStringCore(null, e, true);
25835        closeArray();
25836        if (anyHasExtras(element.getLine())) {
25837          openArray("_line");
25838          for (StringType e : element.getLine()) 
25839            composeStringExtras(null, e, true);
25840          closeArray();
25841        }
25842      };
25843      if (element.hasCityElement()) {
25844        composeStringCore("city", element.getCityElement(), false);
25845        composeStringExtras("city", element.getCityElement(), false);
25846      }
25847      if (element.hasDistrictElement()) {
25848        composeStringCore("district", element.getDistrictElement(), false);
25849        composeStringExtras("district", element.getDistrictElement(), false);
25850      }
25851      if (element.hasStateElement()) {
25852        composeStringCore("state", element.getStateElement(), false);
25853        composeStringExtras("state", element.getStateElement(), false);
25854      }
25855      if (element.hasPostalCodeElement()) {
25856        composeStringCore("postalCode", element.getPostalCodeElement(), false);
25857        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
25858      }
25859      if (element.hasCountryElement()) {
25860        composeStringCore("country", element.getCountryElement(), false);
25861        composeStringExtras("country", element.getCountryElement(), false);
25862      }
25863      if (element.hasPeriod()) {
25864        composePeriod("period", element.getPeriod());
25865      }
25866  }
25867
25868  protected void composeContributor(String name, Contributor element) throws IOException {
25869    if (element != null) {
25870      open(name);
25871      composeContributorInner(element);
25872      close();
25873    }
25874  }
25875
25876  protected void composeContributorInner(Contributor element) throws IOException {
25877      composeElement(element);
25878      if (element.hasTypeElement()) {
25879        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
25880        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
25881      }
25882      if (element.hasNameElement()) {
25883        composeStringCore("name", element.getNameElement(), false);
25884        composeStringExtras("name", element.getNameElement(), false);
25885      }
25886      if (element.hasContact()) {
25887        openArray("contact");
25888        for (ContactDetail e : element.getContact()) 
25889          composeContactDetail(null, e);
25890        closeArray();
25891      };
25892  }
25893
25894  protected void composeAttachment(String name, Attachment element) throws IOException {
25895    if (element != null) {
25896      open(name);
25897      composeAttachmentInner(element);
25898      close();
25899    }
25900  }
25901
25902  protected void composeAttachmentInner(Attachment element) throws IOException {
25903      composeElement(element);
25904      if (element.hasContentTypeElement()) {
25905        composeCodeCore("contentType", element.getContentTypeElement(), false);
25906        composeCodeExtras("contentType", element.getContentTypeElement(), false);
25907      }
25908      if (element.hasLanguageElement()) {
25909        composeCodeCore("language", element.getLanguageElement(), false);
25910        composeCodeExtras("language", element.getLanguageElement(), false);
25911      }
25912      if (element.hasDataElement()) {
25913        composeBase64BinaryCore("data", element.getDataElement(), false);
25914        composeBase64BinaryExtras("data", element.getDataElement(), false);
25915      }
25916      if (element.hasUrlElement()) {
25917        composeUrlCore("url", element.getUrlElement(), false);
25918        composeUrlExtras("url", element.getUrlElement(), false);
25919      }
25920      if (element.hasSizeElement()) {
25921        composeUnsignedIntCore("size", element.getSizeElement(), false);
25922        composeUnsignedIntExtras("size", element.getSizeElement(), false);
25923      }
25924      if (element.hasHashElement()) {
25925        composeBase64BinaryCore("hash", element.getHashElement(), false);
25926        composeBase64BinaryExtras("hash", element.getHashElement(), false);
25927      }
25928      if (element.hasTitleElement()) {
25929        composeStringCore("title", element.getTitleElement(), false);
25930        composeStringExtras("title", element.getTitleElement(), false);
25931      }
25932      if (element.hasCreationElement()) {
25933        composeDateTimeCore("creation", element.getCreationElement(), false);
25934        composeDateTimeExtras("creation", element.getCreationElement(), false);
25935      }
25936  }
25937
25938  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
25939    if (element != null) {
25940      open(name);
25941      composeDataRequirementInner(element);
25942      close();
25943    }
25944  }
25945
25946  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
25947      composeElement(element);
25948      if (element.hasTypeElement()) {
25949        composeCodeCore("type", element.getTypeElement(), false);
25950        composeCodeExtras("type", element.getTypeElement(), false);
25951      }
25952      if (element.hasProfile()) {
25953        openArray("profile");
25954        for (CanonicalType e : element.getProfile()) 
25955          composeCanonicalCore(null, e, true);
25956        closeArray();
25957        if (anyHasExtras(element.getProfile())) {
25958          openArray("_profile");
25959          for (CanonicalType e : element.getProfile()) 
25960            composeCanonicalExtras(null, e, true);
25961          closeArray();
25962        }
25963      };
25964      if (element.hasSubject()) {
25965        composeType("subject", element.getSubject());
25966      }
25967      if (element.hasMustSupport()) {
25968        openArray("mustSupport");
25969        for (StringType e : element.getMustSupport()) 
25970          composeStringCore(null, e, true);
25971        closeArray();
25972        if (anyHasExtras(element.getMustSupport())) {
25973          openArray("_mustSupport");
25974          for (StringType e : element.getMustSupport()) 
25975            composeStringExtras(null, e, true);
25976          closeArray();
25977        }
25978      };
25979      if (element.hasCodeFilter()) {
25980        openArray("codeFilter");
25981        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
25982          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
25983        closeArray();
25984      };
25985      if (element.hasDateFilter()) {
25986        openArray("dateFilter");
25987        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
25988          composeDataRequirementDataRequirementDateFilterComponent(null, e);
25989        closeArray();
25990      };
25991      if (element.hasLimitElement()) {
25992        composePositiveIntCore("limit", element.getLimitElement(), false);
25993        composePositiveIntExtras("limit", element.getLimitElement(), false);
25994      }
25995      if (element.hasSort()) {
25996        openArray("sort");
25997        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
25998          composeDataRequirementDataRequirementSortComponent(null, e);
25999        closeArray();
26000      };
26001  }
26002
26003  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
26004    if (element != null) {
26005      open(name);
26006      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
26007      close();
26008    }
26009  }
26010
26011  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
26012      composeElement(element);
26013      if (element.hasPathElement()) {
26014        composeStringCore("path", element.getPathElement(), false);
26015        composeStringExtras("path", element.getPathElement(), false);
26016      }
26017      if (element.hasValueSet()) {
26018        composeType("valueSet", element.getValueSet());
26019      }
26020      if (element.hasCode()) {
26021        openArray("code");
26022        for (Coding e : element.getCode()) 
26023          composeCoding(null, e);
26024        closeArray();
26025      };
26026  }
26027
26028  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
26029    if (element != null) {
26030      open(name);
26031      composeDataRequirementDataRequirementDateFilterComponentInner(element);
26032      close();
26033    }
26034  }
26035
26036  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
26037      composeElement(element);
26038      if (element.hasPathElement()) {
26039        composeStringCore("path", element.getPathElement(), false);
26040        composeStringExtras("path", element.getPathElement(), false);
26041      }
26042      if (element.hasValue()) {
26043        composeType("value", element.getValue());
26044      }
26045  }
26046
26047  protected void composeDataRequirementDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
26048    if (element != null) {
26049      open(name);
26050      composeDataRequirementDataRequirementSortComponentInner(element);
26051      close();
26052    }
26053  }
26054
26055  protected void composeDataRequirementDataRequirementSortComponentInner(DataRequirement.DataRequirementSortComponent element) throws IOException {
26056      composeElement(element);
26057      if (element.hasPathElement()) {
26058        composeStringCore("path", element.getPathElement(), false);
26059        composeStringExtras("path", element.getPathElement(), false);
26060      }
26061      if (element.hasDirectionElement()) {
26062        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
26063        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
26064      }
26065  }
26066
26067  protected void composeDosage(String name, Dosage element) throws IOException {
26068    if (element != null) {
26069      open(name);
26070      composeDosageInner(element);
26071      close();
26072    }
26073  }
26074
26075  protected void composeDosageInner(Dosage element) throws IOException {
26076      composeBackbone(element);
26077      if (element.hasSequenceElement()) {
26078        composeIntegerCore("sequence", element.getSequenceElement(), false);
26079        composeIntegerExtras("sequence", element.getSequenceElement(), false);
26080      }
26081      if (element.hasTextElement()) {
26082        composeStringCore("text", element.getTextElement(), false);
26083        composeStringExtras("text", element.getTextElement(), false);
26084      }
26085      if (element.hasAdditionalInstruction()) {
26086        openArray("additionalInstruction");
26087        for (CodeableConcept e : element.getAdditionalInstruction()) 
26088          composeCodeableConcept(null, e);
26089        closeArray();
26090      };
26091      if (element.hasPatientInstructionElement()) {
26092        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
26093        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
26094      }
26095      if (element.hasTiming()) {
26096        composeTiming("timing", element.getTiming());
26097      }
26098      if (element.hasAsNeeded()) {
26099        composeType("asNeeded", element.getAsNeeded());
26100      }
26101      if (element.hasSite()) {
26102        composeCodeableConcept("site", element.getSite());
26103      }
26104      if (element.hasRoute()) {
26105        composeCodeableConcept("route", element.getRoute());
26106      }
26107      if (element.hasMethod()) {
26108        composeCodeableConcept("method", element.getMethod());
26109      }
26110      if (element.hasDoseAndRate()) {
26111        openArray("doseAndRate");
26112        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
26113          composeDosageDosageDoseAndRateComponent(null, e);
26114        closeArray();
26115      };
26116      if (element.hasMaxDosePerPeriod()) {
26117        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
26118      }
26119      if (element.hasMaxDosePerAdministration()) {
26120        composeSimpleQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
26121      }
26122      if (element.hasMaxDosePerLifetime()) {
26123        composeSimpleQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
26124      }
26125  }
26126
26127  protected void composeDosageDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
26128    if (element != null) {
26129      open(name);
26130      composeDosageDosageDoseAndRateComponentInner(element);
26131      close();
26132    }
26133  }
26134
26135  protected void composeDosageDosageDoseAndRateComponentInner(Dosage.DosageDoseAndRateComponent element) throws IOException {
26136      composeElement(element);
26137      if (element.hasType()) {
26138        composeCodeableConcept("type", element.getType());
26139      }
26140      if (element.hasDose()) {
26141        composeType("dose", element.getDose());
26142      }
26143      if (element.hasRate()) {
26144        composeType("rate", element.getRate());
26145      }
26146  }
26147
26148  protected void composeHumanName(String name, HumanName element) throws IOException {
26149    if (element != null) {
26150      open(name);
26151      composeHumanNameInner(element);
26152      close();
26153    }
26154  }
26155
26156  protected void composeHumanNameInner(HumanName element) throws IOException {
26157      composeElement(element);
26158      if (element.hasUseElement()) {
26159        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
26160        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
26161      }
26162      if (element.hasTextElement()) {
26163        composeStringCore("text", element.getTextElement(), false);
26164        composeStringExtras("text", element.getTextElement(), false);
26165      }
26166      if (element.hasFamilyElement()) {
26167        composeStringCore("family", element.getFamilyElement(), false);
26168        composeStringExtras("family", element.getFamilyElement(), false);
26169      }
26170      if (element.hasGiven()) {
26171        openArray("given");
26172        for (StringType e : element.getGiven()) 
26173          composeStringCore(null, e, true);
26174        closeArray();
26175        if (anyHasExtras(element.getGiven())) {
26176          openArray("_given");
26177          for (StringType e : element.getGiven()) 
26178            composeStringExtras(null, e, true);
26179          closeArray();
26180        }
26181      };
26182      if (element.hasPrefix()) {
26183        openArray("prefix");
26184        for (StringType e : element.getPrefix()) 
26185          composeStringCore(null, e, true);
26186        closeArray();
26187        if (anyHasExtras(element.getPrefix())) {
26188          openArray("_prefix");
26189          for (StringType e : element.getPrefix()) 
26190            composeStringExtras(null, e, true);
26191          closeArray();
26192        }
26193      };
26194      if (element.hasSuffix()) {
26195        openArray("suffix");
26196        for (StringType e : element.getSuffix()) 
26197          composeStringCore(null, e, true);
26198        closeArray();
26199        if (anyHasExtras(element.getSuffix())) {
26200          openArray("_suffix");
26201          for (StringType e : element.getSuffix()) 
26202            composeStringExtras(null, e, true);
26203          closeArray();
26204        }
26205      };
26206      if (element.hasPeriod()) {
26207        composePeriod("period", element.getPeriod());
26208      }
26209  }
26210
26211  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
26212    if (element != null) {
26213      open(name);
26214      composeContactPointInner(element);
26215      close();
26216    }
26217  }
26218
26219  protected void composeContactPointInner(ContactPoint element) throws IOException {
26220      composeElement(element);
26221      if (element.hasSystemElement()) {
26222        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
26223        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
26224      }
26225      if (element.hasValueElement()) {
26226        composeStringCore("value", element.getValueElement(), false);
26227        composeStringExtras("value", element.getValueElement(), false);
26228      }
26229      if (element.hasUseElement()) {
26230        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
26231        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
26232      }
26233      if (element.hasRankElement()) {
26234        composePositiveIntCore("rank", element.getRankElement(), false);
26235        composePositiveIntExtras("rank", element.getRankElement(), false);
26236      }
26237      if (element.hasPeriod()) {
26238        composePeriod("period", element.getPeriod());
26239      }
26240  }
26241
26242  protected void composeIdentifier(String name, Identifier element) throws IOException {
26243    if (element != null) {
26244      open(name);
26245      composeIdentifierInner(element);
26246      close();
26247    }
26248  }
26249
26250  protected void composeIdentifierInner(Identifier element) throws IOException {
26251      composeElement(element);
26252      if (element.hasUseElement()) {
26253        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
26254        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
26255      }
26256      if (element.hasType()) {
26257        composeCodeableConcept("type", element.getType());
26258      }
26259      if (element.hasSystemElement()) {
26260        composeUriCore("system", element.getSystemElement(), false);
26261        composeUriExtras("system", element.getSystemElement(), false);
26262      }
26263      if (element.hasValueElement()) {
26264        composeStringCore("value", element.getValueElement(), false);
26265        composeStringExtras("value", element.getValueElement(), false);
26266      }
26267      if (element.hasPeriod()) {
26268        composePeriod("period", element.getPeriod());
26269      }
26270      if (element.hasAssigner()) {
26271        composeReference("assigner", element.getAssigner());
26272      }
26273  }
26274
26275  protected void composeCoding(String name, Coding element) throws IOException {
26276    if (element != null) {
26277      open(name);
26278      composeCodingInner(element);
26279      close();
26280    }
26281  }
26282
26283  protected void composeCodingInner(Coding element) throws IOException {
26284      composeElement(element);
26285      if (element.hasSystemElement()) {
26286        composeUriCore("system", element.getSystemElement(), false);
26287        composeUriExtras("system", element.getSystemElement(), false);
26288      }
26289      if (element.hasVersionElement()) {
26290        composeStringCore("version", element.getVersionElement(), false);
26291        composeStringExtras("version", element.getVersionElement(), false);
26292      }
26293      if (element.hasCodeElement()) {
26294        composeCodeCore("code", element.getCodeElement(), false);
26295        composeCodeExtras("code", element.getCodeElement(), false);
26296      }
26297      if (element.hasDisplayElement()) {
26298        composeStringCore("display", element.getDisplayElement(), false);
26299        composeStringExtras("display", element.getDisplayElement(), false);
26300      }
26301      if (element.hasUserSelectedElement()) {
26302        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
26303        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
26304      }
26305  }
26306
26307  protected void composeSampledData(String name, SampledData element) throws IOException {
26308    if (element != null) {
26309      open(name);
26310      composeSampledDataInner(element);
26311      close();
26312    }
26313  }
26314
26315  protected void composeSampledDataInner(SampledData element) throws IOException {
26316      composeElement(element);
26317      if (element.hasOrigin()) {
26318        composeSimpleQuantity("origin", element.getOrigin());
26319      }
26320      if (element.hasPeriodElement()) {
26321        composeDecimalCore("period", element.getPeriodElement(), false);
26322        composeDecimalExtras("period", element.getPeriodElement(), false);
26323      }
26324      if (element.hasFactorElement()) {
26325        composeDecimalCore("factor", element.getFactorElement(), false);
26326        composeDecimalExtras("factor", element.getFactorElement(), false);
26327      }
26328      if (element.hasLowerLimitElement()) {
26329        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
26330        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
26331      }
26332      if (element.hasUpperLimitElement()) {
26333        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
26334        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
26335      }
26336      if (element.hasDimensionsElement()) {
26337        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
26338        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
26339      }
26340      if (element.hasDataElement()) {
26341        composeStringCore("data", element.getDataElement(), false);
26342        composeStringExtras("data", element.getDataElement(), false);
26343      }
26344  }
26345
26346  protected void composeRatio(String name, Ratio element) throws IOException {
26347    if (element != null) {
26348      open(name);
26349      composeRatioInner(element);
26350      close();
26351    }
26352  }
26353
26354  protected void composeRatioInner(Ratio element) throws IOException {
26355      composeElement(element);
26356      if (element.hasNumerator()) {
26357        composeQuantity("numerator", element.getNumerator());
26358      }
26359      if (element.hasDenominator()) {
26360        composeQuantity("denominator", element.getDenominator());
26361      }
26362  }
26363
26364  protected void composeReference(String name, Reference element) throws IOException {
26365    if (element != null) {
26366      open(name);
26367      composeReferenceInner(element);
26368      close();
26369    }
26370  }
26371
26372  protected void composeReferenceInner(Reference element) throws IOException {
26373      composeElement(element);
26374      if (element.hasReferenceElement()) {
26375        composeStringCore("reference", element.getReferenceElement(), false);
26376        composeStringExtras("reference", element.getReferenceElement(), false);
26377      }
26378      if (element.hasTypeElement()) {
26379        composeUriCore("type", element.getTypeElement(), false);
26380        composeUriExtras("type", element.getTypeElement(), false);
26381      }
26382      if (element.hasIdentifier()) {
26383        composeIdentifier("identifier", element.getIdentifier());
26384      }
26385      if (element.hasDisplayElement()) {
26386        composeStringCore("display", element.getDisplayElement(), false);
26387        composeStringExtras("display", element.getDisplayElement(), false);
26388      }
26389  }
26390
26391  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
26392    if (element != null) {
26393      open(name);
26394      composeTriggerDefinitionInner(element);
26395      close();
26396    }
26397  }
26398
26399  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
26400      composeElement(element);
26401      if (element.hasTypeElement()) {
26402        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
26403        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
26404      }
26405      if (element.hasNameElement()) {
26406        composeStringCore("name", element.getNameElement(), false);
26407        composeStringExtras("name", element.getNameElement(), false);
26408      }
26409      if (element.hasTiming()) {
26410        composeType("timing", element.getTiming());
26411      }
26412      if (element.hasData()) {
26413        composeDataRequirement("data", element.getData());
26414      }
26415      if (element.hasCondition()) {
26416        composeTriggerDefinitionTriggerDefinitionConditionComponent("condition", element.getCondition());
26417      }
26418  }
26419
26420  protected void composeTriggerDefinitionTriggerDefinitionConditionComponent(String name, TriggerDefinition.TriggerDefinitionConditionComponent element) throws IOException {
26421    if (element != null) {
26422      open(name);
26423      composeTriggerDefinitionTriggerDefinitionConditionComponentInner(element);
26424      close();
26425    }
26426  }
26427
26428  protected void composeTriggerDefinitionTriggerDefinitionConditionComponentInner(TriggerDefinition.TriggerDefinitionConditionComponent element) throws IOException {
26429      composeElement(element);
26430      if (element.hasDescriptionElement()) {
26431        composeStringCore("description", element.getDescriptionElement(), false);
26432        composeStringExtras("description", element.getDescriptionElement(), false);
26433      }
26434      if (element.hasLanguageElement()) {
26435        composeEnumerationCore("language", element.getLanguageElement(), new TriggerDefinition.ExpressionLanguageEnumFactory(), false);
26436        composeEnumerationExtras("language", element.getLanguageElement(), new TriggerDefinition.ExpressionLanguageEnumFactory(), false);
26437      }
26438      if (element.hasExpressionElement()) {
26439        composeStringCore("expression", element.getExpressionElement(), false);
26440        composeStringExtras("expression", element.getExpressionElement(), false);
26441      }
26442  }
26443
26444  protected void composeQuantity(String name, Quantity element) throws IOException {
26445    if (element != null) {
26446      open(name);
26447      composeQuantityInner(element);
26448      close();
26449    }
26450  }
26451
26452  protected void composeQuantityInner(Quantity element) throws IOException {
26453      composeElement(element);
26454      if (element.hasValueElement()) {
26455        composeDecimalCore("value", element.getValueElement(), false);
26456        composeDecimalExtras("value", element.getValueElement(), false);
26457      }
26458      if (element.hasComparatorElement()) {
26459        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
26460        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
26461      }
26462      if (element.hasUnitElement()) {
26463        composeStringCore("unit", element.getUnitElement(), false);
26464        composeStringExtras("unit", element.getUnitElement(), false);
26465      }
26466      if (element.hasSystemElement()) {
26467        composeUriCore("system", element.getSystemElement(), false);
26468        composeUriExtras("system", element.getSystemElement(), false);
26469      }
26470      if (element.hasCodeElement()) {
26471        composeCodeCore("code", element.getCodeElement(), false);
26472        composeCodeExtras("code", element.getCodeElement(), false);
26473      }
26474  }
26475
26476  protected void composePeriod(String name, Period element) throws IOException {
26477    if (element != null) {
26478      open(name);
26479      composePeriodInner(element);
26480      close();
26481    }
26482  }
26483
26484  protected void composePeriodInner(Period element) throws IOException {
26485      composeElement(element);
26486      if (element.hasStartElement()) {
26487        composeDateTimeCore("start", element.getStartElement(), false);
26488        composeDateTimeExtras("start", element.getStartElement(), false);
26489      }
26490      if (element.hasEndElement()) {
26491        composeDateTimeCore("end", element.getEndElement(), false);
26492        composeDateTimeExtras("end", element.getEndElement(), false);
26493      }
26494  }
26495
26496  protected void composeRange(String name, Range element) throws IOException {
26497    if (element != null) {
26498      open(name);
26499      composeRangeInner(element);
26500      close();
26501    }
26502  }
26503
26504  protected void composeRangeInner(Range element) throws IOException {
26505      composeElement(element);
26506      if (element.hasLow()) {
26507        composeSimpleQuantity("low", element.getLow());
26508      }
26509      if (element.hasHigh()) {
26510        composeSimpleQuantity("high", element.getHigh());
26511      }
26512  }
26513
26514  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
26515    if (element != null) {
26516      open(name);
26517      composeRelatedArtifactInner(element);
26518      close();
26519    }
26520  }
26521
26522  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
26523      composeElement(element);
26524      if (element.hasTypeElement()) {
26525        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
26526        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
26527      }
26528      if (element.hasDisplayElement()) {
26529        composeStringCore("display", element.getDisplayElement(), false);
26530        composeStringExtras("display", element.getDisplayElement(), false);
26531      }
26532      if (element.hasCitationElement()) {
26533        composeStringCore("citation", element.getCitationElement(), false);
26534        composeStringExtras("citation", element.getCitationElement(), false);
26535      }
26536      if (element.hasUrlElement()) {
26537        composeUrlCore("url", element.getUrlElement(), false);
26538        composeUrlExtras("url", element.getUrlElement(), false);
26539      }
26540      if (element.hasDocument()) {
26541        composeAttachment("document", element.getDocument());
26542      }
26543      if (element.hasResourceElement()) {
26544        composeCanonicalCore("resource", element.getResourceElement(), false);
26545        composeCanonicalExtras("resource", element.getResourceElement(), false);
26546      }
26547  }
26548
26549  protected void composeAnnotation(String name, Annotation element) throws IOException {
26550    if (element != null) {
26551      open(name);
26552      composeAnnotationInner(element);
26553      close();
26554    }
26555  }
26556
26557  protected void composeAnnotationInner(Annotation element) throws IOException {
26558      composeElement(element);
26559      if (element.hasAuthor()) {
26560        composeType("author", element.getAuthor());
26561      }
26562      if (element.hasTimeElement()) {
26563        composeDateTimeCore("time", element.getTimeElement(), false);
26564        composeDateTimeExtras("time", element.getTimeElement(), false);
26565      }
26566      if (element.hasTextElement()) {
26567        composeStringCore("text", element.getTextElement(), false);
26568        composeStringExtras("text", element.getTextElement(), false);
26569      }
26570  }
26571
26572  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
26573    if (element != null) {
26574      open(name);
26575      composeContactDetailInner(element);
26576      close();
26577    }
26578  }
26579
26580  protected void composeContactDetailInner(ContactDetail element) throws IOException {
26581      composeElement(element);
26582      if (element.hasNameElement()) {
26583        composeStringCore("name", element.getNameElement(), false);
26584        composeStringExtras("name", element.getNameElement(), false);
26585      }
26586      if (element.hasTelecom()) {
26587        openArray("telecom");
26588        for (ContactPoint e : element.getTelecom()) 
26589          composeContactPoint(null, e);
26590        closeArray();
26591      };
26592  }
26593
26594  protected void composeUsageContext(String name, UsageContext element) throws IOException {
26595    if (element != null) {
26596      open(name);
26597      composeUsageContextInner(element);
26598      close();
26599    }
26600  }
26601
26602  protected void composeUsageContextInner(UsageContext element) throws IOException {
26603      composeElement(element);
26604      if (element.hasCode()) {
26605        composeCoding("code", element.getCode());
26606      }
26607      if (element.hasValue()) {
26608        composeType("value", element.getValue());
26609      }
26610  }
26611
26612  protected void composeSignature(String name, Signature element) throws IOException {
26613    if (element != null) {
26614      open(name);
26615      composeSignatureInner(element);
26616      close();
26617    }
26618  }
26619
26620  protected void composeSignatureInner(Signature element) throws IOException {
26621      composeElement(element);
26622      if (element.hasType()) {
26623        openArray("type");
26624        for (Coding e : element.getType()) 
26625          composeCoding(null, e);
26626        closeArray();
26627      };
26628      if (element.hasWhenElement()) {
26629        composeInstantCore("when", element.getWhenElement(), false);
26630        composeInstantExtras("when", element.getWhenElement(), false);
26631      }
26632      if (element.hasWho()) {
26633        composeType("who", element.getWho());
26634      }
26635      if (element.hasOnBehalfOf()) {
26636        composeType("onBehalfOf", element.getOnBehalfOf());
26637      }
26638      if (element.hasTargetFormatElement()) {
26639        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
26640        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
26641      }
26642      if (element.hasSigFormatElement()) {
26643        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
26644        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
26645      }
26646      if (element.hasBlobElement()) {
26647        composeBase64BinaryCore("blob", element.getBlobElement(), false);
26648        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
26649      }
26650  }
26651
26652  protected void composeTiming(String name, Timing element) throws IOException {
26653    if (element != null) {
26654      open(name);
26655      composeTimingInner(element);
26656      close();
26657    }
26658  }
26659
26660  protected void composeTimingInner(Timing element) throws IOException {
26661      composeBackbone(element);
26662      if (element.hasEvent()) {
26663        openArray("event");
26664        for (DateTimeType e : element.getEvent()) 
26665          composeDateTimeCore(null, e, true);
26666        closeArray();
26667        if (anyHasExtras(element.getEvent())) {
26668          openArray("_event");
26669          for (DateTimeType e : element.getEvent()) 
26670            composeDateTimeExtras(null, e, true);
26671          closeArray();
26672        }
26673      };
26674      if (element.hasRepeat()) {
26675        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
26676      }
26677      if (element.hasCode()) {
26678        composeCodeableConcept("code", element.getCode());
26679      }
26680  }
26681
26682  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
26683    if (element != null) {
26684      open(name);
26685      composeTimingTimingRepeatComponentInner(element);
26686      close();
26687    }
26688  }
26689
26690  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
26691      composeElement(element);
26692      if (element.hasBounds()) {
26693        composeType("bounds", element.getBounds());
26694      }
26695      if (element.hasCountElement()) {
26696        composeIntegerCore("count", element.getCountElement(), false);
26697        composeIntegerExtras("count", element.getCountElement(), false);
26698      }
26699      if (element.hasCountMaxElement()) {
26700        composeIntegerCore("countMax", element.getCountMaxElement(), false);
26701        composeIntegerExtras("countMax", element.getCountMaxElement(), false);
26702      }
26703      if (element.hasDurationElement()) {
26704        composeDecimalCore("duration", element.getDurationElement(), false);
26705        composeDecimalExtras("duration", element.getDurationElement(), false);
26706      }
26707      if (element.hasDurationMaxElement()) {
26708        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
26709        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
26710      }
26711      if (element.hasDurationUnitElement()) {
26712        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
26713        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
26714      }
26715      if (element.hasFrequencyElement()) {
26716        composeIntegerCore("frequency", element.getFrequencyElement(), false);
26717        composeIntegerExtras("frequency", element.getFrequencyElement(), false);
26718      }
26719      if (element.hasFrequencyMaxElement()) {
26720        composeIntegerCore("frequencyMax", element.getFrequencyMaxElement(), false);
26721        composeIntegerExtras("frequencyMax", element.getFrequencyMaxElement(), false);
26722      }
26723      if (element.hasPeriodElement()) {
26724        composeDecimalCore("period", element.getPeriodElement(), false);
26725        composeDecimalExtras("period", element.getPeriodElement(), false);
26726      }
26727      if (element.hasPeriodMaxElement()) {
26728        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
26729        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
26730      }
26731      if (element.hasPeriodUnitElement()) {
26732        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
26733        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
26734      }
26735      if (element.hasDayOfWeek()) {
26736        openArray("dayOfWeek");
26737        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
26738          composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
26739        closeArray();
26740        if (anyHasExtras(element.getDayOfWeek())) {
26741          openArray("_dayOfWeek");
26742          for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
26743            composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
26744          closeArray();
26745        }
26746      };
26747      if (element.hasTimeOfDay()) {
26748        openArray("timeOfDay");
26749        for (TimeType e : element.getTimeOfDay()) 
26750          composeTimeCore(null, e, true);
26751        closeArray();
26752        if (anyHasExtras(element.getTimeOfDay())) {
26753          openArray("_timeOfDay");
26754          for (TimeType e : element.getTimeOfDay()) 
26755            composeTimeExtras(null, e, true);
26756          closeArray();
26757        }
26758      };
26759      if (element.hasWhen()) {
26760        openArray("when");
26761        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
26762          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
26763        closeArray();
26764        if (anyHasExtras(element.getWhen())) {
26765          openArray("_when");
26766          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
26767            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
26768          closeArray();
26769        }
26770      };
26771      if (element.hasOffsetElement()) {
26772        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
26773        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
26774      }
26775  }
26776
26777  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
26778    if (element != null) {
26779      open(name);
26780      composeCodeableConceptInner(element);
26781      close();
26782    }
26783  }
26784
26785  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
26786      composeElement(element);
26787      if (element.hasCoding()) {
26788        openArray("coding");
26789        for (Coding e : element.getCoding()) 
26790          composeCoding(null, e);
26791        closeArray();
26792      };
26793      if (element.hasTextElement()) {
26794        composeStringCore("text", element.getTextElement(), false);
26795        composeStringExtras("text", element.getTextElement(), false);
26796      }
26797  }
26798
26799  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
26800    if (element != null) {
26801      open(name);
26802      composeParameterDefinitionInner(element);
26803      close();
26804    }
26805  }
26806
26807  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
26808      composeElement(element);
26809      if (element.hasNameElement()) {
26810        composeCodeCore("name", element.getNameElement(), false);
26811        composeCodeExtras("name", element.getNameElement(), false);
26812      }
26813      if (element.hasUseElement()) {
26814        composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
26815        composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
26816      }
26817      if (element.hasMinElement()) {
26818        composeIntegerCore("min", element.getMinElement(), false);
26819        composeIntegerExtras("min", element.getMinElement(), false);
26820      }
26821      if (element.hasMaxElement()) {
26822        composeStringCore("max", element.getMaxElement(), false);
26823        composeStringExtras("max", element.getMaxElement(), false);
26824      }
26825      if (element.hasDocumentationElement()) {
26826        composeStringCore("documentation", element.getDocumentationElement(), false);
26827        composeStringExtras("documentation", element.getDocumentationElement(), false);
26828      }
26829      if (element.hasTypeElement()) {
26830        composeCodeCore("type", element.getTypeElement(), false);
26831        composeCodeExtras("type", element.getTypeElement(), false);
26832      }
26833      if (element.hasProfileElement()) {
26834        composeCanonicalCore("profile", element.getProfileElement(), false);
26835        composeCanonicalExtras("profile", element.getProfileElement(), false);
26836      }
26837  }
26838
26839  protected void composeSimpleQuantity(String name, SimpleQuantity element) throws IOException {
26840    if (element != null) {
26841      open(name);
26842      composeSimpleQuantityInner(element);
26843      close();
26844    }
26845  }
26846
26847  protected void composeSimpleQuantityInner(SimpleQuantity element) throws IOException {
26848      composeElement(element);
26849      if (element.hasValueElement()) {
26850        composeDecimalCore("value", element.getValueElement(), false);
26851        composeDecimalExtras("value", element.getValueElement(), false);
26852      }
26853      if (element.hasComparatorElement()) {
26854        composeEnumerationCore("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
26855        composeEnumerationExtras("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
26856      }
26857      if (element.hasUnitElement()) {
26858        composeStringCore("unit", element.getUnitElement(), false);
26859        composeStringExtras("unit", element.getUnitElement(), false);
26860      }
26861      if (element.hasSystemElement()) {
26862        composeUriCore("system", element.getSystemElement(), false);
26863        composeUriExtras("system", element.getSystemElement(), false);
26864      }
26865      if (element.hasCodeElement()) {
26866        composeCodeCore("code", element.getCodeElement(), false);
26867        composeCodeExtras("code", element.getCodeElement(), false);
26868      }
26869  }
26870
26871  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
26872    if (element != null) {
26873      open(name);
26874      composeMarketingStatusInner(element);
26875      close();
26876    }
26877  }
26878
26879  protected void composeMarketingStatusInner(MarketingStatus element) throws IOException {
26880      composeBackboneElementInner(element);
26881      if (element.hasCountry()) {
26882        composeCodeableConcept("country", element.getCountry());
26883      }
26884      if (element.hasJurisdiction()) {
26885        composeCodeableConcept("jurisdiction", element.getJurisdiction());
26886      }
26887      if (element.hasStatus()) {
26888        composeCodeableConcept("status", element.getStatus());
26889      }
26890      if (element.hasDateRange()) {
26891        composePeriod("dateRange", element.getDateRange());
26892      }
26893      if (element.hasRestoreDateElement()) {
26894        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
26895        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
26896      }
26897  }
26898
26899  protected void composeSubstanceAmount(String name, SubstanceAmount element) throws IOException {
26900    if (element != null) {
26901      open(name);
26902      composeSubstanceAmountInner(element);
26903      close();
26904    }
26905  }
26906
26907  protected void composeSubstanceAmountInner(SubstanceAmount element) throws IOException {
26908      composeBackboneElementInner(element);
26909      if (element.hasAmount()) {
26910        composeType("amount", element.getAmount());
26911      }
26912      if (element.hasAmountType()) {
26913        composeCodeableConcept("amountType", element.getAmountType());
26914      }
26915      if (element.hasAmountTextElement()) {
26916        composeStringCore("amountText", element.getAmountTextElement(), false);
26917        composeStringExtras("amountText", element.getAmountTextElement(), false);
26918      }
26919      if (element.hasReferenceRange()) {
26920        composeSubstanceAmountSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
26921      }
26922  }
26923
26924  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponent(String name, SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
26925    if (element != null) {
26926      open(name);
26927      composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(element);
26928      close();
26929    }
26930  }
26931
26932  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
26933      composeElement(element);
26934      if (element.hasLowLimit()) {
26935        composeQuantity("lowLimit", element.getLowLimit());
26936      }
26937      if (element.hasHighLimit()) {
26938        composeQuantity("highLimit", element.getHighLimit());
26939      }
26940  }
26941
26942  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
26943    if (element != null) {
26944      open(name);
26945      composeElementDefinitionInner(element);
26946      close();
26947    }
26948  }
26949
26950  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
26951      composeBackbone(element);
26952      if (element.hasPathElement()) {
26953        composeStringCore("path", element.getPathElement(), false);
26954        composeStringExtras("path", element.getPathElement(), false);
26955      }
26956      if (element.hasRepresentation()) {
26957        openArray("representation");
26958        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
26959          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
26960        closeArray();
26961        if (anyHasExtras(element.getRepresentation())) {
26962          openArray("_representation");
26963          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
26964            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
26965          closeArray();
26966        }
26967      };
26968      if (element.hasSliceNameElement()) {
26969        composeStringCore("sliceName", element.getSliceNameElement(), false);
26970        composeStringExtras("sliceName", element.getSliceNameElement(), false);
26971      }
26972      if (element.hasLabelElement()) {
26973        composeStringCore("label", element.getLabelElement(), false);
26974        composeStringExtras("label", element.getLabelElement(), false);
26975      }
26976      if (element.hasCode()) {
26977        openArray("code");
26978        for (Coding e : element.getCode()) 
26979          composeCoding(null, e);
26980        closeArray();
26981      };
26982      if (element.hasSlicing()) {
26983        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
26984      }
26985      if (element.hasShortElement()) {
26986        composeStringCore("short", element.getShortElement(), false);
26987        composeStringExtras("short", element.getShortElement(), false);
26988      }
26989      if (element.hasDefinitionElement()) {
26990        composeMarkdownCore("definition", element.getDefinitionElement(), false);
26991        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
26992      }
26993      if (element.hasCommentElement()) {
26994        composeMarkdownCore("comment", element.getCommentElement(), false);
26995        composeMarkdownExtras("comment", element.getCommentElement(), false);
26996      }
26997      if (element.hasRequirementsElement()) {
26998        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
26999        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
27000      }
27001      if (element.hasAlias()) {
27002        openArray("alias");
27003        for (StringType e : element.getAlias()) 
27004          composeStringCore(null, e, true);
27005        closeArray();
27006        if (anyHasExtras(element.getAlias())) {
27007          openArray("_alias");
27008          for (StringType e : element.getAlias()) 
27009            composeStringExtras(null, e, true);
27010          closeArray();
27011        }
27012      };
27013      if (element.hasMinElement()) {
27014        composeUnsignedIntCore("min", element.getMinElement(), false);
27015        composeUnsignedIntExtras("min", element.getMinElement(), false);
27016      }
27017      if (element.hasMaxElement()) {
27018        composeStringCore("max", element.getMaxElement(), false);
27019        composeStringExtras("max", element.getMaxElement(), false);
27020      }
27021      if (element.hasBase()) {
27022        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
27023      }
27024      if (element.hasContentReferenceElement()) {
27025        composeUriCore("contentReference", element.getContentReferenceElement(), false);
27026        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
27027      }
27028      if (element.hasType()) {
27029        openArray("type");
27030        for (ElementDefinition.TypeRefComponent e : element.getType()) 
27031          composeElementDefinitionTypeRefComponent(null, e);
27032        closeArray();
27033      };
27034      if (element.hasDefaultValue()) {
27035        composeType("defaultValue", element.getDefaultValue());
27036      }
27037      if (element.hasMeaningWhenMissingElement()) {
27038        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
27039        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
27040      }
27041      if (element.hasOrderMeaningElement()) {
27042        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
27043        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
27044      }
27045      if (element.hasFixed()) {
27046        composeType("fixed", element.getFixed());
27047      }
27048      if (element.hasPattern()) {
27049        composeType("pattern", element.getPattern());
27050      }
27051      if (element.hasExample()) {
27052        openArray("example");
27053        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
27054          composeElementDefinitionElementDefinitionExampleComponent(null, e);
27055        closeArray();
27056      };
27057      if (element.hasMinValue()) {
27058        composeType("minValue", element.getMinValue());
27059      }
27060      if (element.hasMaxValue()) {
27061        composeType("maxValue", element.getMaxValue());
27062      }
27063      if (element.hasMaxLengthElement()) {
27064        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
27065        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
27066      }
27067      if (element.hasCondition()) {
27068        openArray("condition");
27069        for (IdType e : element.getCondition()) 
27070          composeIdCore(null, e, true);
27071        closeArray();
27072        if (anyHasExtras(element.getCondition())) {
27073          openArray("_condition");
27074          for (IdType e : element.getCondition()) 
27075            composeIdExtras(null, e, true);
27076          closeArray();
27077        }
27078      };
27079      if (element.hasConstraint()) {
27080        openArray("constraint");
27081        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
27082          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
27083        closeArray();
27084      };
27085      if (element.hasMustSupportElement()) {
27086        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
27087        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
27088      }
27089      if (element.hasIsModifierElement()) {
27090        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
27091        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
27092      }
27093      if (element.hasIsModifierReasonElement()) {
27094        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
27095        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
27096      }
27097      if (element.hasIsSummaryElement()) {
27098        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
27099        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
27100      }
27101      if (element.hasBinding()) {
27102        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
27103      }
27104      if (element.hasMapping()) {
27105        openArray("mapping");
27106        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
27107          composeElementDefinitionElementDefinitionMappingComponent(null, e);
27108        closeArray();
27109      };
27110  }
27111
27112  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
27113    if (element != null) {
27114      open(name);
27115      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
27116      close();
27117    }
27118  }
27119
27120  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
27121      composeElement(element);
27122      if (element.hasDiscriminator()) {
27123        openArray("discriminator");
27124        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
27125          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
27126        closeArray();
27127      };
27128      if (element.hasDescriptionElement()) {
27129        composeStringCore("description", element.getDescriptionElement(), false);
27130        composeStringExtras("description", element.getDescriptionElement(), false);
27131      }
27132      if (element.hasOrderedElement()) {
27133        composeBooleanCore("ordered", element.getOrderedElement(), false);
27134        composeBooleanExtras("ordered", element.getOrderedElement(), false);
27135      }
27136      if (element.hasRulesElement()) {
27137        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
27138        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
27139      }
27140  }
27141
27142  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
27143    if (element != null) {
27144      open(name);
27145      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
27146      close();
27147    }
27148  }
27149
27150  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
27151      composeElement(element);
27152      if (element.hasTypeElement()) {
27153        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
27154        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
27155      }
27156      if (element.hasPathElement()) {
27157        composeStringCore("path", element.getPathElement(), false);
27158        composeStringExtras("path", element.getPathElement(), false);
27159      }
27160  }
27161
27162  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
27163    if (element != null) {
27164      open(name);
27165      composeElementDefinitionElementDefinitionBaseComponentInner(element);
27166      close();
27167    }
27168  }
27169
27170  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
27171      composeElement(element);
27172      if (element.hasPathElement()) {
27173        composeStringCore("path", element.getPathElement(), false);
27174        composeStringExtras("path", element.getPathElement(), false);
27175      }
27176      if (element.hasMinElement()) {
27177        composeUnsignedIntCore("min", element.getMinElement(), false);
27178        composeUnsignedIntExtras("min", element.getMinElement(), false);
27179      }
27180      if (element.hasMaxElement()) {
27181        composeStringCore("max", element.getMaxElement(), false);
27182        composeStringExtras("max", element.getMaxElement(), false);
27183      }
27184  }
27185
27186  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
27187    if (element != null) {
27188      open(name);
27189      composeElementDefinitionTypeRefComponentInner(element);
27190      close();
27191    }
27192  }
27193
27194  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
27195      composeElement(element);
27196      if (element.hasCodeElement()) {
27197        composeUriCore("code", element.getCodeElement(), false);
27198        composeUriExtras("code", element.getCodeElement(), false);
27199      }
27200      if (element.hasProfile()) {
27201        openArray("profile");
27202        for (CanonicalType e : element.getProfile()) 
27203          composeCanonicalCore(null, e, true);
27204        closeArray();
27205        if (anyHasExtras(element.getProfile())) {
27206          openArray("_profile");
27207          for (CanonicalType e : element.getProfile()) 
27208            composeCanonicalExtras(null, e, true);
27209          closeArray();
27210        }
27211      };
27212      if (element.hasTargetProfile()) {
27213        openArray("targetProfile");
27214        for (CanonicalType e : element.getTargetProfile()) 
27215          composeCanonicalCore(null, e, true);
27216        closeArray();
27217        if (anyHasExtras(element.getTargetProfile())) {
27218          openArray("_targetProfile");
27219          for (CanonicalType e : element.getTargetProfile()) 
27220            composeCanonicalExtras(null, e, true);
27221          closeArray();
27222        }
27223      };
27224      if (element.hasAggregation()) {
27225        openArray("aggregation");
27226        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
27227          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
27228        closeArray();
27229        if (anyHasExtras(element.getAggregation())) {
27230          openArray("_aggregation");
27231          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
27232            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
27233          closeArray();
27234        }
27235      };
27236      if (element.hasVersioningElement()) {
27237        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
27238        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
27239      }
27240  }
27241
27242  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
27243    if (element != null) {
27244      open(name);
27245      composeElementDefinitionElementDefinitionExampleComponentInner(element);
27246      close();
27247    }
27248  }
27249
27250  protected void composeElementDefinitionElementDefinitionExampleComponentInner(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
27251      composeElement(element);
27252      if (element.hasLabelElement()) {
27253        composeStringCore("label", element.getLabelElement(), false);
27254        composeStringExtras("label", element.getLabelElement(), false);
27255      }
27256      if (element.hasValue()) {
27257        composeType("value", element.getValue());
27258      }
27259  }
27260
27261  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
27262    if (element != null) {
27263      open(name);
27264      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
27265      close();
27266    }
27267  }
27268
27269  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
27270      composeElement(element);
27271      if (element.hasKeyElement()) {
27272        composeIdCore("key", element.getKeyElement(), false);
27273        composeIdExtras("key", element.getKeyElement(), false);
27274      }
27275      if (element.hasRequirementsElement()) {
27276        composeStringCore("requirements", element.getRequirementsElement(), false);
27277        composeStringExtras("requirements", element.getRequirementsElement(), false);
27278      }
27279      if (element.hasSeverityElement()) {
27280        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
27281        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
27282      }
27283      if (element.hasHumanElement()) {
27284        composeStringCore("human", element.getHumanElement(), false);
27285        composeStringExtras("human", element.getHumanElement(), false);
27286      }
27287      if (element.hasExpressionElement()) {
27288        composeStringCore("expression", element.getExpressionElement(), false);
27289        composeStringExtras("expression", element.getExpressionElement(), false);
27290      }
27291      if (element.hasXpathElement()) {
27292        composeStringCore("xpath", element.getXpathElement(), false);
27293        composeStringExtras("xpath", element.getXpathElement(), false);
27294      }
27295      if (element.hasSourceElement()) {
27296        composeCanonicalCore("source", element.getSourceElement(), false);
27297        composeCanonicalExtras("source", element.getSourceElement(), false);
27298      }
27299  }
27300
27301  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
27302    if (element != null) {
27303      open(name);
27304      composeElementDefinitionElementDefinitionBindingComponentInner(element);
27305      close();
27306    }
27307  }
27308
27309  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
27310      composeElement(element);
27311      if (element.hasStrengthElement()) {
27312        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
27313        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
27314      }
27315      if (element.hasDescriptionElement()) {
27316        composeStringCore("description", element.getDescriptionElement(), false);
27317        composeStringExtras("description", element.getDescriptionElement(), false);
27318      }
27319      if (element.hasValueSet()) {
27320        composeType("valueSet", element.getValueSet());
27321      }
27322  }
27323
27324  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
27325    if (element != null) {
27326      open(name);
27327      composeElementDefinitionElementDefinitionMappingComponentInner(element);
27328      close();
27329    }
27330  }
27331
27332  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
27333      composeElement(element);
27334      if (element.hasIdentityElement()) {
27335        composeIdCore("identity", element.getIdentityElement(), false);
27336        composeIdExtras("identity", element.getIdentityElement(), false);
27337      }
27338      if (element.hasLanguageElement()) {
27339        composeCodeCore("language", element.getLanguageElement(), false);
27340        composeCodeExtras("language", element.getLanguageElement(), false);
27341      }
27342      if (element.hasMapElement()) {
27343        composeStringCore("map", element.getMapElement(), false);
27344        composeStringExtras("map", element.getMapElement(), false);
27345      }
27346      if (element.hasCommentElement()) {
27347        composeStringCore("comment", element.getCommentElement(), false);
27348        composeStringExtras("comment", element.getCommentElement(), false);
27349      }
27350  }
27351
27352  protected void composeSubstanceMoiety(String name, SubstanceMoiety element) throws IOException {
27353    if (element != null) {
27354      open(name);
27355      composeSubstanceMoietyInner(element);
27356      close();
27357    }
27358  }
27359
27360  protected void composeSubstanceMoietyInner(SubstanceMoiety element) throws IOException {
27361      composeBackboneElementInner(element);
27362      if (element.hasRole()) {
27363        composeCodeableConcept("role", element.getRole());
27364      }
27365      if (element.hasIdentifier()) {
27366        composeIdentifier("identifier", element.getIdentifier());
27367      }
27368      if (element.hasNameElement()) {
27369        composeStringCore("name", element.getNameElement(), false);
27370        composeStringExtras("name", element.getNameElement(), false);
27371      }
27372      if (element.hasStereochemistry()) {
27373        composeCodeableConcept("stereochemistry", element.getStereochemistry());
27374      }
27375      if (element.hasOpticalActivity()) {
27376        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
27377      }
27378      if (element.hasMolecularFormulaElement()) {
27379        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
27380        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
27381      }
27382      if (element.hasAmount()) {
27383        composeSubstanceAmount("amount", element.getAmount());
27384      }
27385  }
27386
27387  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
27388    if (element != null) {
27389      open(name);
27390      composeProductShelfLifeInner(element);
27391      close();
27392    }
27393  }
27394
27395  protected void composeProductShelfLifeInner(ProductShelfLife element) throws IOException {
27396      composeBackboneElementInner(element);
27397      if (element.hasIdentifier()) {
27398        composeIdentifier("identifier", element.getIdentifier());
27399      }
27400      if (element.hasType()) {
27401        composeCodeableConcept("type", element.getType());
27402      }
27403      if (element.hasPeriod()) {
27404        composeQuantity("period", element.getPeriod());
27405      }
27406      if (element.hasSpecialPrecautionsForStorage()) {
27407        openArray("specialPrecautionsForStorage");
27408        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
27409          composeCodeableConcept(null, e);
27410        closeArray();
27411      };
27412  }
27413
27414  protected void composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
27415    if (element != null) {
27416      open(name);
27417      composeProdCharacteristicInner(element);
27418      close();
27419    }
27420  }
27421
27422  protected void composeProdCharacteristicInner(ProdCharacteristic element) throws IOException {
27423      composeBackboneElementInner(element);
27424      if (element.hasHeight()) {
27425        composeQuantity("height", element.getHeight());
27426      }
27427      if (element.hasWidth()) {
27428        composeQuantity("width", element.getWidth());
27429      }
27430      if (element.hasDepth()) {
27431        composeQuantity("depth", element.getDepth());
27432      }
27433      if (element.hasWeight()) {
27434        composeQuantity("weight", element.getWeight());
27435      }
27436      if (element.hasNominalVolume()) {
27437        composeQuantity("nominalVolume", element.getNominalVolume());
27438      }
27439      if (element.hasExternalDiameter()) {
27440        composeQuantity("externalDiameter", element.getExternalDiameter());
27441      }
27442      if (element.hasShapeElement()) {
27443        composeStringCore("shape", element.getShapeElement(), false);
27444        composeStringExtras("shape", element.getShapeElement(), false);
27445      }
27446      if (element.hasColor()) {
27447        openArray("color");
27448        for (StringType e : element.getColor()) 
27449          composeStringCore(null, e, true);
27450        closeArray();
27451        if (anyHasExtras(element.getColor())) {
27452          openArray("_color");
27453          for (StringType e : element.getColor()) 
27454            composeStringExtras(null, e, true);
27455          closeArray();
27456        }
27457      };
27458      if (element.hasImprint()) {
27459        openArray("imprint");
27460        for (StringType e : element.getImprint()) 
27461          composeStringCore(null, e, true);
27462        closeArray();
27463        if (anyHasExtras(element.getImprint())) {
27464          openArray("_imprint");
27465          for (StringType e : element.getImprint()) 
27466            composeStringExtras(null, e, true);
27467          closeArray();
27468        }
27469      };
27470      if (element.hasImage()) {
27471        openArray("image");
27472        for (Attachment e : element.getImage()) 
27473          composeAttachment(null, e);
27474        closeArray();
27475      };
27476      if (element.hasScoring()) {
27477        composeCodeableConcept("scoring", element.getScoring());
27478      }
27479  }
27480
27481  protected void composeDomainResourceElements(DomainResource element) throws IOException {
27482      composeResourceElements(element);
27483      if (element.hasText()) {
27484        composeNarrative("text", element.getText());
27485      }
27486      if (element.hasContained()) {
27487        openArray("contained");
27488        for (Resource e : element.getContained()) {
27489          open(null);
27490          composeResource(e);
27491          close();
27492        }
27493        closeArray();
27494      };
27495      if (element.hasExtension()) {
27496        openArray("extension");
27497        for (Extension e : element.getExtension()) 
27498          composeExtension(null, e);
27499        closeArray();
27500      };
27501      if (element.hasModifierExtension()) {
27502        openArray("modifierExtension");
27503        for (Extension e : element.getModifierExtension()) 
27504          composeExtension(null, e);
27505        closeArray();
27506      };
27507  }
27508
27509  protected void composeParameters(String name, Parameters element) throws IOException {
27510    if (element != null) {
27511      prop("resourceType", name);
27512      composeParametersInner(element);
27513    }
27514  }
27515
27516  protected void composeParametersInner(Parameters element) throws IOException {
27517      composeResourceElements(element);
27518      if (element.hasParameter()) {
27519        openArray("parameter");
27520        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
27521          composeParametersParametersParameterComponent(null, e);
27522        closeArray();
27523      };
27524  }
27525
27526  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
27527    if (element != null) {
27528      open(name);
27529      composeParametersParametersParameterComponentInner(element);
27530      close();
27531    }
27532  }
27533
27534  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
27535      composeBackbone(element);
27536      if (element.hasNameElement()) {
27537        composeStringCore("name", element.getNameElement(), false);
27538        composeStringExtras("name", element.getNameElement(), false);
27539      }
27540      if (element.hasValue()) {
27541        composeType("value", element.getValue());
27542      }
27543        if (element.hasResource()) {
27544          open("resource");
27545          composeResource(element.getResource());
27546          close();
27547        }
27548      if (element.hasPart()) {
27549        openArray("part");
27550        for (Parameters.ParametersParameterComponent e : element.getPart()) 
27551          composeParametersParametersParameterComponent(null, e);
27552        closeArray();
27553      };
27554  }
27555
27556  protected void composeResourceElements(Resource element) throws IOException {
27557      if (element.hasIdElement()) {
27558        composeIdCore("id", element.getIdElement(), false);
27559        composeIdExtras("id", element.getIdElement(), false);
27560      }
27561      if (element.hasMeta()) {
27562        composeMeta("meta", element.getMeta());
27563      }
27564      if (element.hasImplicitRulesElement()) {
27565        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
27566        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
27567      }
27568      if (element.hasLanguageElement()) {
27569        composeCodeCore("language", element.getLanguageElement(), false);
27570        composeCodeExtras("language", element.getLanguageElement(), false);
27571      }
27572  }
27573
27574  protected void composeAccount(String name, Account element) throws IOException {
27575    if (element != null) {
27576      prop("resourceType", name);
27577      composeAccountInner(element);
27578    }
27579  }
27580
27581  protected void composeAccountInner(Account element) throws IOException {
27582      composeDomainResourceElements(element);
27583      if (element.hasIdentifier()) {
27584        openArray("identifier");
27585        for (Identifier e : element.getIdentifier()) 
27586          composeIdentifier(null, e);
27587        closeArray();
27588      };
27589      if (element.hasStatusElement()) {
27590        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
27591        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
27592      }
27593      if (element.hasType()) {
27594        composeCodeableConcept("type", element.getType());
27595      }
27596      if (element.hasNameElement()) {
27597        composeStringCore("name", element.getNameElement(), false);
27598        composeStringExtras("name", element.getNameElement(), false);
27599      }
27600      if (element.hasSubject()) {
27601        composeReference("subject", element.getSubject());
27602      }
27603      if (element.hasServicePeriod()) {
27604        composePeriod("servicePeriod", element.getServicePeriod());
27605      }
27606      if (element.hasCoverage()) {
27607        openArray("coverage");
27608        for (Account.CoverageComponent e : element.getCoverage()) 
27609          composeAccountCoverageComponent(null, e);
27610        closeArray();
27611      };
27612      if (element.hasOwner()) {
27613        composeReference("owner", element.getOwner());
27614      }
27615      if (element.hasDescriptionElement()) {
27616        composeStringCore("description", element.getDescriptionElement(), false);
27617        composeStringExtras("description", element.getDescriptionElement(), false);
27618      }
27619      if (element.hasGuarantor()) {
27620        openArray("guarantor");
27621        for (Account.GuarantorComponent e : element.getGuarantor()) 
27622          composeAccountGuarantorComponent(null, e);
27623        closeArray();
27624      };
27625      if (element.hasPartOf()) {
27626        composeReference("partOf", element.getPartOf());
27627      }
27628  }
27629
27630  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
27631    if (element != null) {
27632      open(name);
27633      composeAccountCoverageComponentInner(element);
27634      close();
27635    }
27636  }
27637
27638  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
27639      composeBackbone(element);
27640      if (element.hasCoverage()) {
27641        composeReference("coverage", element.getCoverage());
27642      }
27643      if (element.hasPriorityElement()) {
27644        composePositiveIntCore("priority", element.getPriorityElement(), false);
27645        composePositiveIntExtras("priority", element.getPriorityElement(), false);
27646      }
27647  }
27648
27649  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
27650    if (element != null) {
27651      open(name);
27652      composeAccountGuarantorComponentInner(element);
27653      close();
27654    }
27655  }
27656
27657  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
27658      composeBackbone(element);
27659      if (element.hasParty()) {
27660        composeReference("party", element.getParty());
27661      }
27662      if (element.hasOnHoldElement()) {
27663        composeBooleanCore("onHold", element.getOnHoldElement(), false);
27664        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
27665      }
27666      if (element.hasPeriod()) {
27667        composePeriod("period", element.getPeriod());
27668      }
27669  }
27670
27671  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
27672    if (element != null) {
27673      prop("resourceType", name);
27674      composeActivityDefinitionInner(element);
27675    }
27676  }
27677
27678  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
27679      composeDomainResourceElements(element);
27680      if (element.hasUrlElement()) {
27681        composeUriCore("url", element.getUrlElement(), false);
27682        composeUriExtras("url", element.getUrlElement(), false);
27683      }
27684      if (element.hasIdentifier()) {
27685        openArray("identifier");
27686        for (Identifier e : element.getIdentifier()) 
27687          composeIdentifier(null, e);
27688        closeArray();
27689      };
27690      if (element.hasVersionElement()) {
27691        composeStringCore("version", element.getVersionElement(), false);
27692        composeStringExtras("version", element.getVersionElement(), false);
27693      }
27694      if (element.hasNameElement()) {
27695        composeStringCore("name", element.getNameElement(), false);
27696        composeStringExtras("name", element.getNameElement(), false);
27697      }
27698      if (element.hasTitleElement()) {
27699        composeStringCore("title", element.getTitleElement(), false);
27700        composeStringExtras("title", element.getTitleElement(), false);
27701      }
27702      if (element.hasSubtitleElement()) {
27703        composeStringCore("subtitle", element.getSubtitleElement(), false);
27704        composeStringExtras("subtitle", element.getSubtitleElement(), false);
27705      }
27706      if (element.hasStatusElement()) {
27707        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
27708        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
27709      }
27710      if (element.hasExperimentalElement()) {
27711        composeBooleanCore("experimental", element.getExperimentalElement(), false);
27712        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
27713      }
27714      if (element.hasSubject()) {
27715        composeType("subject", element.getSubject());
27716      }
27717      if (element.hasDateElement()) {
27718        composeDateTimeCore("date", element.getDateElement(), false);
27719        composeDateTimeExtras("date", element.getDateElement(), false);
27720      }
27721      if (element.hasPublisherElement()) {
27722        composeStringCore("publisher", element.getPublisherElement(), false);
27723        composeStringExtras("publisher", element.getPublisherElement(), false);
27724      }
27725      if (element.hasContact()) {
27726        openArray("contact");
27727        for (ContactDetail e : element.getContact()) 
27728          composeContactDetail(null, e);
27729        closeArray();
27730      };
27731      if (element.hasDescriptionElement()) {
27732        composeMarkdownCore("description", element.getDescriptionElement(), false);
27733        composeMarkdownExtras("description", element.getDescriptionElement(), false);
27734      }
27735      if (element.hasUseContext()) {
27736        openArray("useContext");
27737        for (UsageContext e : element.getUseContext()) 
27738          composeUsageContext(null, e);
27739        closeArray();
27740      };
27741      if (element.hasJurisdiction()) {
27742        openArray("jurisdiction");
27743        for (CodeableConcept e : element.getJurisdiction()) 
27744          composeCodeableConcept(null, e);
27745        closeArray();
27746      };
27747      if (element.hasPurposeElement()) {
27748        composeMarkdownCore("purpose", element.getPurposeElement(), false);
27749        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
27750      }
27751      if (element.hasUsageElement()) {
27752        composeStringCore("usage", element.getUsageElement(), false);
27753        composeStringExtras("usage", element.getUsageElement(), false);
27754      }
27755      if (element.hasCopyrightElement()) {
27756        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
27757        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
27758      }
27759      if (element.hasApprovalDateElement()) {
27760        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
27761        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
27762      }
27763      if (element.hasLastReviewDateElement()) {
27764        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
27765        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
27766      }
27767      if (element.hasEffectivePeriod()) {
27768        composePeriod("effectivePeriod", element.getEffectivePeriod());
27769      }
27770      if (element.hasTopic()) {
27771        openArray("topic");
27772        for (CodeableConcept e : element.getTopic()) 
27773          composeCodeableConcept(null, e);
27774        closeArray();
27775      };
27776      if (element.hasContributor()) {
27777        openArray("contributor");
27778        for (Contributor e : element.getContributor()) 
27779          composeContributor(null, e);
27780        closeArray();
27781      };
27782      if (element.hasRelatedArtifact()) {
27783        openArray("relatedArtifact");
27784        for (RelatedArtifact e : element.getRelatedArtifact()) 
27785          composeRelatedArtifact(null, e);
27786        closeArray();
27787      };
27788      if (element.hasLibrary()) {
27789        openArray("library");
27790        for (CanonicalType e : element.getLibrary()) 
27791          composeCanonicalCore(null, e, true);
27792        closeArray();
27793        if (anyHasExtras(element.getLibrary())) {
27794          openArray("_library");
27795          for (CanonicalType e : element.getLibrary()) 
27796            composeCanonicalExtras(null, e, true);
27797          closeArray();
27798        }
27799      };
27800      if (element.hasKindElement()) {
27801        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
27802        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
27803      }
27804      if (element.hasCode()) {
27805        composeCodeableConcept("code", element.getCode());
27806      }
27807      if (element.hasDoNotPerformElement()) {
27808        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
27809        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
27810      }
27811      if (element.hasTiming()) {
27812        composeType("timing", element.getTiming());
27813      }
27814      if (element.hasLocation()) {
27815        composeReference("location", element.getLocation());
27816      }
27817      if (element.hasParticipant()) {
27818        openArray("participant");
27819        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
27820          composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
27821        closeArray();
27822      };
27823      if (element.hasProduct()) {
27824        composeType("product", element.getProduct());
27825      }
27826      if (element.hasQuantity()) {
27827        composeSimpleQuantity("quantity", element.getQuantity());
27828      }
27829      if (element.hasDosage()) {
27830        openArray("dosage");
27831        for (Dosage e : element.getDosage()) 
27832          composeDosage(null, e);
27833        closeArray();
27834      };
27835      if (element.hasBodySite()) {
27836        openArray("bodySite");
27837        for (CodeableConcept e : element.getBodySite()) 
27838          composeCodeableConcept(null, e);
27839        closeArray();
27840      };
27841      if (element.hasSpecimenRequirement()) {
27842        openArray("specimenRequirement");
27843        for (Reference e : element.getSpecimenRequirement()) 
27844          composeReference(null, e);
27845        closeArray();
27846      };
27847      if (element.hasTransformElement()) {
27848        composeCanonicalCore("transform", element.getTransformElement(), false);
27849        composeCanonicalExtras("transform", element.getTransformElement(), false);
27850      }
27851      if (element.hasDynamicValue()) {
27852        openArray("dynamicValue");
27853        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
27854          composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
27855        closeArray();
27856      };
27857  }
27858
27859  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
27860    if (element != null) {
27861      open(name);
27862      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
27863      close();
27864    }
27865  }
27866
27867  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
27868      composeBackbone(element);
27869      if (element.hasTypeElement()) {
27870        composeEnumerationCore("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
27871        composeEnumerationExtras("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
27872      }
27873      if (element.hasRole()) {
27874        composeCodeableConcept("role", element.getRole());
27875      }
27876  }
27877
27878  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
27879    if (element != null) {
27880      open(name);
27881      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
27882      close();
27883    }
27884  }
27885
27886  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
27887      composeBackbone(element);
27888      if (element.hasDescriptionElement()) {
27889        composeStringCore("description", element.getDescriptionElement(), false);
27890        composeStringExtras("description", element.getDescriptionElement(), false);
27891      }
27892      if (element.hasPathElement()) {
27893        composeStringCore("path", element.getPathElement(), false);
27894        composeStringExtras("path", element.getPathElement(), false);
27895      }
27896      if (element.hasLanguageElement()) {
27897        composeStringCore("language", element.getLanguageElement(), false);
27898        composeStringExtras("language", element.getLanguageElement(), false);
27899      }
27900      if (element.hasExpressionElement()) {
27901        composeStringCore("expression", element.getExpressionElement(), false);
27902        composeStringExtras("expression", element.getExpressionElement(), false);
27903      }
27904  }
27905
27906  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
27907    if (element != null) {
27908      prop("resourceType", name);
27909      composeAdverseEventInner(element);
27910    }
27911  }
27912
27913  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
27914      composeDomainResourceElements(element);
27915      if (element.hasIdentifier()) {
27916        composeIdentifier("identifier", element.getIdentifier());
27917      }
27918      if (element.hasActualityElement()) {
27919        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
27920        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
27921      }
27922      if (element.hasCategory()) {
27923        openArray("category");
27924        for (CodeableConcept e : element.getCategory()) 
27925          composeCodeableConcept(null, e);
27926        closeArray();
27927      };
27928      if (element.hasEvent()) {
27929        composeCodeableConcept("event", element.getEvent());
27930      }
27931      if (element.hasSubject()) {
27932        composeReference("subject", element.getSubject());
27933      }
27934      if (element.hasContext()) {
27935        composeReference("context", element.getContext());
27936      }
27937      if (element.hasDateElement()) {
27938        composeDateTimeCore("date", element.getDateElement(), false);
27939        composeDateTimeExtras("date", element.getDateElement(), false);
27940      }
27941      if (element.hasResultingCondition()) {
27942        openArray("resultingCondition");
27943        for (Reference e : element.getResultingCondition()) 
27944          composeReference(null, e);
27945        closeArray();
27946      };
27947      if (element.hasLocation()) {
27948        composeReference("location", element.getLocation());
27949      }
27950      if (element.hasSeriousness()) {
27951        composeCodeableConcept("seriousness", element.getSeriousness());
27952      }
27953      if (element.hasSeverity()) {
27954        composeCodeableConcept("severity", element.getSeverity());
27955      }
27956      if (element.hasOutcome()) {
27957        composeCodeableConcept("outcome", element.getOutcome());
27958      }
27959      if (element.hasRecorder()) {
27960        composeReference("recorder", element.getRecorder());
27961      }
27962      if (element.hasContributor()) {
27963        openArray("contributor");
27964        for (Reference e : element.getContributor()) 
27965          composeReference(null, e);
27966        closeArray();
27967      };
27968      if (element.hasSuspectEntity()) {
27969        openArray("suspectEntity");
27970        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
27971          composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
27972        closeArray();
27973      };
27974      if (element.hasSubjectMedicalHistory()) {
27975        openArray("subjectMedicalHistory");
27976        for (Reference e : element.getSubjectMedicalHistory()) 
27977          composeReference(null, e);
27978        closeArray();
27979      };
27980      if (element.hasReferenceDocument()) {
27981        openArray("referenceDocument");
27982        for (Reference e : element.getReferenceDocument()) 
27983          composeReference(null, e);
27984        closeArray();
27985      };
27986      if (element.hasStudy()) {
27987        openArray("study");
27988        for (Reference e : element.getStudy()) 
27989          composeReference(null, e);
27990        closeArray();
27991      };
27992  }
27993
27994  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
27995    if (element != null) {
27996      open(name);
27997      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
27998      close();
27999    }
28000  }
28001
28002  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
28003      composeBackbone(element);
28004      if (element.hasInstance()) {
28005        composeReference("instance", element.getInstance());
28006      }
28007      if (element.hasCausality()) {
28008        openArray("causality");
28009        for (AdverseEvent.AdverseEventSuspectEntityCausalityComponent e : element.getCausality()) 
28010          composeAdverseEventAdverseEventSuspectEntityCausalityComponent(null, e);
28011        closeArray();
28012      };
28013  }
28014
28015  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
28016    if (element != null) {
28017      open(name);
28018      composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(element);
28019      close();
28020    }
28021  }
28022
28023  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
28024      composeBackbone(element);
28025      if (element.hasAssessment()) {
28026        composeCodeableConcept("assessment", element.getAssessment());
28027      }
28028      if (element.hasProductRelatednessElement()) {
28029        composeStringCore("productRelatedness", element.getProductRelatednessElement(), false);
28030        composeStringExtras("productRelatedness", element.getProductRelatednessElement(), false);
28031      }
28032      if (element.hasAuthor()) {
28033        composeReference("author", element.getAuthor());
28034      }
28035      if (element.hasMethod()) {
28036        composeCodeableConcept("method", element.getMethod());
28037      }
28038  }
28039
28040  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
28041    if (element != null) {
28042      prop("resourceType", name);
28043      composeAllergyIntoleranceInner(element);
28044    }
28045  }
28046
28047  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
28048      composeDomainResourceElements(element);
28049      if (element.hasIdentifier()) {
28050        openArray("identifier");
28051        for (Identifier e : element.getIdentifier()) 
28052          composeIdentifier(null, e);
28053        closeArray();
28054      };
28055      if (element.hasClinicalStatusElement()) {
28056        composeEnumerationCore("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory(), false);
28057        composeEnumerationExtras("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory(), false);
28058      }
28059      if (element.hasVerificationStatusElement()) {
28060        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory(), false);
28061        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory(), false);
28062      }
28063      if (element.hasTypeElement()) {
28064        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
28065        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
28066      }
28067      if (element.hasCategory()) {
28068        openArray("category");
28069        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
28070          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
28071        closeArray();
28072        if (anyHasExtras(element.getCategory())) {
28073          openArray("_category");
28074          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
28075            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
28076          closeArray();
28077        }
28078      };
28079      if (element.hasCriticalityElement()) {
28080        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
28081        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
28082      }
28083      if (element.hasCode()) {
28084        composeCodeableConcept("code", element.getCode());
28085      }
28086      if (element.hasPatient()) {
28087        composeReference("patient", element.getPatient());
28088      }
28089      if (element.hasEncounter()) {
28090        composeReference("encounter", element.getEncounter());
28091      }
28092      if (element.hasOnset()) {
28093        composeType("onset", element.getOnset());
28094      }
28095      if (element.hasAssertedDateElement()) {
28096        composeDateTimeCore("assertedDate", element.getAssertedDateElement(), false);
28097        composeDateTimeExtras("assertedDate", element.getAssertedDateElement(), false);
28098      }
28099      if (element.hasRecorder()) {
28100        composeReference("recorder", element.getRecorder());
28101      }
28102      if (element.hasAsserter()) {
28103        composeReference("asserter", element.getAsserter());
28104      }
28105      if (element.hasLastOccurrenceElement()) {
28106        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
28107        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
28108      }
28109      if (element.hasNote()) {
28110        openArray("note");
28111        for (Annotation e : element.getNote()) 
28112          composeAnnotation(null, e);
28113        closeArray();
28114      };
28115      if (element.hasReaction()) {
28116        openArray("reaction");
28117        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
28118          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
28119        closeArray();
28120      };
28121  }
28122
28123  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
28124    if (element != null) {
28125      open(name);
28126      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
28127      close();
28128    }
28129  }
28130
28131  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
28132      composeBackbone(element);
28133      if (element.hasSubstance()) {
28134        composeCodeableConcept("substance", element.getSubstance());
28135      }
28136      if (element.hasManifestation()) {
28137        openArray("manifestation");
28138        for (CodeableConcept e : element.getManifestation()) 
28139          composeCodeableConcept(null, e);
28140        closeArray();
28141      };
28142      if (element.hasDescriptionElement()) {
28143        composeStringCore("description", element.getDescriptionElement(), false);
28144        composeStringExtras("description", element.getDescriptionElement(), false);
28145      }
28146      if (element.hasOnsetElement()) {
28147        composeDateTimeCore("onset", element.getOnsetElement(), false);
28148        composeDateTimeExtras("onset", element.getOnsetElement(), false);
28149      }
28150      if (element.hasSeverityElement()) {
28151        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
28152        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
28153      }
28154      if (element.hasExposureRoute()) {
28155        composeCodeableConcept("exposureRoute", element.getExposureRoute());
28156      }
28157      if (element.hasNote()) {
28158        openArray("note");
28159        for (Annotation e : element.getNote()) 
28160          composeAnnotation(null, e);
28161        closeArray();
28162      };
28163  }
28164
28165  protected void composeAppointment(String name, Appointment element) throws IOException {
28166    if (element != null) {
28167      prop("resourceType", name);
28168      composeAppointmentInner(element);
28169    }
28170  }
28171
28172  protected void composeAppointmentInner(Appointment element) throws IOException {
28173      composeDomainResourceElements(element);
28174      if (element.hasIdentifier()) {
28175        openArray("identifier");
28176        for (Identifier e : element.getIdentifier()) 
28177          composeIdentifier(null, e);
28178        closeArray();
28179      };
28180      if (element.hasStatusElement()) {
28181        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
28182        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
28183      }
28184      if (element.hasServiceCategory()) {
28185        openArray("serviceCategory");
28186        for (CodeableConcept e : element.getServiceCategory()) 
28187          composeCodeableConcept(null, e);
28188        closeArray();
28189      };
28190      if (element.hasServiceType()) {
28191        openArray("serviceType");
28192        for (CodeableConcept e : element.getServiceType()) 
28193          composeCodeableConcept(null, e);
28194        closeArray();
28195      };
28196      if (element.hasSpecialty()) {
28197        openArray("specialty");
28198        for (CodeableConcept e : element.getSpecialty()) 
28199          composeCodeableConcept(null, e);
28200        closeArray();
28201      };
28202      if (element.hasAppointmentType()) {
28203        composeCodeableConcept("appointmentType", element.getAppointmentType());
28204      }
28205      if (element.hasReason()) {
28206        openArray("reason");
28207        for (CodeableConcept e : element.getReason()) 
28208          composeCodeableConcept(null, e);
28209        closeArray();
28210      };
28211      if (element.hasIndication()) {
28212        openArray("indication");
28213        for (Reference e : element.getIndication()) 
28214          composeReference(null, e);
28215        closeArray();
28216      };
28217      if (element.hasPriorityElement()) {
28218        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
28219        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
28220      }
28221      if (element.hasDescriptionElement()) {
28222        composeStringCore("description", element.getDescriptionElement(), false);
28223        composeStringExtras("description", element.getDescriptionElement(), false);
28224      }
28225      if (element.hasSupportingInformation()) {
28226        openArray("supportingInformation");
28227        for (Reference e : element.getSupportingInformation()) 
28228          composeReference(null, e);
28229        closeArray();
28230      };
28231      if (element.hasStartElement()) {
28232        composeInstantCore("start", element.getStartElement(), false);
28233        composeInstantExtras("start", element.getStartElement(), false);
28234      }
28235      if (element.hasEndElement()) {
28236        composeInstantCore("end", element.getEndElement(), false);
28237        composeInstantExtras("end", element.getEndElement(), false);
28238      }
28239      if (element.hasMinutesDurationElement()) {
28240        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
28241        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
28242      }
28243      if (element.hasSlot()) {
28244        openArray("slot");
28245        for (Reference e : element.getSlot()) 
28246          composeReference(null, e);
28247        closeArray();
28248      };
28249      if (element.hasCreatedElement()) {
28250        composeDateTimeCore("created", element.getCreatedElement(), false);
28251        composeDateTimeExtras("created", element.getCreatedElement(), false);
28252      }
28253      if (element.hasCommentElement()) {
28254        composeStringCore("comment", element.getCommentElement(), false);
28255        composeStringExtras("comment", element.getCommentElement(), false);
28256      }
28257      if (element.hasPatientInstructionElement()) {
28258        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
28259        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
28260      }
28261      if (element.hasBasedOn()) {
28262        openArray("basedOn");
28263        for (Reference e : element.getBasedOn()) 
28264          composeReference(null, e);
28265        closeArray();
28266      };
28267      if (element.hasParticipant()) {
28268        openArray("participant");
28269        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
28270          composeAppointmentAppointmentParticipantComponent(null, e);
28271        closeArray();
28272      };
28273      if (element.hasRequestedPeriod()) {
28274        openArray("requestedPeriod");
28275        for (Period e : element.getRequestedPeriod()) 
28276          composePeriod(null, e);
28277        closeArray();
28278      };
28279  }
28280
28281  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
28282    if (element != null) {
28283      open(name);
28284      composeAppointmentAppointmentParticipantComponentInner(element);
28285      close();
28286    }
28287  }
28288
28289  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
28290      composeBackbone(element);
28291      if (element.hasType()) {
28292        openArray("type");
28293        for (CodeableConcept e : element.getType()) 
28294          composeCodeableConcept(null, e);
28295        closeArray();
28296      };
28297      if (element.hasActor()) {
28298        composeReference("actor", element.getActor());
28299      }
28300      if (element.hasRequiredElement()) {
28301        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
28302        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
28303      }
28304      if (element.hasStatusElement()) {
28305        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
28306        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
28307      }
28308      if (element.hasPeriod()) {
28309        composePeriod("period", element.getPeriod());
28310      }
28311  }
28312
28313  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
28314    if (element != null) {
28315      prop("resourceType", name);
28316      composeAppointmentResponseInner(element);
28317    }
28318  }
28319
28320  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
28321      composeDomainResourceElements(element);
28322      if (element.hasIdentifier()) {
28323        openArray("identifier");
28324        for (Identifier e : element.getIdentifier()) 
28325          composeIdentifier(null, e);
28326        closeArray();
28327      };
28328      if (element.hasAppointment()) {
28329        composeReference("appointment", element.getAppointment());
28330      }
28331      if (element.hasStartElement()) {
28332        composeInstantCore("start", element.getStartElement(), false);
28333        composeInstantExtras("start", element.getStartElement(), false);
28334      }
28335      if (element.hasEndElement()) {
28336        composeInstantCore("end", element.getEndElement(), false);
28337        composeInstantExtras("end", element.getEndElement(), false);
28338      }
28339      if (element.hasParticipantType()) {
28340        openArray("participantType");
28341        for (CodeableConcept e : element.getParticipantType()) 
28342          composeCodeableConcept(null, e);
28343        closeArray();
28344      };
28345      if (element.hasActor()) {
28346        composeReference("actor", element.getActor());
28347      }
28348      if (element.hasParticipantStatusElement()) {
28349        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
28350        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
28351      }
28352      if (element.hasCommentElement()) {
28353        composeStringCore("comment", element.getCommentElement(), false);
28354        composeStringExtras("comment", element.getCommentElement(), false);
28355      }
28356  }
28357
28358  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
28359    if (element != null) {
28360      prop("resourceType", name);
28361      composeAuditEventInner(element);
28362    }
28363  }
28364
28365  protected void composeAuditEventInner(AuditEvent element) throws IOException {
28366      composeDomainResourceElements(element);
28367      if (element.hasType()) {
28368        composeCoding("type", element.getType());
28369      }
28370      if (element.hasSubtype()) {
28371        openArray("subtype");
28372        for (Coding e : element.getSubtype()) 
28373          composeCoding(null, e);
28374        closeArray();
28375      };
28376      if (element.hasActionElement()) {
28377        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
28378        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
28379      }
28380      if (element.hasPeriod()) {
28381        composePeriod("period", element.getPeriod());
28382      }
28383      if (element.hasRecordedElement()) {
28384        composeInstantCore("recorded", element.getRecordedElement(), false);
28385        composeInstantExtras("recorded", element.getRecordedElement(), false);
28386      }
28387      if (element.hasOutcomeElement()) {
28388        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
28389        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
28390      }
28391      if (element.hasOutcomeDescElement()) {
28392        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
28393        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
28394      }
28395      if (element.hasPurposeOfEvent()) {
28396        openArray("purposeOfEvent");
28397        for (CodeableConcept e : element.getPurposeOfEvent()) 
28398          composeCodeableConcept(null, e);
28399        closeArray();
28400      };
28401      if (element.hasAgent()) {
28402        openArray("agent");
28403        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
28404          composeAuditEventAuditEventAgentComponent(null, e);
28405        closeArray();
28406      };
28407      if (element.hasSource()) {
28408        composeAuditEventAuditEventSourceComponent("source", element.getSource());
28409      }
28410      if (element.hasEntity()) {
28411        openArray("entity");
28412        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
28413          composeAuditEventAuditEventEntityComponent(null, e);
28414        closeArray();
28415      };
28416  }
28417
28418  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
28419    if (element != null) {
28420      open(name);
28421      composeAuditEventAuditEventAgentComponentInner(element);
28422      close();
28423    }
28424  }
28425
28426  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
28427      composeBackbone(element);
28428      if (element.hasType()) {
28429        composeCodeableConcept("type", element.getType());
28430      }
28431      if (element.hasRole()) {
28432        openArray("role");
28433        for (CodeableConcept e : element.getRole()) 
28434          composeCodeableConcept(null, e);
28435        closeArray();
28436      };
28437      if (element.hasReference()) {
28438        composeReference("reference", element.getReference());
28439      }
28440      if (element.hasUserId()) {
28441        composeIdentifier("userId", element.getUserId());
28442      }
28443      if (element.hasAltIdElement()) {
28444        composeStringCore("altId", element.getAltIdElement(), false);
28445        composeStringExtras("altId", element.getAltIdElement(), false);
28446      }
28447      if (element.hasNameElement()) {
28448        composeStringCore("name", element.getNameElement(), false);
28449        composeStringExtras("name", element.getNameElement(), false);
28450      }
28451      if (element.hasRequestorElement()) {
28452        composeBooleanCore("requestor", element.getRequestorElement(), false);
28453        composeBooleanExtras("requestor", element.getRequestorElement(), false);
28454      }
28455      if (element.hasLocation()) {
28456        composeReference("location", element.getLocation());
28457      }
28458      if (element.hasPolicy()) {
28459        openArray("policy");
28460        for (UriType e : element.getPolicy()) 
28461          composeUriCore(null, e, true);
28462        closeArray();
28463        if (anyHasExtras(element.getPolicy())) {
28464          openArray("_policy");
28465          for (UriType e : element.getPolicy()) 
28466            composeUriExtras(null, e, true);
28467          closeArray();
28468        }
28469      };
28470      if (element.hasMedia()) {
28471        composeCoding("media", element.getMedia());
28472      }
28473      if (element.hasNetwork()) {
28474        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
28475      }
28476      if (element.hasPurposeOfUse()) {
28477        openArray("purposeOfUse");
28478        for (CodeableConcept e : element.getPurposeOfUse()) 
28479          composeCodeableConcept(null, e);
28480        closeArray();
28481      };
28482  }
28483
28484  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
28485    if (element != null) {
28486      open(name);
28487      composeAuditEventAuditEventAgentNetworkComponentInner(element);
28488      close();
28489    }
28490  }
28491
28492  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
28493      composeBackbone(element);
28494      if (element.hasAddressElement()) {
28495        composeStringCore("address", element.getAddressElement(), false);
28496        composeStringExtras("address", element.getAddressElement(), false);
28497      }
28498      if (element.hasTypeElement()) {
28499        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
28500        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
28501      }
28502  }
28503
28504  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
28505    if (element != null) {
28506      open(name);
28507      composeAuditEventAuditEventSourceComponentInner(element);
28508      close();
28509    }
28510  }
28511
28512  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
28513      composeBackbone(element);
28514      if (element.hasSiteElement()) {
28515        composeStringCore("site", element.getSiteElement(), false);
28516        composeStringExtras("site", element.getSiteElement(), false);
28517      }
28518      if (element.hasIdentifier()) {
28519        composeIdentifier("identifier", element.getIdentifier());
28520      }
28521      if (element.hasType()) {
28522        openArray("type");
28523        for (Coding e : element.getType()) 
28524          composeCoding(null, e);
28525        closeArray();
28526      };
28527  }
28528
28529  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
28530    if (element != null) {
28531      open(name);
28532      composeAuditEventAuditEventEntityComponentInner(element);
28533      close();
28534    }
28535  }
28536
28537  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
28538      composeBackbone(element);
28539      if (element.hasIdentifier()) {
28540        composeIdentifier("identifier", element.getIdentifier());
28541      }
28542      if (element.hasReference()) {
28543        composeReference("reference", element.getReference());
28544      }
28545      if (element.hasType()) {
28546        composeCoding("type", element.getType());
28547      }
28548      if (element.hasRole()) {
28549        composeCoding("role", element.getRole());
28550      }
28551      if (element.hasLifecycle()) {
28552        composeCoding("lifecycle", element.getLifecycle());
28553      }
28554      if (element.hasSecurityLabel()) {
28555        openArray("securityLabel");
28556        for (Coding e : element.getSecurityLabel()) 
28557          composeCoding(null, e);
28558        closeArray();
28559      };
28560      if (element.hasNameElement()) {
28561        composeStringCore("name", element.getNameElement(), false);
28562        composeStringExtras("name", element.getNameElement(), false);
28563      }
28564      if (element.hasDescriptionElement()) {
28565        composeStringCore("description", element.getDescriptionElement(), false);
28566        composeStringExtras("description", element.getDescriptionElement(), false);
28567      }
28568      if (element.hasQueryElement()) {
28569        composeBase64BinaryCore("query", element.getQueryElement(), false);
28570        composeBase64BinaryExtras("query", element.getQueryElement(), false);
28571      }
28572      if (element.hasDetail()) {
28573        openArray("detail");
28574        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
28575          composeAuditEventAuditEventEntityDetailComponent(null, e);
28576        closeArray();
28577      };
28578  }
28579
28580  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
28581    if (element != null) {
28582      open(name);
28583      composeAuditEventAuditEventEntityDetailComponentInner(element);
28584      close();
28585    }
28586  }
28587
28588  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
28589      composeBackbone(element);
28590      if (element.hasTypeElement()) {
28591        composeStringCore("type", element.getTypeElement(), false);
28592        composeStringExtras("type", element.getTypeElement(), false);
28593      }
28594      if (element.hasValue()) {
28595        composeType("value", element.getValue());
28596      }
28597  }
28598
28599  protected void composeBasic(String name, Basic element) throws IOException {
28600    if (element != null) {
28601      prop("resourceType", name);
28602      composeBasicInner(element);
28603    }
28604  }
28605
28606  protected void composeBasicInner(Basic element) throws IOException {
28607      composeDomainResourceElements(element);
28608      if (element.hasIdentifier()) {
28609        openArray("identifier");
28610        for (Identifier e : element.getIdentifier()) 
28611          composeIdentifier(null, e);
28612        closeArray();
28613      };
28614      if (element.hasCode()) {
28615        composeCodeableConcept("code", element.getCode());
28616      }
28617      if (element.hasSubject()) {
28618        composeReference("subject", element.getSubject());
28619      }
28620      if (element.hasCreatedElement()) {
28621        composeDateCore("created", element.getCreatedElement(), false);
28622        composeDateExtras("created", element.getCreatedElement(), false);
28623      }
28624      if (element.hasAuthor()) {
28625        composeReference("author", element.getAuthor());
28626      }
28627  }
28628
28629  protected void composeBinary(String name, Binary element) throws IOException {
28630    if (element != null) {
28631      prop("resourceType", name);
28632      composeBinaryInner(element);
28633    }
28634  }
28635
28636  protected void composeBinaryInner(Binary element) throws IOException {
28637      composeResourceElements(element);
28638      if (element.hasContentTypeElement()) {
28639        composeCodeCore("contentType", element.getContentTypeElement(), false);
28640        composeCodeExtras("contentType", element.getContentTypeElement(), false);
28641      }
28642      if (element.hasSecurityContext()) {
28643        composeReference("securityContext", element.getSecurityContext());
28644      }
28645      if (element.hasContentElement()) {
28646        composeBase64BinaryCore("content", element.getContentElement(), false);
28647        composeBase64BinaryExtras("content", element.getContentElement(), false);
28648      }
28649  }
28650
28651  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
28652    if (element != null) {
28653      prop("resourceType", name);
28654      composeBiologicallyDerivedProductInner(element);
28655    }
28656  }
28657
28658  protected void composeBiologicallyDerivedProductInner(BiologicallyDerivedProduct element) throws IOException {
28659      composeDomainResourceElements(element);
28660      if (element.hasIdentifier()) {
28661        openArray("identifier");
28662        for (Identifier e : element.getIdentifier()) 
28663          composeIdentifier(null, e);
28664        closeArray();
28665      };
28666      if (element.hasProductCategoryElement()) {
28667        composeEnumerationCore("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
28668        composeEnumerationExtras("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
28669      }
28670      if (element.hasProductCode()) {
28671        composeCodeableConcept("productCode", element.getProductCode());
28672      }
28673      if (element.hasStatusElement()) {
28674        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
28675        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
28676      }
28677      if (element.hasRequest()) {
28678        openArray("request");
28679        for (Reference e : element.getRequest()) 
28680          composeReference(null, e);
28681        closeArray();
28682      };
28683      if (element.hasQuantityElement()) {
28684        composeIntegerCore("quantity", element.getQuantityElement(), false);
28685        composeIntegerExtras("quantity", element.getQuantityElement(), false);
28686      }
28687      if (element.hasParent()) {
28688        composeReference("parent", element.getParent());
28689      }
28690      if (element.hasCollection()) {
28691        composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
28692      }
28693      if (element.hasProcessing()) {
28694        openArray("processing");
28695        for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing()) 
28696          composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(null, e);
28697        closeArray();
28698      };
28699      if (element.hasManipulation()) {
28700        composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent("manipulation", element.getManipulation());
28701      }
28702      if (element.hasStorage()) {
28703        openArray("storage");
28704        for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage()) 
28705          composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(null, e);
28706        closeArray();
28707      };
28708  }
28709
28710  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
28711    if (element != null) {
28712      open(name);
28713      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(element);
28714      close();
28715    }
28716  }
28717
28718  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
28719      composeBackbone(element);
28720      if (element.hasCollector()) {
28721        composeReference("collector", element.getCollector());
28722      }
28723      if (element.hasSource()) {
28724        composeReference("source", element.getSource());
28725      }
28726      if (element.hasCollected()) {
28727        composeType("collected", element.getCollected());
28728      }
28729  }
28730
28731  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
28732    if (element != null) {
28733      open(name);
28734      composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(element);
28735      close();
28736    }
28737  }
28738
28739  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
28740      composeBackbone(element);
28741      if (element.hasDescriptionElement()) {
28742        composeStringCore("description", element.getDescriptionElement(), false);
28743        composeStringExtras("description", element.getDescriptionElement(), false);
28744      }
28745      if (element.hasProcedure()) {
28746        composeCodeableConcept("procedure", element.getProcedure());
28747      }
28748      if (element.hasAdditive()) {
28749        composeReference("additive", element.getAdditive());
28750      }
28751      if (element.hasTime()) {
28752        composeType("time", element.getTime());
28753      }
28754  }
28755
28756  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
28757    if (element != null) {
28758      open(name);
28759      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(element);
28760      close();
28761    }
28762  }
28763
28764  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
28765      composeBackbone(element);
28766      if (element.hasDescriptionElement()) {
28767        composeStringCore("description", element.getDescriptionElement(), false);
28768        composeStringExtras("description", element.getDescriptionElement(), false);
28769      }
28770      if (element.hasTime()) {
28771        composeType("time", element.getTime());
28772      }
28773  }
28774
28775  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
28776    if (element != null) {
28777      open(name);
28778      composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(element);
28779      close();
28780    }
28781  }
28782
28783  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
28784      composeBackbone(element);
28785      if (element.hasDescriptionElement()) {
28786        composeStringCore("description", element.getDescriptionElement(), false);
28787        composeStringExtras("description", element.getDescriptionElement(), false);
28788      }
28789      if (element.hasTemperatureElement()) {
28790        composeDecimalCore("temperature", element.getTemperatureElement(), false);
28791        composeDecimalExtras("temperature", element.getTemperatureElement(), false);
28792      }
28793      if (element.hasScaleElement()) {
28794        composeEnumerationCore("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
28795        composeEnumerationExtras("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
28796      }
28797      if (element.hasDuration()) {
28798        composePeriod("duration", element.getDuration());
28799      }
28800  }
28801
28802  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
28803    if (element != null) {
28804      prop("resourceType", name);
28805      composeBodyStructureInner(element);
28806    }
28807  }
28808
28809  protected void composeBodyStructureInner(BodyStructure element) throws IOException {
28810      composeDomainResourceElements(element);
28811      if (element.hasIdentifier()) {
28812        openArray("identifier");
28813        for (Identifier e : element.getIdentifier()) 
28814          composeIdentifier(null, e);
28815        closeArray();
28816      };
28817      if (element.hasActiveElement()) {
28818        composeBooleanCore("active", element.getActiveElement(), false);
28819        composeBooleanExtras("active", element.getActiveElement(), false);
28820      }
28821      if (element.hasMorphology()) {
28822        composeCodeableConcept("morphology", element.getMorphology());
28823      }
28824      if (element.hasLocation()) {
28825        composeCodeableConcept("location", element.getLocation());
28826      }
28827      if (element.hasLocationQualifier()) {
28828        openArray("locationQualifier");
28829        for (CodeableConcept e : element.getLocationQualifier()) 
28830          composeCodeableConcept(null, e);
28831        closeArray();
28832      };
28833      if (element.hasDescriptionElement()) {
28834        composeStringCore("description", element.getDescriptionElement(), false);
28835        composeStringExtras("description", element.getDescriptionElement(), false);
28836      }
28837      if (element.hasImage()) {
28838        openArray("image");
28839        for (Attachment e : element.getImage()) 
28840          composeAttachment(null, e);
28841        closeArray();
28842      };
28843      if (element.hasPatient()) {
28844        composeReference("patient", element.getPatient());
28845      }
28846  }
28847
28848  protected void composeBundle(String name, Bundle element) throws IOException {
28849    if (element != null) {
28850      prop("resourceType", name);
28851      composeBundleInner(element);
28852    }
28853  }
28854
28855  protected void composeBundleInner(Bundle element) throws IOException {
28856      composeResourceElements(element);
28857      if (element.hasIdentifier()) {
28858        composeIdentifier("identifier", element.getIdentifier());
28859      }
28860      if (element.hasTypeElement()) {
28861        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
28862        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
28863      }
28864      if (element.hasTimestampElement()) {
28865        composeInstantCore("timestamp", element.getTimestampElement(), false);
28866        composeInstantExtras("timestamp", element.getTimestampElement(), false);
28867      }
28868      if (element.hasTotalElement()) {
28869        composeUnsignedIntCore("total", element.getTotalElement(), false);
28870        composeUnsignedIntExtras("total", element.getTotalElement(), false);
28871      }
28872      if (element.hasLink()) {
28873        openArray("link");
28874        for (Bundle.BundleLinkComponent e : element.getLink()) 
28875          composeBundleBundleLinkComponent(null, e);
28876        closeArray();
28877      };
28878      if (element.hasEntry()) {
28879        openArray("entry");
28880        for (Bundle.BundleEntryComponent e : element.getEntry()) 
28881          composeBundleBundleEntryComponent(null, e);
28882        closeArray();
28883      };
28884      if (element.hasSignature()) {
28885        composeSignature("signature", element.getSignature());
28886      }
28887  }
28888
28889  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
28890    if (element != null) {
28891      open(name);
28892      composeBundleBundleLinkComponentInner(element);
28893      close();
28894    }
28895  }
28896
28897  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
28898      composeBackbone(element);
28899      if (element.hasRelationElement()) {
28900        composeStringCore("relation", element.getRelationElement(), false);
28901        composeStringExtras("relation", element.getRelationElement(), false);
28902      }
28903      if (element.hasUrlElement()) {
28904        composeUriCore("url", element.getUrlElement(), false);
28905        composeUriExtras("url", element.getUrlElement(), false);
28906      }
28907  }
28908
28909  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
28910    if (element != null) {
28911      open(name);
28912      composeBundleBundleEntryComponentInner(element);
28913      close();
28914    }
28915  }
28916
28917  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
28918      composeBackbone(element);
28919      if (element.hasLink()) {
28920        openArray("link");
28921        for (Bundle.BundleLinkComponent e : element.getLink()) 
28922          composeBundleBundleLinkComponent(null, e);
28923        closeArray();
28924      };
28925      if (element.hasFullUrlElement()) {
28926        composeUriCore("fullUrl", element.getFullUrlElement(), false);
28927        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
28928      }
28929        if (element.hasResource()) {
28930          open("resource");
28931          composeResource(element.getResource());
28932          close();
28933        }
28934      if (element.hasSearch()) {
28935        composeBundleBundleEntrySearchComponent("search", element.getSearch());
28936      }
28937      if (element.hasRequest()) {
28938        composeBundleBundleEntryRequestComponent("request", element.getRequest());
28939      }
28940      if (element.hasResponse()) {
28941        composeBundleBundleEntryResponseComponent("response", element.getResponse());
28942      }
28943  }
28944
28945  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
28946    if (element != null) {
28947      open(name);
28948      composeBundleBundleEntrySearchComponentInner(element);
28949      close();
28950    }
28951  }
28952
28953  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
28954      composeBackbone(element);
28955      if (element.hasModeElement()) {
28956        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
28957        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
28958      }
28959      if (element.hasScoreElement()) {
28960        composeDecimalCore("score", element.getScoreElement(), false);
28961        composeDecimalExtras("score", element.getScoreElement(), false);
28962      }
28963  }
28964
28965  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
28966    if (element != null) {
28967      open(name);
28968      composeBundleBundleEntryRequestComponentInner(element);
28969      close();
28970    }
28971  }
28972
28973  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
28974      composeBackbone(element);
28975      if (element.hasMethodElement()) {
28976        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
28977        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
28978      }
28979      if (element.hasUrlElement()) {
28980        composeUriCore("url", element.getUrlElement(), false);
28981        composeUriExtras("url", element.getUrlElement(), false);
28982      }
28983      if (element.hasIfNoneMatchElement()) {
28984        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
28985        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
28986      }
28987      if (element.hasIfModifiedSinceElement()) {
28988        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
28989        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
28990      }
28991      if (element.hasIfMatchElement()) {
28992        composeStringCore("ifMatch", element.getIfMatchElement(), false);
28993        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
28994      }
28995      if (element.hasIfNoneExistElement()) {
28996        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
28997        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
28998      }
28999  }
29000
29001  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
29002    if (element != null) {
29003      open(name);
29004      composeBundleBundleEntryResponseComponentInner(element);
29005      close();
29006    }
29007  }
29008
29009  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
29010      composeBackbone(element);
29011      if (element.hasStatusElement()) {
29012        composeStringCore("status", element.getStatusElement(), false);
29013        composeStringExtras("status", element.getStatusElement(), false);
29014      }
29015      if (element.hasLocationElement()) {
29016        composeUriCore("location", element.getLocationElement(), false);
29017        composeUriExtras("location", element.getLocationElement(), false);
29018      }
29019      if (element.hasEtagElement()) {
29020        composeStringCore("etag", element.getEtagElement(), false);
29021        composeStringExtras("etag", element.getEtagElement(), false);
29022      }
29023      if (element.hasLastModifiedElement()) {
29024        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
29025        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
29026      }
29027        if (element.hasOutcome()) {
29028          open("outcome");
29029          composeResource(element.getOutcome());
29030          close();
29031        }
29032  }
29033
29034  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
29035    if (element != null) {
29036      prop("resourceType", name);
29037      composeCapabilityStatementInner(element);
29038    }
29039  }
29040
29041  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
29042      composeDomainResourceElements(element);
29043      if (element.hasUrlElement()) {
29044        composeUriCore("url", element.getUrlElement(), false);
29045        composeUriExtras("url", element.getUrlElement(), false);
29046      }
29047      if (element.hasVersionElement()) {
29048        composeStringCore("version", element.getVersionElement(), false);
29049        composeStringExtras("version", element.getVersionElement(), false);
29050      }
29051      if (element.hasNameElement()) {
29052        composeStringCore("name", element.getNameElement(), false);
29053        composeStringExtras("name", element.getNameElement(), false);
29054      }
29055      if (element.hasTitleElement()) {
29056        composeStringCore("title", element.getTitleElement(), false);
29057        composeStringExtras("title", element.getTitleElement(), false);
29058      }
29059      if (element.hasStatusElement()) {
29060        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
29061        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
29062      }
29063      if (element.hasExperimentalElement()) {
29064        composeBooleanCore("experimental", element.getExperimentalElement(), false);
29065        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
29066      }
29067      if (element.hasDateElement()) {
29068        composeDateTimeCore("date", element.getDateElement(), false);
29069        composeDateTimeExtras("date", element.getDateElement(), false);
29070      }
29071      if (element.hasPublisherElement()) {
29072        composeStringCore("publisher", element.getPublisherElement(), false);
29073        composeStringExtras("publisher", element.getPublisherElement(), false);
29074      }
29075      if (element.hasContact()) {
29076        openArray("contact");
29077        for (ContactDetail e : element.getContact()) 
29078          composeContactDetail(null, e);
29079        closeArray();
29080      };
29081      if (element.hasDescriptionElement()) {
29082        composeMarkdownCore("description", element.getDescriptionElement(), false);
29083        composeMarkdownExtras("description", element.getDescriptionElement(), false);
29084      }
29085      if (element.hasUseContext()) {
29086        openArray("useContext");
29087        for (UsageContext e : element.getUseContext()) 
29088          composeUsageContext(null, e);
29089        closeArray();
29090      };
29091      if (element.hasJurisdiction()) {
29092        openArray("jurisdiction");
29093        for (CodeableConcept e : element.getJurisdiction()) 
29094          composeCodeableConcept(null, e);
29095        closeArray();
29096      };
29097      if (element.hasPurposeElement()) {
29098        composeMarkdownCore("purpose", element.getPurposeElement(), false);
29099        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
29100      }
29101      if (element.hasCopyrightElement()) {
29102        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
29103        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
29104      }
29105      if (element.hasKindElement()) {
29106        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
29107        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
29108      }
29109      if (element.hasInstantiates()) {
29110        openArray("instantiates");
29111        for (CanonicalType e : element.getInstantiates()) 
29112          composeCanonicalCore(null, e, true);
29113        closeArray();
29114        if (anyHasExtras(element.getInstantiates())) {
29115          openArray("_instantiates");
29116          for (CanonicalType e : element.getInstantiates()) 
29117            composeCanonicalExtras(null, e, true);
29118          closeArray();
29119        }
29120      };
29121      if (element.hasSoftware()) {
29122        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
29123      }
29124      if (element.hasImplementation()) {
29125        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
29126      }
29127      if (element.hasFhirVersionElement()) {
29128        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
29129        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
29130      }
29131      if (element.hasFormat()) {
29132        openArray("format");
29133        for (CodeType e : element.getFormat()) 
29134          composeCodeCore(null, e, true);
29135        closeArray();
29136        if (anyHasExtras(element.getFormat())) {
29137          openArray("_format");
29138          for (CodeType e : element.getFormat()) 
29139            composeCodeExtras(null, e, true);
29140          closeArray();
29141        }
29142      };
29143      if (element.hasPatchFormat()) {
29144        openArray("patchFormat");
29145        for (CodeType e : element.getPatchFormat()) 
29146          composeCodeCore(null, e, true);
29147        closeArray();
29148        if (anyHasExtras(element.getPatchFormat())) {
29149          openArray("_patchFormat");
29150          for (CodeType e : element.getPatchFormat()) 
29151            composeCodeExtras(null, e, true);
29152          closeArray();
29153        }
29154      };
29155      if (element.hasImplementationGuide()) {
29156        openArray("implementationGuide");
29157        for (CanonicalType e : element.getImplementationGuide()) 
29158          composeCanonicalCore(null, e, true);
29159        closeArray();
29160        if (anyHasExtras(element.getImplementationGuide())) {
29161          openArray("_implementationGuide");
29162          for (CanonicalType e : element.getImplementationGuide()) 
29163            composeCanonicalExtras(null, e, true);
29164          closeArray();
29165        }
29166      };
29167      if (element.hasRest()) {
29168        openArray("rest");
29169        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
29170          composeCapabilityStatementCapabilityStatementRestComponent(null, e);
29171        closeArray();
29172      };
29173      if (element.hasMessaging()) {
29174        openArray("messaging");
29175        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
29176          composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
29177        closeArray();
29178      };
29179      if (element.hasDocument()) {
29180        openArray("document");
29181        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
29182          composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
29183        closeArray();
29184      };
29185  }
29186
29187  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
29188    if (element != null) {
29189      open(name);
29190      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
29191      close();
29192    }
29193  }
29194
29195  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
29196      composeBackbone(element);
29197      if (element.hasNameElement()) {
29198        composeStringCore("name", element.getNameElement(), false);
29199        composeStringExtras("name", element.getNameElement(), false);
29200      }
29201      if (element.hasVersionElement()) {
29202        composeStringCore("version", element.getVersionElement(), false);
29203        composeStringExtras("version", element.getVersionElement(), false);
29204      }
29205      if (element.hasReleaseDateElement()) {
29206        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
29207        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
29208      }
29209  }
29210
29211  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
29212    if (element != null) {
29213      open(name);
29214      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
29215      close();
29216    }
29217  }
29218
29219  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
29220      composeBackbone(element);
29221      if (element.hasDescriptionElement()) {
29222        composeStringCore("description", element.getDescriptionElement(), false);
29223        composeStringExtras("description", element.getDescriptionElement(), false);
29224      }
29225      if (element.hasUrlElement()) {
29226        composeUrlCore("url", element.getUrlElement(), false);
29227        composeUrlExtras("url", element.getUrlElement(), false);
29228      }
29229  }
29230
29231  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
29232    if (element != null) {
29233      open(name);
29234      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
29235      close();
29236    }
29237  }
29238
29239  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
29240      composeBackbone(element);
29241      if (element.hasModeElement()) {
29242        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
29243        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
29244      }
29245      if (element.hasDocumentationElement()) {
29246        composeStringCore("documentation", element.getDocumentationElement(), false);
29247        composeStringExtras("documentation", element.getDocumentationElement(), false);
29248      }
29249      if (element.hasSecurity()) {
29250        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
29251      }
29252      if (element.hasResource()) {
29253        openArray("resource");
29254        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
29255          composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
29256        closeArray();
29257      };
29258      if (element.hasInteraction()) {
29259        openArray("interaction");
29260        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
29261          composeCapabilityStatementSystemInteractionComponent(null, e);
29262        closeArray();
29263      };
29264      if (element.hasSearchParam()) {
29265        openArray("searchParam");
29266        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
29267          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
29268        closeArray();
29269      };
29270      if (element.hasOperation()) {
29271        openArray("operation");
29272        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
29273          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
29274        closeArray();
29275      };
29276      if (element.hasCompartment()) {
29277        openArray("compartment");
29278        for (CanonicalType e : element.getCompartment()) 
29279          composeCanonicalCore(null, e, true);
29280        closeArray();
29281        if (anyHasExtras(element.getCompartment())) {
29282          openArray("_compartment");
29283          for (CanonicalType e : element.getCompartment()) 
29284            composeCanonicalExtras(null, e, true);
29285          closeArray();
29286        }
29287      };
29288  }
29289
29290  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
29291    if (element != null) {
29292      open(name);
29293      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
29294      close();
29295    }
29296  }
29297
29298  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
29299      composeBackbone(element);
29300      if (element.hasCorsElement()) {
29301        composeBooleanCore("cors", element.getCorsElement(), false);
29302        composeBooleanExtras("cors", element.getCorsElement(), false);
29303      }
29304      if (element.hasService()) {
29305        openArray("service");
29306        for (CodeableConcept e : element.getService()) 
29307          composeCodeableConcept(null, e);
29308        closeArray();
29309      };
29310      if (element.hasDescriptionElement()) {
29311        composeStringCore("description", element.getDescriptionElement(), false);
29312        composeStringExtras("description", element.getDescriptionElement(), false);
29313      }
29314  }
29315
29316  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
29317    if (element != null) {
29318      open(name);
29319      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
29320      close();
29321    }
29322  }
29323
29324  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
29325      composeBackbone(element);
29326      if (element.hasTypeElement()) {
29327        composeCodeCore("type", element.getTypeElement(), false);
29328        composeCodeExtras("type", element.getTypeElement(), false);
29329      }
29330      if (element.hasProfileElement()) {
29331        composeCanonicalCore("profile", element.getProfileElement(), false);
29332        composeCanonicalExtras("profile", element.getProfileElement(), false);
29333      }
29334      if (element.hasSupportedProfile()) {
29335        openArray("supportedProfile");
29336        for (CanonicalType e : element.getSupportedProfile()) 
29337          composeCanonicalCore(null, e, true);
29338        closeArray();
29339        if (anyHasExtras(element.getSupportedProfile())) {
29340          openArray("_supportedProfile");
29341          for (CanonicalType e : element.getSupportedProfile()) 
29342            composeCanonicalExtras(null, e, true);
29343          closeArray();
29344        }
29345      };
29346      if (element.hasDocumentationElement()) {
29347        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
29348        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
29349      }
29350      if (element.hasInteraction()) {
29351        openArray("interaction");
29352        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
29353          composeCapabilityStatementResourceInteractionComponent(null, e);
29354        closeArray();
29355      };
29356      if (element.hasVersioningElement()) {
29357        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
29358        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
29359      }
29360      if (element.hasReadHistoryElement()) {
29361        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
29362        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
29363      }
29364      if (element.hasUpdateCreateElement()) {
29365        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
29366        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
29367      }
29368      if (element.hasConditionalCreateElement()) {
29369        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
29370        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
29371      }
29372      if (element.hasConditionalReadElement()) {
29373        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
29374        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
29375      }
29376      if (element.hasConditionalUpdateElement()) {
29377        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
29378        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
29379      }
29380      if (element.hasConditionalDeleteElement()) {
29381        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
29382        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
29383      }
29384      if (element.hasReferencePolicy()) {
29385        openArray("referencePolicy");
29386        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
29387          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
29388        closeArray();
29389        if (anyHasExtras(element.getReferencePolicy())) {
29390          openArray("_referencePolicy");
29391          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
29392            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
29393          closeArray();
29394        }
29395      };
29396      if (element.hasSearchInclude()) {
29397        openArray("searchInclude");
29398        for (StringType e : element.getSearchInclude()) 
29399          composeStringCore(null, e, true);
29400        closeArray();
29401        if (anyHasExtras(element.getSearchInclude())) {
29402          openArray("_searchInclude");
29403          for (StringType e : element.getSearchInclude()) 
29404            composeStringExtras(null, e, true);
29405          closeArray();
29406        }
29407      };
29408      if (element.hasSearchRevInclude()) {
29409        openArray("searchRevInclude");
29410        for (StringType e : element.getSearchRevInclude()) 
29411          composeStringCore(null, e, true);
29412        closeArray();
29413        if (anyHasExtras(element.getSearchRevInclude())) {
29414          openArray("_searchRevInclude");
29415          for (StringType e : element.getSearchRevInclude()) 
29416            composeStringExtras(null, e, true);
29417          closeArray();
29418        }
29419      };
29420      if (element.hasSearchParam()) {
29421        openArray("searchParam");
29422        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
29423          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
29424        closeArray();
29425      };
29426      if (element.hasOperation()) {
29427        openArray("operation");
29428        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
29429          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
29430        closeArray();
29431      };
29432  }
29433
29434  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
29435    if (element != null) {
29436      open(name);
29437      composeCapabilityStatementResourceInteractionComponentInner(element);
29438      close();
29439    }
29440  }
29441
29442  protected void composeCapabilityStatementResourceInteractionComponentInner(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
29443      composeBackbone(element);
29444      if (element.hasCodeElement()) {
29445        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
29446        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
29447      }
29448      if (element.hasDocumentationElement()) {
29449        composeStringCore("documentation", element.getDocumentationElement(), false);
29450        composeStringExtras("documentation", element.getDocumentationElement(), false);
29451      }
29452  }
29453
29454  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
29455    if (element != null) {
29456      open(name);
29457      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
29458      close();
29459    }
29460  }
29461
29462  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
29463      composeBackbone(element);
29464      if (element.hasNameElement()) {
29465        composeStringCore("name", element.getNameElement(), false);
29466        composeStringExtras("name", element.getNameElement(), false);
29467      }
29468      if (element.hasDefinitionElement()) {
29469        composeCanonicalCore("definition", element.getDefinitionElement(), false);
29470        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
29471      }
29472      if (element.hasTypeElement()) {
29473        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
29474        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
29475      }
29476      if (element.hasDocumentationElement()) {
29477        composeStringCore("documentation", element.getDocumentationElement(), false);
29478        composeStringExtras("documentation", element.getDocumentationElement(), false);
29479      }
29480  }
29481
29482  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
29483    if (element != null) {
29484      open(name);
29485      composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(element);
29486      close();
29487    }
29488  }
29489
29490  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
29491      composeBackbone(element);
29492      if (element.hasNameElement()) {
29493        composeStringCore("name", element.getNameElement(), false);
29494        composeStringExtras("name", element.getNameElement(), false);
29495      }
29496      if (element.hasDefinitionElement()) {
29497        composeCanonicalCore("definition", element.getDefinitionElement(), false);
29498        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
29499      }
29500      if (element.hasDocumentationElement()) {
29501        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
29502        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
29503      }
29504  }
29505
29506  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
29507    if (element != null) {
29508      open(name);
29509      composeCapabilityStatementSystemInteractionComponentInner(element);
29510      close();
29511    }
29512  }
29513
29514  protected void composeCapabilityStatementSystemInteractionComponentInner(CapabilityStatement.SystemInteractionComponent element) throws IOException {
29515      composeBackbone(element);
29516      if (element.hasCodeElement()) {
29517        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
29518        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
29519      }
29520      if (element.hasDocumentationElement()) {
29521        composeStringCore("documentation", element.getDocumentationElement(), false);
29522        composeStringExtras("documentation", element.getDocumentationElement(), false);
29523      }
29524  }
29525
29526  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
29527    if (element != null) {
29528      open(name);
29529      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
29530      close();
29531    }
29532  }
29533
29534  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
29535      composeBackbone(element);
29536      if (element.hasEndpoint()) {
29537        openArray("endpoint");
29538        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
29539          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
29540        closeArray();
29541      };
29542      if (element.hasReliableCacheElement()) {
29543        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
29544        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
29545      }
29546      if (element.hasDocumentationElement()) {
29547        composeStringCore("documentation", element.getDocumentationElement(), false);
29548        composeStringExtras("documentation", element.getDocumentationElement(), false);
29549      }
29550      if (element.hasSupportedMessage()) {
29551        openArray("supportedMessage");
29552        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
29553          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
29554        closeArray();
29555      };
29556  }
29557
29558  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
29559    if (element != null) {
29560      open(name);
29561      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
29562      close();
29563    }
29564  }
29565
29566  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
29567      composeBackbone(element);
29568      if (element.hasProtocol()) {
29569        composeCoding("protocol", element.getProtocol());
29570      }
29571      if (element.hasAddressElement()) {
29572        composeUrlCore("address", element.getAddressElement(), false);
29573        composeUrlExtras("address", element.getAddressElement(), false);
29574      }
29575  }
29576
29577  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
29578    if (element != null) {
29579      open(name);
29580      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
29581      close();
29582    }
29583  }
29584
29585  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
29586      composeBackbone(element);
29587      if (element.hasModeElement()) {
29588        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
29589        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
29590      }
29591      if (element.hasDefinitionElement()) {
29592        composeCanonicalCore("definition", element.getDefinitionElement(), false);
29593        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
29594      }
29595  }
29596
29597  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
29598    if (element != null) {
29599      open(name);
29600      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
29601      close();
29602    }
29603  }
29604
29605  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
29606      composeBackbone(element);
29607      if (element.hasModeElement()) {
29608        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
29609        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
29610      }
29611      if (element.hasDocumentationElement()) {
29612        composeStringCore("documentation", element.getDocumentationElement(), false);
29613        composeStringExtras("documentation", element.getDocumentationElement(), false);
29614      }
29615      if (element.hasProfileElement()) {
29616        composeCanonicalCore("profile", element.getProfileElement(), false);
29617        composeCanonicalExtras("profile", element.getProfileElement(), false);
29618      }
29619  }
29620
29621  protected void composeCarePlan(String name, CarePlan element) throws IOException {
29622    if (element != null) {
29623      prop("resourceType", name);
29624      composeCarePlanInner(element);
29625    }
29626  }
29627
29628  protected void composeCarePlanInner(CarePlan element) throws IOException {
29629      composeDomainResourceElements(element);
29630      if (element.hasIdentifier()) {
29631        openArray("identifier");
29632        for (Identifier e : element.getIdentifier()) 
29633          composeIdentifier(null, e);
29634        closeArray();
29635      };
29636      if (element.hasInstantiates()) {
29637        openArray("instantiates");
29638        for (UriType e : element.getInstantiates()) 
29639          composeUriCore(null, e, true);
29640        closeArray();
29641        if (anyHasExtras(element.getInstantiates())) {
29642          openArray("_instantiates");
29643          for (UriType e : element.getInstantiates()) 
29644            composeUriExtras(null, e, true);
29645          closeArray();
29646        }
29647      };
29648      if (element.hasBasedOn()) {
29649        openArray("basedOn");
29650        for (Reference e : element.getBasedOn()) 
29651          composeReference(null, e);
29652        closeArray();
29653      };
29654      if (element.hasReplaces()) {
29655        openArray("replaces");
29656        for (Reference e : element.getReplaces()) 
29657          composeReference(null, e);
29658        closeArray();
29659      };
29660      if (element.hasPartOf()) {
29661        openArray("partOf");
29662        for (Reference e : element.getPartOf()) 
29663          composeReference(null, e);
29664        closeArray();
29665      };
29666      if (element.hasStatusElement()) {
29667        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
29668        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
29669      }
29670      if (element.hasIntentElement()) {
29671        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
29672        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
29673      }
29674      if (element.hasCategory()) {
29675        openArray("category");
29676        for (CodeableConcept e : element.getCategory()) 
29677          composeCodeableConcept(null, e);
29678        closeArray();
29679      };
29680      if (element.hasTitleElement()) {
29681        composeStringCore("title", element.getTitleElement(), false);
29682        composeStringExtras("title", element.getTitleElement(), false);
29683      }
29684      if (element.hasDescriptionElement()) {
29685        composeStringCore("description", element.getDescriptionElement(), false);
29686        composeStringExtras("description", element.getDescriptionElement(), false);
29687      }
29688      if (element.hasSubject()) {
29689        composeReference("subject", element.getSubject());
29690      }
29691      if (element.hasContext()) {
29692        composeReference("context", element.getContext());
29693      }
29694      if (element.hasPeriod()) {
29695        composePeriod("period", element.getPeriod());
29696      }
29697      if (element.hasAuthor()) {
29698        openArray("author");
29699        for (Reference e : element.getAuthor()) 
29700          composeReference(null, e);
29701        closeArray();
29702      };
29703      if (element.hasCareTeam()) {
29704        openArray("careTeam");
29705        for (Reference e : element.getCareTeam()) 
29706          composeReference(null, e);
29707        closeArray();
29708      };
29709      if (element.hasAddresses()) {
29710        openArray("addresses");
29711        for (Reference e : element.getAddresses()) 
29712          composeReference(null, e);
29713        closeArray();
29714      };
29715      if (element.hasSupportingInfo()) {
29716        openArray("supportingInfo");
29717        for (Reference e : element.getSupportingInfo()) 
29718          composeReference(null, e);
29719        closeArray();
29720      };
29721      if (element.hasGoal()) {
29722        openArray("goal");
29723        for (Reference e : element.getGoal()) 
29724          composeReference(null, e);
29725        closeArray();
29726      };
29727      if (element.hasActivity()) {
29728        openArray("activity");
29729        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
29730          composeCarePlanCarePlanActivityComponent(null, e);
29731        closeArray();
29732      };
29733      if (element.hasNote()) {
29734        openArray("note");
29735        for (Annotation e : element.getNote()) 
29736          composeAnnotation(null, e);
29737        closeArray();
29738      };
29739  }
29740
29741  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
29742    if (element != null) {
29743      open(name);
29744      composeCarePlanCarePlanActivityComponentInner(element);
29745      close();
29746    }
29747  }
29748
29749  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
29750      composeBackbone(element);
29751      if (element.hasOutcomeCodeableConcept()) {
29752        openArray("outcomeCodeableConcept");
29753        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
29754          composeCodeableConcept(null, e);
29755        closeArray();
29756      };
29757      if (element.hasOutcomeReference()) {
29758        openArray("outcomeReference");
29759        for (Reference e : element.getOutcomeReference()) 
29760          composeReference(null, e);
29761        closeArray();
29762      };
29763      if (element.hasProgress()) {
29764        openArray("progress");
29765        for (Annotation e : element.getProgress()) 
29766          composeAnnotation(null, e);
29767        closeArray();
29768      };
29769      if (element.hasReference()) {
29770        composeReference("reference", element.getReference());
29771      }
29772      if (element.hasDetail()) {
29773        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
29774      }
29775  }
29776
29777  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
29778    if (element != null) {
29779      open(name);
29780      composeCarePlanCarePlanActivityDetailComponentInner(element);
29781      close();
29782    }
29783  }
29784
29785  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
29786      composeBackbone(element);
29787      if (element.hasKindElement()) {
29788        composeEnumerationCore("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
29789        composeEnumerationExtras("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
29790      }
29791      if (element.hasInstantiatesElement()) {
29792        composeUriCore("instantiates", element.getInstantiatesElement(), false);
29793        composeUriExtras("instantiates", element.getInstantiatesElement(), false);
29794      }
29795      if (element.hasCode()) {
29796        composeCodeableConcept("code", element.getCode());
29797      }
29798      if (element.hasReasonCode()) {
29799        openArray("reasonCode");
29800        for (CodeableConcept e : element.getReasonCode()) 
29801          composeCodeableConcept(null, e);
29802        closeArray();
29803      };
29804      if (element.hasReasonReference()) {
29805        openArray("reasonReference");
29806        for (Reference e : element.getReasonReference()) 
29807          composeReference(null, e);
29808        closeArray();
29809      };
29810      if (element.hasGoal()) {
29811        openArray("goal");
29812        for (Reference e : element.getGoal()) 
29813          composeReference(null, e);
29814        closeArray();
29815      };
29816      if (element.hasStatusElement()) {
29817        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
29818        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
29819      }
29820      if (element.hasStatusReasonElement()) {
29821        composeStringCore("statusReason", element.getStatusReasonElement(), false);
29822        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
29823      }
29824      if (element.hasDoNotPerformElement()) {
29825        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
29826        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
29827      }
29828      if (element.hasScheduled()) {
29829        composeType("scheduled", element.getScheduled());
29830      }
29831      if (element.hasLocation()) {
29832        composeReference("location", element.getLocation());
29833      }
29834      if (element.hasPerformer()) {
29835        openArray("performer");
29836        for (Reference e : element.getPerformer()) 
29837          composeReference(null, e);
29838        closeArray();
29839      };
29840      if (element.hasProduct()) {
29841        composeType("product", element.getProduct());
29842      }
29843      if (element.hasDailyAmount()) {
29844        composeSimpleQuantity("dailyAmount", element.getDailyAmount());
29845      }
29846      if (element.hasQuantity()) {
29847        composeSimpleQuantity("quantity", element.getQuantity());
29848      }
29849      if (element.hasDescriptionElement()) {
29850        composeStringCore("description", element.getDescriptionElement(), false);
29851        composeStringExtras("description", element.getDescriptionElement(), false);
29852      }
29853  }
29854
29855  protected void composeCareTeam(String name, CareTeam element) throws IOException {
29856    if (element != null) {
29857      prop("resourceType", name);
29858      composeCareTeamInner(element);
29859    }
29860  }
29861
29862  protected void composeCareTeamInner(CareTeam element) throws IOException {
29863      composeDomainResourceElements(element);
29864      if (element.hasIdentifier()) {
29865        openArray("identifier");
29866        for (Identifier e : element.getIdentifier()) 
29867          composeIdentifier(null, e);
29868        closeArray();
29869      };
29870      if (element.hasStatusElement()) {
29871        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
29872        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
29873      }
29874      if (element.hasCategory()) {
29875        openArray("category");
29876        for (CodeableConcept e : element.getCategory()) 
29877          composeCodeableConcept(null, e);
29878        closeArray();
29879      };
29880      if (element.hasNameElement()) {
29881        composeStringCore("name", element.getNameElement(), false);
29882        composeStringExtras("name", element.getNameElement(), false);
29883      }
29884      if (element.hasSubject()) {
29885        composeReference("subject", element.getSubject());
29886      }
29887      if (element.hasContext()) {
29888        composeReference("context", element.getContext());
29889      }
29890      if (element.hasPeriod()) {
29891        composePeriod("period", element.getPeriod());
29892      }
29893      if (element.hasParticipant()) {
29894        openArray("participant");
29895        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
29896          composeCareTeamCareTeamParticipantComponent(null, e);
29897        closeArray();
29898      };
29899      if (element.hasReasonCode()) {
29900        openArray("reasonCode");
29901        for (CodeableConcept e : element.getReasonCode()) 
29902          composeCodeableConcept(null, e);
29903        closeArray();
29904      };
29905      if (element.hasReasonReference()) {
29906        openArray("reasonReference");
29907        for (Reference e : element.getReasonReference()) 
29908          composeReference(null, e);
29909        closeArray();
29910      };
29911      if (element.hasManagingOrganization()) {
29912        openArray("managingOrganization");
29913        for (Reference e : element.getManagingOrganization()) 
29914          composeReference(null, e);
29915        closeArray();
29916      };
29917      if (element.hasTelecom()) {
29918        openArray("telecom");
29919        for (ContactPoint e : element.getTelecom()) 
29920          composeContactPoint(null, e);
29921        closeArray();
29922      };
29923      if (element.hasNote()) {
29924        openArray("note");
29925        for (Annotation e : element.getNote()) 
29926          composeAnnotation(null, e);
29927        closeArray();
29928      };
29929  }
29930
29931  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
29932    if (element != null) {
29933      open(name);
29934      composeCareTeamCareTeamParticipantComponentInner(element);
29935      close();
29936    }
29937  }
29938
29939  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
29940      composeBackbone(element);
29941      if (element.hasRole()) {
29942        composeCodeableConcept("role", element.getRole());
29943      }
29944      if (element.hasMember()) {
29945        composeReference("member", element.getMember());
29946      }
29947      if (element.hasOnBehalfOf()) {
29948        composeReference("onBehalfOf", element.getOnBehalfOf());
29949      }
29950      if (element.hasPeriod()) {
29951        composePeriod("period", element.getPeriod());
29952      }
29953  }
29954
29955  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
29956    if (element != null) {
29957      prop("resourceType", name);
29958      composeChargeItemInner(element);
29959    }
29960  }
29961
29962  protected void composeChargeItemInner(ChargeItem element) throws IOException {
29963      composeDomainResourceElements(element);
29964      if (element.hasIdentifier()) {
29965        openArray("identifier");
29966        for (Identifier e : element.getIdentifier()) 
29967          composeIdentifier(null, e);
29968        closeArray();
29969      };
29970      if (element.hasDefinition()) {
29971        openArray("definition");
29972        for (UriType e : element.getDefinition()) 
29973          composeUriCore(null, e, true);
29974        closeArray();
29975        if (anyHasExtras(element.getDefinition())) {
29976          openArray("_definition");
29977          for (UriType e : element.getDefinition()) 
29978            composeUriExtras(null, e, true);
29979          closeArray();
29980        }
29981      };
29982      if (element.hasStatusElement()) {
29983        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
29984        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
29985      }
29986      if (element.hasPartOf()) {
29987        openArray("partOf");
29988        for (Reference e : element.getPartOf()) 
29989          composeReference(null, e);
29990        closeArray();
29991      };
29992      if (element.hasCode()) {
29993        composeCodeableConcept("code", element.getCode());
29994      }
29995      if (element.hasSubject()) {
29996        composeReference("subject", element.getSubject());
29997      }
29998      if (element.hasContext()) {
29999        composeReference("context", element.getContext());
30000      }
30001      if (element.hasOccurrence()) {
30002        composeType("occurrence", element.getOccurrence());
30003      }
30004      if (element.hasParticipant()) {
30005        openArray("participant");
30006        for (ChargeItem.ChargeItemParticipantComponent e : element.getParticipant()) 
30007          composeChargeItemChargeItemParticipantComponent(null, e);
30008        closeArray();
30009      };
30010      if (element.hasPerformingOrganization()) {
30011        composeReference("performingOrganization", element.getPerformingOrganization());
30012      }
30013      if (element.hasRequestingOrganization()) {
30014        composeReference("requestingOrganization", element.getRequestingOrganization());
30015      }
30016      if (element.hasCostCenter()) {
30017        composeReference("costCenter", element.getCostCenter());
30018      }
30019      if (element.hasQuantity()) {
30020        composeQuantity("quantity", element.getQuantity());
30021      }
30022      if (element.hasBodysite()) {
30023        openArray("bodysite");
30024        for (CodeableConcept e : element.getBodysite()) 
30025          composeCodeableConcept(null, e);
30026        closeArray();
30027      };
30028      if (element.hasFactorOverrideElement()) {
30029        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
30030        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
30031      }
30032      if (element.hasPriceOverride()) {
30033        composeMoney("priceOverride", element.getPriceOverride());
30034      }
30035      if (element.hasOverrideReasonElement()) {
30036        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
30037        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
30038      }
30039      if (element.hasEnterer()) {
30040        composeReference("enterer", element.getEnterer());
30041      }
30042      if (element.hasEnteredDateElement()) {
30043        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
30044        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
30045      }
30046      if (element.hasReason()) {
30047        openArray("reason");
30048        for (CodeableConcept e : element.getReason()) 
30049          composeCodeableConcept(null, e);
30050        closeArray();
30051      };
30052      if (element.hasService()) {
30053        openArray("service");
30054        for (Reference e : element.getService()) 
30055          composeReference(null, e);
30056        closeArray();
30057      };
30058      if (element.hasAccount()) {
30059        openArray("account");
30060        for (Reference e : element.getAccount()) 
30061          composeReference(null, e);
30062        closeArray();
30063      };
30064      if (element.hasNote()) {
30065        openArray("note");
30066        for (Annotation e : element.getNote()) 
30067          composeAnnotation(null, e);
30068        closeArray();
30069      };
30070      if (element.hasSupportingInformation()) {
30071        openArray("supportingInformation");
30072        for (Reference e : element.getSupportingInformation()) 
30073          composeReference(null, e);
30074        closeArray();
30075      };
30076  }
30077
30078  protected void composeChargeItemChargeItemParticipantComponent(String name, ChargeItem.ChargeItemParticipantComponent element) throws IOException {
30079    if (element != null) {
30080      open(name);
30081      composeChargeItemChargeItemParticipantComponentInner(element);
30082      close();
30083    }
30084  }
30085
30086  protected void composeChargeItemChargeItemParticipantComponentInner(ChargeItem.ChargeItemParticipantComponent element) throws IOException {
30087      composeBackbone(element);
30088      if (element.hasRole()) {
30089        composeCodeableConcept("role", element.getRole());
30090      }
30091      if (element.hasActor()) {
30092        composeReference("actor", element.getActor());
30093      }
30094  }
30095
30096  protected void composeClaim(String name, Claim element) throws IOException {
30097    if (element != null) {
30098      prop("resourceType", name);
30099      composeClaimInner(element);
30100    }
30101  }
30102
30103  protected void composeClaimInner(Claim element) throws IOException {
30104      composeDomainResourceElements(element);
30105      if (element.hasIdentifier()) {
30106        openArray("identifier");
30107        for (Identifier e : element.getIdentifier()) 
30108          composeIdentifier(null, e);
30109        closeArray();
30110      };
30111      if (element.hasStatusElement()) {
30112        composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
30113        composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
30114      }
30115      if (element.hasType()) {
30116        composeCodeableConcept("type", element.getType());
30117      }
30118      if (element.hasSubType()) {
30119        openArray("subType");
30120        for (CodeableConcept e : element.getSubType()) 
30121          composeCodeableConcept(null, e);
30122        closeArray();
30123      };
30124      if (element.hasUseElement()) {
30125        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
30126        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
30127      }
30128      if (element.hasPatient()) {
30129        composeReference("patient", element.getPatient());
30130      }
30131      if (element.hasBillablePeriod()) {
30132        composePeriod("billablePeriod", element.getBillablePeriod());
30133      }
30134      if (element.hasCreatedElement()) {
30135        composeDateTimeCore("created", element.getCreatedElement(), false);
30136        composeDateTimeExtras("created", element.getCreatedElement(), false);
30137      }
30138      if (element.hasEnterer()) {
30139        composeReference("enterer", element.getEnterer());
30140      }
30141      if (element.hasInsurer()) {
30142        composeReference("insurer", element.getInsurer());
30143      }
30144      if (element.hasProvider()) {
30145        composeReference("provider", element.getProvider());
30146      }
30147      if (element.hasPriority()) {
30148        composeCodeableConcept("priority", element.getPriority());
30149      }
30150      if (element.hasFundsReserve()) {
30151        composeCodeableConcept("fundsReserve", element.getFundsReserve());
30152      }
30153      if (element.hasRelated()) {
30154        openArray("related");
30155        for (Claim.RelatedClaimComponent e : element.getRelated()) 
30156          composeClaimRelatedClaimComponent(null, e);
30157        closeArray();
30158      };
30159      if (element.hasPrescription()) {
30160        composeReference("prescription", element.getPrescription());
30161      }
30162      if (element.hasOriginalPrescription()) {
30163        composeReference("originalPrescription", element.getOriginalPrescription());
30164      }
30165      if (element.hasPayee()) {
30166        composeClaimPayeeComponent("payee", element.getPayee());
30167      }
30168      if (element.hasReferral()) {
30169        composeReference("referral", element.getReferral());
30170      }
30171      if (element.hasFacility()) {
30172        composeReference("facility", element.getFacility());
30173      }
30174      if (element.hasCareTeam()) {
30175        openArray("careTeam");
30176        for (Claim.CareTeamComponent e : element.getCareTeam()) 
30177          composeClaimCareTeamComponent(null, e);
30178        closeArray();
30179      };
30180      if (element.hasInformation()) {
30181        openArray("information");
30182        for (Claim.SpecialConditionComponent e : element.getInformation()) 
30183          composeClaimSpecialConditionComponent(null, e);
30184        closeArray();
30185      };
30186      if (element.hasDiagnosis()) {
30187        openArray("diagnosis");
30188        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
30189          composeClaimDiagnosisComponent(null, e);
30190        closeArray();
30191      };
30192      if (element.hasProcedure()) {
30193        openArray("procedure");
30194        for (Claim.ProcedureComponent e : element.getProcedure()) 
30195          composeClaimProcedureComponent(null, e);
30196        closeArray();
30197      };
30198      if (element.hasInsurance()) {
30199        openArray("insurance");
30200        for (Claim.InsuranceComponent e : element.getInsurance()) 
30201          composeClaimInsuranceComponent(null, e);
30202        closeArray();
30203      };
30204      if (element.hasAccident()) {
30205        composeClaimAccidentComponent("accident", element.getAccident());
30206      }
30207      if (element.hasItem()) {
30208        openArray("item");
30209        for (Claim.ItemComponent e : element.getItem()) 
30210          composeClaimItemComponent(null, e);
30211        closeArray();
30212      };
30213      if (element.hasTotal()) {
30214        composeMoney("total", element.getTotal());
30215      }
30216  }
30217
30218  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
30219    if (element != null) {
30220      open(name);
30221      composeClaimRelatedClaimComponentInner(element);
30222      close();
30223    }
30224  }
30225
30226  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
30227      composeBackbone(element);
30228      if (element.hasClaim()) {
30229        composeReference("claim", element.getClaim());
30230      }
30231      if (element.hasRelationship()) {
30232        composeCodeableConcept("relationship", element.getRelationship());
30233      }
30234      if (element.hasReference()) {
30235        composeIdentifier("reference", element.getReference());
30236      }
30237  }
30238
30239  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
30240    if (element != null) {
30241      open(name);
30242      composeClaimPayeeComponentInner(element);
30243      close();
30244    }
30245  }
30246
30247  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
30248      composeBackbone(element);
30249      if (element.hasType()) {
30250        composeCodeableConcept("type", element.getType());
30251      }
30252      if (element.hasResource()) {
30253        composeCoding("resource", element.getResource());
30254      }
30255      if (element.hasParty()) {
30256        composeReference("party", element.getParty());
30257      }
30258  }
30259
30260  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
30261    if (element != null) {
30262      open(name);
30263      composeClaimCareTeamComponentInner(element);
30264      close();
30265    }
30266  }
30267
30268  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
30269      composeBackbone(element);
30270      if (element.hasSequenceElement()) {
30271        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30272        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30273      }
30274      if (element.hasProvider()) {
30275        composeReference("provider", element.getProvider());
30276      }
30277      if (element.hasResponsibleElement()) {
30278        composeBooleanCore("responsible", element.getResponsibleElement(), false);
30279        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
30280      }
30281      if (element.hasRole()) {
30282        composeCodeableConcept("role", element.getRole());
30283      }
30284      if (element.hasQualification()) {
30285        composeCodeableConcept("qualification", element.getQualification());
30286      }
30287  }
30288
30289  protected void composeClaimSpecialConditionComponent(String name, Claim.SpecialConditionComponent element) throws IOException {
30290    if (element != null) {
30291      open(name);
30292      composeClaimSpecialConditionComponentInner(element);
30293      close();
30294    }
30295  }
30296
30297  protected void composeClaimSpecialConditionComponentInner(Claim.SpecialConditionComponent element) throws IOException {
30298      composeBackbone(element);
30299      if (element.hasSequenceElement()) {
30300        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30301        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30302      }
30303      if (element.hasCategory()) {
30304        composeCodeableConcept("category", element.getCategory());
30305      }
30306      if (element.hasCode()) {
30307        composeCodeableConcept("code", element.getCode());
30308      }
30309      if (element.hasTiming()) {
30310        composeType("timing", element.getTiming());
30311      }
30312      if (element.hasValue()) {
30313        composeType("value", element.getValue());
30314      }
30315      if (element.hasReason()) {
30316        composeCodeableConcept("reason", element.getReason());
30317      }
30318  }
30319
30320  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
30321    if (element != null) {
30322      open(name);
30323      composeClaimDiagnosisComponentInner(element);
30324      close();
30325    }
30326  }
30327
30328  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
30329      composeBackbone(element);
30330      if (element.hasSequenceElement()) {
30331        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30332        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30333      }
30334      if (element.hasDiagnosis()) {
30335        composeType("diagnosis", element.getDiagnosis());
30336      }
30337      if (element.hasType()) {
30338        openArray("type");
30339        for (CodeableConcept e : element.getType()) 
30340          composeCodeableConcept(null, e);
30341        closeArray();
30342      };
30343      if (element.hasPackageCode()) {
30344        composeCodeableConcept("packageCode", element.getPackageCode());
30345      }
30346  }
30347
30348  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
30349    if (element != null) {
30350      open(name);
30351      composeClaimProcedureComponentInner(element);
30352      close();
30353    }
30354  }
30355
30356  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
30357      composeBackbone(element);
30358      if (element.hasSequenceElement()) {
30359        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30360        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30361      }
30362      if (element.hasDateElement()) {
30363        composeDateTimeCore("date", element.getDateElement(), false);
30364        composeDateTimeExtras("date", element.getDateElement(), false);
30365      }
30366      if (element.hasProcedure()) {
30367        composeType("procedure", element.getProcedure());
30368      }
30369  }
30370
30371  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
30372    if (element != null) {
30373      open(name);
30374      composeClaimInsuranceComponentInner(element);
30375      close();
30376    }
30377  }
30378
30379  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
30380      composeBackbone(element);
30381      if (element.hasSequenceElement()) {
30382        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30383        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30384      }
30385      if (element.hasFocalElement()) {
30386        composeBooleanCore("focal", element.getFocalElement(), false);
30387        composeBooleanExtras("focal", element.getFocalElement(), false);
30388      }
30389      if (element.hasIdentifier()) {
30390        composeIdentifier("identifier", element.getIdentifier());
30391      }
30392      if (element.hasCoverage()) {
30393        composeReference("coverage", element.getCoverage());
30394      }
30395      if (element.hasBusinessArrangementElement()) {
30396        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
30397        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
30398      }
30399      if (element.hasPreAuthRef()) {
30400        openArray("preAuthRef");
30401        for (StringType e : element.getPreAuthRef()) 
30402          composeStringCore(null, e, true);
30403        closeArray();
30404        if (anyHasExtras(element.getPreAuthRef())) {
30405          openArray("_preAuthRef");
30406          for (StringType e : element.getPreAuthRef()) 
30407            composeStringExtras(null, e, true);
30408          closeArray();
30409        }
30410      };
30411      if (element.hasClaimResponse()) {
30412        composeReference("claimResponse", element.getClaimResponse());
30413      }
30414  }
30415
30416  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
30417    if (element != null) {
30418      open(name);
30419      composeClaimAccidentComponentInner(element);
30420      close();
30421    }
30422  }
30423
30424  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
30425      composeBackbone(element);
30426      if (element.hasDateElement()) {
30427        composeDateCore("date", element.getDateElement(), false);
30428        composeDateExtras("date", element.getDateElement(), false);
30429      }
30430      if (element.hasType()) {
30431        composeCodeableConcept("type", element.getType());
30432      }
30433      if (element.hasLocation()) {
30434        composeType("location", element.getLocation());
30435      }
30436  }
30437
30438  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
30439    if (element != null) {
30440      open(name);
30441      composeClaimItemComponentInner(element);
30442      close();
30443    }
30444  }
30445
30446  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
30447      composeBackbone(element);
30448      if (element.hasSequenceElement()) {
30449        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30450        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30451      }
30452      if (element.hasCareTeamSequence()) {
30453        openArray("careTeamSequence");
30454        for (PositiveIntType e : element.getCareTeamSequence()) 
30455          composePositiveIntCore(null, e, true);
30456        closeArray();
30457        if (anyHasExtras(element.getCareTeamSequence())) {
30458          openArray("_careTeamSequence");
30459          for (PositiveIntType e : element.getCareTeamSequence()) 
30460            composePositiveIntExtras(null, e, true);
30461          closeArray();
30462        }
30463      };
30464      if (element.hasDiagnosisSequence()) {
30465        openArray("diagnosisSequence");
30466        for (PositiveIntType e : element.getDiagnosisSequence()) 
30467          composePositiveIntCore(null, e, true);
30468        closeArray();
30469        if (anyHasExtras(element.getDiagnosisSequence())) {
30470          openArray("_diagnosisSequence");
30471          for (PositiveIntType e : element.getDiagnosisSequence()) 
30472            composePositiveIntExtras(null, e, true);
30473          closeArray();
30474        }
30475      };
30476      if (element.hasProcedureSequence()) {
30477        openArray("procedureSequence");
30478        for (PositiveIntType e : element.getProcedureSequence()) 
30479          composePositiveIntCore(null, e, true);
30480        closeArray();
30481        if (anyHasExtras(element.getProcedureSequence())) {
30482          openArray("_procedureSequence");
30483          for (PositiveIntType e : element.getProcedureSequence()) 
30484            composePositiveIntExtras(null, e, true);
30485          closeArray();
30486        }
30487      };
30488      if (element.hasInformationSequence()) {
30489        openArray("informationSequence");
30490        for (PositiveIntType e : element.getInformationSequence()) 
30491          composePositiveIntCore(null, e, true);
30492        closeArray();
30493        if (anyHasExtras(element.getInformationSequence())) {
30494          openArray("_informationSequence");
30495          for (PositiveIntType e : element.getInformationSequence()) 
30496            composePositiveIntExtras(null, e, true);
30497          closeArray();
30498        }
30499      };
30500      if (element.hasRevenue()) {
30501        composeCodeableConcept("revenue", element.getRevenue());
30502      }
30503      if (element.hasCategory()) {
30504        composeCodeableConcept("category", element.getCategory());
30505      }
30506      if (element.hasService()) {
30507        composeCodeableConcept("service", element.getService());
30508      }
30509      if (element.hasModifier()) {
30510        openArray("modifier");
30511        for (CodeableConcept e : element.getModifier()) 
30512          composeCodeableConcept(null, e);
30513        closeArray();
30514      };
30515      if (element.hasProgramCode()) {
30516        openArray("programCode");
30517        for (CodeableConcept e : element.getProgramCode()) 
30518          composeCodeableConcept(null, e);
30519        closeArray();
30520      };
30521      if (element.hasServiced()) {
30522        composeType("serviced", element.getServiced());
30523      }
30524      if (element.hasLocation()) {
30525        composeType("location", element.getLocation());
30526      }
30527      if (element.hasQuantity()) {
30528        composeSimpleQuantity("quantity", element.getQuantity());
30529      }
30530      if (element.hasUnitPrice()) {
30531        composeMoney("unitPrice", element.getUnitPrice());
30532      }
30533      if (element.hasFactorElement()) {
30534        composeDecimalCore("factor", element.getFactorElement(), false);
30535        composeDecimalExtras("factor", element.getFactorElement(), false);
30536      }
30537      if (element.hasNet()) {
30538        composeMoney("net", element.getNet());
30539      }
30540      if (element.hasUdi()) {
30541        openArray("udi");
30542        for (Reference e : element.getUdi()) 
30543          composeReference(null, e);
30544        closeArray();
30545      };
30546      if (element.hasBodySite()) {
30547        composeCodeableConcept("bodySite", element.getBodySite());
30548      }
30549      if (element.hasSubSite()) {
30550        openArray("subSite");
30551        for (CodeableConcept e : element.getSubSite()) 
30552          composeCodeableConcept(null, e);
30553        closeArray();
30554      };
30555      if (element.hasEncounter()) {
30556        openArray("encounter");
30557        for (Reference e : element.getEncounter()) 
30558          composeReference(null, e);
30559        closeArray();
30560      };
30561      if (element.hasDetail()) {
30562        openArray("detail");
30563        for (Claim.DetailComponent e : element.getDetail()) 
30564          composeClaimDetailComponent(null, e);
30565        closeArray();
30566      };
30567  }
30568
30569  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
30570    if (element != null) {
30571      open(name);
30572      composeClaimDetailComponentInner(element);
30573      close();
30574    }
30575  }
30576
30577  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
30578      composeBackbone(element);
30579      if (element.hasSequenceElement()) {
30580        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30581        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30582      }
30583      if (element.hasRevenue()) {
30584        composeCodeableConcept("revenue", element.getRevenue());
30585      }
30586      if (element.hasCategory()) {
30587        composeCodeableConcept("category", element.getCategory());
30588      }
30589      if (element.hasService()) {
30590        composeCodeableConcept("service", element.getService());
30591      }
30592      if (element.hasModifier()) {
30593        openArray("modifier");
30594        for (CodeableConcept e : element.getModifier()) 
30595          composeCodeableConcept(null, e);
30596        closeArray();
30597      };
30598      if (element.hasProgramCode()) {
30599        openArray("programCode");
30600        for (CodeableConcept e : element.getProgramCode()) 
30601          composeCodeableConcept(null, e);
30602        closeArray();
30603      };
30604      if (element.hasQuantity()) {
30605        composeSimpleQuantity("quantity", element.getQuantity());
30606      }
30607      if (element.hasUnitPrice()) {
30608        composeMoney("unitPrice", element.getUnitPrice());
30609      }
30610      if (element.hasFactorElement()) {
30611        composeDecimalCore("factor", element.getFactorElement(), false);
30612        composeDecimalExtras("factor", element.getFactorElement(), false);
30613      }
30614      if (element.hasNet()) {
30615        composeMoney("net", element.getNet());
30616      }
30617      if (element.hasUdi()) {
30618        openArray("udi");
30619        for (Reference e : element.getUdi()) 
30620          composeReference(null, e);
30621        closeArray();
30622      };
30623      if (element.hasSubDetail()) {
30624        openArray("subDetail");
30625        for (Claim.SubDetailComponent e : element.getSubDetail()) 
30626          composeClaimSubDetailComponent(null, e);
30627        closeArray();
30628      };
30629  }
30630
30631  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
30632    if (element != null) {
30633      open(name);
30634      composeClaimSubDetailComponentInner(element);
30635      close();
30636    }
30637  }
30638
30639  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
30640      composeBackbone(element);
30641      if (element.hasSequenceElement()) {
30642        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30643        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30644      }
30645      if (element.hasRevenue()) {
30646        composeCodeableConcept("revenue", element.getRevenue());
30647      }
30648      if (element.hasCategory()) {
30649        composeCodeableConcept("category", element.getCategory());
30650      }
30651      if (element.hasService()) {
30652        composeCodeableConcept("service", element.getService());
30653      }
30654      if (element.hasModifier()) {
30655        openArray("modifier");
30656        for (CodeableConcept e : element.getModifier()) 
30657          composeCodeableConcept(null, e);
30658        closeArray();
30659      };
30660      if (element.hasProgramCode()) {
30661        openArray("programCode");
30662        for (CodeableConcept e : element.getProgramCode()) 
30663          composeCodeableConcept(null, e);
30664        closeArray();
30665      };
30666      if (element.hasQuantity()) {
30667        composeSimpleQuantity("quantity", element.getQuantity());
30668      }
30669      if (element.hasUnitPrice()) {
30670        composeMoney("unitPrice", element.getUnitPrice());
30671      }
30672      if (element.hasFactorElement()) {
30673        composeDecimalCore("factor", element.getFactorElement(), false);
30674        composeDecimalExtras("factor", element.getFactorElement(), false);
30675      }
30676      if (element.hasNet()) {
30677        composeMoney("net", element.getNet());
30678      }
30679      if (element.hasUdi()) {
30680        openArray("udi");
30681        for (Reference e : element.getUdi()) 
30682          composeReference(null, e);
30683        closeArray();
30684      };
30685  }
30686
30687  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
30688    if (element != null) {
30689      prop("resourceType", name);
30690      composeClaimResponseInner(element);
30691    }
30692  }
30693
30694  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
30695      composeDomainResourceElements(element);
30696      if (element.hasIdentifier()) {
30697        openArray("identifier");
30698        for (Identifier e : element.getIdentifier()) 
30699          composeIdentifier(null, e);
30700        closeArray();
30701      };
30702      if (element.hasStatusElement()) {
30703        composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
30704        composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
30705      }
30706      if (element.hasType()) {
30707        composeCodeableConcept("type", element.getType());
30708      }
30709      if (element.hasSubType()) {
30710        openArray("subType");
30711        for (CodeableConcept e : element.getSubType()) 
30712          composeCodeableConcept(null, e);
30713        closeArray();
30714      };
30715      if (element.hasUseElement()) {
30716        composeEnumerationCore("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
30717        composeEnumerationExtras("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
30718      }
30719      if (element.hasPatient()) {
30720        composeReference("patient", element.getPatient());
30721      }
30722      if (element.hasCreatedElement()) {
30723        composeDateTimeCore("created", element.getCreatedElement(), false);
30724        composeDateTimeExtras("created", element.getCreatedElement(), false);
30725      }
30726      if (element.hasInsurer()) {
30727        composeReference("insurer", element.getInsurer());
30728      }
30729      if (element.hasRequestProvider()) {
30730        composeReference("requestProvider", element.getRequestProvider());
30731      }
30732      if (element.hasRequest()) {
30733        composeReference("request", element.getRequest());
30734      }
30735      if (element.hasOutcomeElement()) {
30736        composeEnumerationCore("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
30737        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
30738      }
30739      if (element.hasDispositionElement()) {
30740        composeStringCore("disposition", element.getDispositionElement(), false);
30741        composeStringExtras("disposition", element.getDispositionElement(), false);
30742      }
30743      if (element.hasPayeeType()) {
30744        composeCodeableConcept("payeeType", element.getPayeeType());
30745      }
30746      if (element.hasItem()) {
30747        openArray("item");
30748        for (ClaimResponse.ItemComponent e : element.getItem()) 
30749          composeClaimResponseItemComponent(null, e);
30750        closeArray();
30751      };
30752      if (element.hasAddItem()) {
30753        openArray("addItem");
30754        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
30755          composeClaimResponseAddedItemComponent(null, e);
30756        closeArray();
30757      };
30758      if (element.hasError()) {
30759        openArray("error");
30760        for (ClaimResponse.ErrorComponent e : element.getError()) 
30761          composeClaimResponseErrorComponent(null, e);
30762        closeArray();
30763      };
30764      if (element.hasTotal()) {
30765        openArray("total");
30766        for (ClaimResponse.TotalComponent e : element.getTotal()) 
30767          composeClaimResponseTotalComponent(null, e);
30768        closeArray();
30769      };
30770      if (element.hasPayment()) {
30771        composeClaimResponsePaymentComponent("payment", element.getPayment());
30772      }
30773      if (element.hasReserved()) {
30774        composeCoding("reserved", element.getReserved());
30775      }
30776      if (element.hasForm()) {
30777        composeCodeableConcept("form", element.getForm());
30778      }
30779      if (element.hasProcessNote()) {
30780        openArray("processNote");
30781        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
30782          composeClaimResponseNoteComponent(null, e);
30783        closeArray();
30784      };
30785      if (element.hasCommunicationRequest()) {
30786        openArray("communicationRequest");
30787        for (Reference e : element.getCommunicationRequest()) 
30788          composeReference(null, e);
30789        closeArray();
30790      };
30791      if (element.hasInsurance()) {
30792        openArray("insurance");
30793        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
30794          composeClaimResponseInsuranceComponent(null, e);
30795        closeArray();
30796      };
30797  }
30798
30799  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
30800    if (element != null) {
30801      open(name);
30802      composeClaimResponseItemComponentInner(element);
30803      close();
30804    }
30805  }
30806
30807  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
30808      composeBackbone(element);
30809      if (element.hasItemSequenceElement()) {
30810        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
30811        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
30812      }
30813      if (element.hasNoteNumber()) {
30814        openArray("noteNumber");
30815        for (PositiveIntType e : element.getNoteNumber()) 
30816          composePositiveIntCore(null, e, true);
30817        closeArray();
30818        if (anyHasExtras(element.getNoteNumber())) {
30819          openArray("_noteNumber");
30820          for (PositiveIntType e : element.getNoteNumber()) 
30821            composePositiveIntExtras(null, e, true);
30822          closeArray();
30823        }
30824      };
30825      if (element.hasAdjudication()) {
30826        openArray("adjudication");
30827        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
30828          composeClaimResponseAdjudicationComponent(null, e);
30829        closeArray();
30830      };
30831      if (element.hasDetail()) {
30832        openArray("detail");
30833        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
30834          composeClaimResponseItemDetailComponent(null, e);
30835        closeArray();
30836      };
30837  }
30838
30839  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
30840    if (element != null) {
30841      open(name);
30842      composeClaimResponseAdjudicationComponentInner(element);
30843      close();
30844    }
30845  }
30846
30847  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element) throws IOException {
30848      composeBackbone(element);
30849      if (element.hasCategory()) {
30850        composeCodeableConcept("category", element.getCategory());
30851      }
30852      if (element.hasReason()) {
30853        composeCodeableConcept("reason", element.getReason());
30854      }
30855      if (element.hasAmount()) {
30856        composeMoney("amount", element.getAmount());
30857      }
30858      if (element.hasValueElement()) {
30859        composeDecimalCore("value", element.getValueElement(), false);
30860        composeDecimalExtras("value", element.getValueElement(), false);
30861      }
30862  }
30863
30864  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
30865    if (element != null) {
30866      open(name);
30867      composeClaimResponseItemDetailComponentInner(element);
30868      close();
30869    }
30870  }
30871
30872  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
30873      composeBackbone(element);
30874      if (element.hasDetailSequenceElement()) {
30875        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
30876        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
30877      }
30878      if (element.hasNoteNumber()) {
30879        openArray("noteNumber");
30880        for (PositiveIntType e : element.getNoteNumber()) 
30881          composePositiveIntCore(null, e, true);
30882        closeArray();
30883        if (anyHasExtras(element.getNoteNumber())) {
30884          openArray("_noteNumber");
30885          for (PositiveIntType e : element.getNoteNumber()) 
30886            composePositiveIntExtras(null, e, true);
30887          closeArray();
30888        }
30889      };
30890      if (element.hasAdjudication()) {
30891        openArray("adjudication");
30892        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
30893          composeClaimResponseAdjudicationComponent(null, e);
30894        closeArray();
30895      };
30896      if (element.hasSubDetail()) {
30897        openArray("subDetail");
30898        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
30899          composeClaimResponseSubDetailComponent(null, e);
30900        closeArray();
30901      };
30902  }
30903
30904  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
30905    if (element != null) {
30906      open(name);
30907      composeClaimResponseSubDetailComponentInner(element);
30908      close();
30909    }
30910  }
30911
30912  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
30913      composeBackbone(element);
30914      if (element.hasSubDetailSequenceElement()) {
30915        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
30916        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
30917      }
30918      if (element.hasNoteNumber()) {
30919        openArray("noteNumber");
30920        for (PositiveIntType e : element.getNoteNumber()) 
30921          composePositiveIntCore(null, e, true);
30922        closeArray();
30923        if (anyHasExtras(element.getNoteNumber())) {
30924          openArray("_noteNumber");
30925          for (PositiveIntType e : element.getNoteNumber()) 
30926            composePositiveIntExtras(null, e, true);
30927          closeArray();
30928        }
30929      };
30930      if (element.hasAdjudication()) {
30931        openArray("adjudication");
30932        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
30933          composeClaimResponseAdjudicationComponent(null, e);
30934        closeArray();
30935      };
30936  }
30937
30938  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
30939    if (element != null) {
30940      open(name);
30941      composeClaimResponseAddedItemComponentInner(element);
30942      close();
30943    }
30944  }
30945
30946  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
30947      composeBackbone(element);
30948      if (element.hasItemSequence()) {
30949        openArray("itemSequence");
30950        for (PositiveIntType e : element.getItemSequence()) 
30951          composePositiveIntCore(null, e, true);
30952        closeArray();
30953        if (anyHasExtras(element.getItemSequence())) {
30954          openArray("_itemSequence");
30955          for (PositiveIntType e : element.getItemSequence()) 
30956            composePositiveIntExtras(null, e, true);
30957          closeArray();
30958        }
30959      };
30960      if (element.hasDetailSequence()) {
30961        openArray("detailSequence");
30962        for (PositiveIntType e : element.getDetailSequence()) 
30963          composePositiveIntCore(null, e, true);
30964        closeArray();
30965        if (anyHasExtras(element.getDetailSequence())) {
30966          openArray("_detailSequence");
30967          for (PositiveIntType e : element.getDetailSequence()) 
30968            composePositiveIntExtras(null, e, true);
30969          closeArray();
30970        }
30971      };
30972      if (element.hasSubdetailSequence()) {
30973        openArray("subdetailSequence");
30974        for (PositiveIntType e : element.getSubdetailSequence()) 
30975          composePositiveIntCore(null, e, true);
30976        closeArray();
30977        if (anyHasExtras(element.getSubdetailSequence())) {
30978          openArray("_subdetailSequence");
30979          for (PositiveIntType e : element.getSubdetailSequence()) 
30980            composePositiveIntExtras(null, e, true);
30981          closeArray();
30982        }
30983      };
30984      if (element.hasService()) {
30985        composeCodeableConcept("service", element.getService());
30986      }
30987      if (element.hasModifier()) {
30988        openArray("modifier");
30989        for (CodeableConcept e : element.getModifier()) 
30990          composeCodeableConcept(null, e);
30991        closeArray();
30992      };
30993      if (element.hasFee()) {
30994        composeMoney("fee", element.getFee());
30995      }
30996      if (element.hasNoteNumber()) {
30997        openArray("noteNumber");
30998        for (PositiveIntType e : element.getNoteNumber()) 
30999          composePositiveIntCore(null, e, true);
31000        closeArray();
31001        if (anyHasExtras(element.getNoteNumber())) {
31002          openArray("_noteNumber");
31003          for (PositiveIntType e : element.getNoteNumber()) 
31004            composePositiveIntExtras(null, e, true);
31005          closeArray();
31006        }
31007      };
31008      if (element.hasAdjudication()) {
31009        openArray("adjudication");
31010        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
31011          composeClaimResponseAdjudicationComponent(null, e);
31012        closeArray();
31013      };
31014  }
31015
31016  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
31017    if (element != null) {
31018      open(name);
31019      composeClaimResponseErrorComponentInner(element);
31020      close();
31021    }
31022  }
31023
31024  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
31025      composeBackbone(element);
31026      if (element.hasItemSequenceElement()) {
31027        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
31028        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
31029      }
31030      if (element.hasDetailSequenceElement()) {
31031        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
31032        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
31033      }
31034      if (element.hasSubDetailSequenceElement()) {
31035        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
31036        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
31037      }
31038      if (element.hasCode()) {
31039        composeCodeableConcept("code", element.getCode());
31040      }
31041  }
31042
31043  protected void composeClaimResponseTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
31044    if (element != null) {
31045      open(name);
31046      composeClaimResponseTotalComponentInner(element);
31047      close();
31048    }
31049  }
31050
31051  protected void composeClaimResponseTotalComponentInner(ClaimResponse.TotalComponent element) throws IOException {
31052      composeBackbone(element);
31053      if (element.hasCategory()) {
31054        composeCodeableConcept("category", element.getCategory());
31055      }
31056      if (element.hasAmount()) {
31057        composeMoney("amount", element.getAmount());
31058      }
31059  }
31060
31061  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
31062    if (element != null) {
31063      open(name);
31064      composeClaimResponsePaymentComponentInner(element);
31065      close();
31066    }
31067  }
31068
31069  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
31070      composeBackbone(element);
31071      if (element.hasType()) {
31072        composeCodeableConcept("type", element.getType());
31073      }
31074      if (element.hasAdjustment()) {
31075        composeMoney("adjustment", element.getAdjustment());
31076      }
31077      if (element.hasAdjustmentReason()) {
31078        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
31079      }
31080      if (element.hasDateElement()) {
31081        composeDateCore("date", element.getDateElement(), false);
31082        composeDateExtras("date", element.getDateElement(), false);
31083      }
31084      if (element.hasAmount()) {
31085        composeMoney("amount", element.getAmount());
31086      }
31087      if (element.hasIdentifier()) {
31088        composeIdentifier("identifier", element.getIdentifier());
31089      }
31090  }
31091
31092  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
31093    if (element != null) {
31094      open(name);
31095      composeClaimResponseNoteComponentInner(element);
31096      close();
31097    }
31098  }
31099
31100  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
31101      composeBackbone(element);
31102      if (element.hasNumberElement()) {
31103        composePositiveIntCore("number", element.getNumberElement(), false);
31104        composePositiveIntExtras("number", element.getNumberElement(), false);
31105      }
31106      if (element.hasTypeElement()) {
31107        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
31108        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
31109      }
31110      if (element.hasTextElement()) {
31111        composeStringCore("text", element.getTextElement(), false);
31112        composeStringExtras("text", element.getTextElement(), false);
31113      }
31114      if (element.hasLanguage()) {
31115        composeCodeableConcept("language", element.getLanguage());
31116      }
31117  }
31118
31119  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
31120    if (element != null) {
31121      open(name);
31122      composeClaimResponseInsuranceComponentInner(element);
31123      close();
31124    }
31125  }
31126
31127  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element) throws IOException {
31128      composeBackbone(element);
31129      if (element.hasSequenceElement()) {
31130        composePositiveIntCore("sequence", element.getSequenceElement(), false);
31131        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
31132      }
31133      if (element.hasFocalElement()) {
31134        composeBooleanCore("focal", element.getFocalElement(), false);
31135        composeBooleanExtras("focal", element.getFocalElement(), false);
31136      }
31137      if (element.hasCoverage()) {
31138        composeReference("coverage", element.getCoverage());
31139      }
31140      if (element.hasBusinessArrangementElement()) {
31141        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
31142        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
31143      }
31144      if (element.hasPreAuthRef()) {
31145        openArray("preAuthRef");
31146        for (StringType e : element.getPreAuthRef()) 
31147          composeStringCore(null, e, true);
31148        closeArray();
31149        if (anyHasExtras(element.getPreAuthRef())) {
31150          openArray("_preAuthRef");
31151          for (StringType e : element.getPreAuthRef()) 
31152            composeStringExtras(null, e, true);
31153          closeArray();
31154        }
31155      };
31156      if (element.hasClaimResponse()) {
31157        composeReference("claimResponse", element.getClaimResponse());
31158      }
31159  }
31160
31161  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
31162    if (element != null) {
31163      prop("resourceType", name);
31164      composeClinicalImpressionInner(element);
31165    }
31166  }
31167
31168  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
31169      composeDomainResourceElements(element);
31170      if (element.hasIdentifier()) {
31171        openArray("identifier");
31172        for (Identifier e : element.getIdentifier()) 
31173          composeIdentifier(null, e);
31174        closeArray();
31175      };
31176      if (element.hasStatusElement()) {
31177        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
31178        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
31179      }
31180      if (element.hasCode()) {
31181        composeCodeableConcept("code", element.getCode());
31182      }
31183      if (element.hasDescriptionElement()) {
31184        composeStringCore("description", element.getDescriptionElement(), false);
31185        composeStringExtras("description", element.getDescriptionElement(), false);
31186      }
31187      if (element.hasSubject()) {
31188        composeReference("subject", element.getSubject());
31189      }
31190      if (element.hasContext()) {
31191        composeReference("context", element.getContext());
31192      }
31193      if (element.hasEffective()) {
31194        composeType("effective", element.getEffective());
31195      }
31196      if (element.hasDateElement()) {
31197        composeDateTimeCore("date", element.getDateElement(), false);
31198        composeDateTimeExtras("date", element.getDateElement(), false);
31199      }
31200      if (element.hasAssessor()) {
31201        composeReference("assessor", element.getAssessor());
31202      }
31203      if (element.hasPrevious()) {
31204        composeReference("previous", element.getPrevious());
31205      }
31206      if (element.hasProblem()) {
31207        openArray("problem");
31208        for (Reference e : element.getProblem()) 
31209          composeReference(null, e);
31210        closeArray();
31211      };
31212      if (element.hasInvestigation()) {
31213        openArray("investigation");
31214        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
31215          composeClinicalImpressionClinicalImpressionInvestigationComponent(null, e);
31216        closeArray();
31217      };
31218      if (element.hasProtocol()) {
31219        openArray("protocol");
31220        for (UriType e : element.getProtocol()) 
31221          composeUriCore(null, e, true);
31222        closeArray();
31223        if (anyHasExtras(element.getProtocol())) {
31224          openArray("_protocol");
31225          for (UriType e : element.getProtocol()) 
31226            composeUriExtras(null, e, true);
31227          closeArray();
31228        }
31229      };
31230      if (element.hasSummaryElement()) {
31231        composeStringCore("summary", element.getSummaryElement(), false);
31232        composeStringExtras("summary", element.getSummaryElement(), false);
31233      }
31234      if (element.hasFinding()) {
31235        openArray("finding");
31236        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
31237          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
31238        closeArray();
31239      };
31240      if (element.hasPrognosisCodeableConcept()) {
31241        openArray("prognosisCodeableConcept");
31242        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
31243          composeCodeableConcept(null, e);
31244        closeArray();
31245      };
31246      if (element.hasPrognosisReference()) {
31247        openArray("prognosisReference");
31248        for (Reference e : element.getPrognosisReference()) 
31249          composeReference(null, e);
31250        closeArray();
31251      };
31252      if (element.hasAction()) {
31253        openArray("action");
31254        for (Reference e : element.getAction()) 
31255          composeReference(null, e);
31256        closeArray();
31257      };
31258      if (element.hasNote()) {
31259        openArray("note");
31260        for (Annotation e : element.getNote()) 
31261          composeAnnotation(null, e);
31262        closeArray();
31263      };
31264  }
31265
31266  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
31267    if (element != null) {
31268      open(name);
31269      composeClinicalImpressionClinicalImpressionInvestigationComponentInner(element);
31270      close();
31271    }
31272  }
31273
31274  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentInner(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
31275      composeBackbone(element);
31276      if (element.hasCode()) {
31277        composeCodeableConcept("code", element.getCode());
31278      }
31279      if (element.hasItem()) {
31280        openArray("item");
31281        for (Reference e : element.getItem()) 
31282          composeReference(null, e);
31283        closeArray();
31284      };
31285  }
31286
31287  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
31288    if (element != null) {
31289      open(name);
31290      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
31291      close();
31292    }
31293  }
31294
31295  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
31296      composeBackbone(element);
31297      if (element.hasItemCodeableConcept()) {
31298        composeCodeableConcept("itemCodeableConcept", element.getItemCodeableConcept());
31299      }
31300      if (element.hasItemReference()) {
31301        composeReference("itemReference", element.getItemReference());
31302      }
31303      if (element.hasBasisElement()) {
31304        composeStringCore("basis", element.getBasisElement(), false);
31305        composeStringExtras("basis", element.getBasisElement(), false);
31306      }
31307  }
31308
31309  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
31310    if (element != null) {
31311      prop("resourceType", name);
31312      composeCodeSystemInner(element);
31313    }
31314  }
31315
31316  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
31317      composeDomainResourceElements(element);
31318      if (element.hasUrlElement()) {
31319        composeUriCore("url", element.getUrlElement(), false);
31320        composeUriExtras("url", element.getUrlElement(), false);
31321      }
31322      if (element.hasIdentifier()) {
31323        composeIdentifier("identifier", element.getIdentifier());
31324      }
31325      if (element.hasVersionElement()) {
31326        composeStringCore("version", element.getVersionElement(), false);
31327        composeStringExtras("version", element.getVersionElement(), false);
31328      }
31329      if (element.hasNameElement()) {
31330        composeStringCore("name", element.getNameElement(), false);
31331        composeStringExtras("name", element.getNameElement(), false);
31332      }
31333      if (element.hasTitleElement()) {
31334        composeStringCore("title", element.getTitleElement(), false);
31335        composeStringExtras("title", element.getTitleElement(), false);
31336      }
31337      if (element.hasStatusElement()) {
31338        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31339        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31340      }
31341      if (element.hasExperimentalElement()) {
31342        composeBooleanCore("experimental", element.getExperimentalElement(), false);
31343        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
31344      }
31345      if (element.hasDateElement()) {
31346        composeDateTimeCore("date", element.getDateElement(), false);
31347        composeDateTimeExtras("date", element.getDateElement(), false);
31348      }
31349      if (element.hasPublisherElement()) {
31350        composeStringCore("publisher", element.getPublisherElement(), false);
31351        composeStringExtras("publisher", element.getPublisherElement(), false);
31352      }
31353      if (element.hasContact()) {
31354        openArray("contact");
31355        for (ContactDetail e : element.getContact()) 
31356          composeContactDetail(null, e);
31357        closeArray();
31358      };
31359      if (element.hasDescriptionElement()) {
31360        composeMarkdownCore("description", element.getDescriptionElement(), false);
31361        composeMarkdownExtras("description", element.getDescriptionElement(), false);
31362      }
31363      if (element.hasUseContext()) {
31364        openArray("useContext");
31365        for (UsageContext e : element.getUseContext()) 
31366          composeUsageContext(null, e);
31367        closeArray();
31368      };
31369      if (element.hasJurisdiction()) {
31370        openArray("jurisdiction");
31371        for (CodeableConcept e : element.getJurisdiction()) 
31372          composeCodeableConcept(null, e);
31373        closeArray();
31374      };
31375      if (element.hasPurposeElement()) {
31376        composeMarkdownCore("purpose", element.getPurposeElement(), false);
31377        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
31378      }
31379      if (element.hasCopyrightElement()) {
31380        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
31381        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
31382      }
31383      if (element.hasCaseSensitiveElement()) {
31384        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
31385        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
31386      }
31387      if (element.hasValueSetElement()) {
31388        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
31389        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
31390      }
31391      if (element.hasHierarchyMeaningElement()) {
31392        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
31393        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
31394      }
31395      if (element.hasCompositionalElement()) {
31396        composeBooleanCore("compositional", element.getCompositionalElement(), false);
31397        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
31398      }
31399      if (element.hasVersionNeededElement()) {
31400        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
31401        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
31402      }
31403      if (element.hasContentElement()) {
31404        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
31405        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
31406      }
31407      if (element.hasSupplementsElement()) {
31408        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
31409        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
31410      }
31411      if (element.hasCountElement()) {
31412        composeUnsignedIntCore("count", element.getCountElement(), false);
31413        composeUnsignedIntExtras("count", element.getCountElement(), false);
31414      }
31415      if (element.hasFilter()) {
31416        openArray("filter");
31417        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
31418          composeCodeSystemCodeSystemFilterComponent(null, e);
31419        closeArray();
31420      };
31421      if (element.hasProperty()) {
31422        openArray("property");
31423        for (CodeSystem.PropertyComponent e : element.getProperty()) 
31424          composeCodeSystemPropertyComponent(null, e);
31425        closeArray();
31426      };
31427      if (element.hasConcept()) {
31428        openArray("concept");
31429        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
31430          composeCodeSystemConceptDefinitionComponent(null, e);
31431        closeArray();
31432      };
31433  }
31434
31435  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
31436    if (element != null) {
31437      open(name);
31438      composeCodeSystemCodeSystemFilterComponentInner(element);
31439      close();
31440    }
31441  }
31442
31443  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
31444      composeBackbone(element);
31445      if (element.hasCodeElement()) {
31446        composeCodeCore("code", element.getCodeElement(), false);
31447        composeCodeExtras("code", element.getCodeElement(), false);
31448      }
31449      if (element.hasDescriptionElement()) {
31450        composeStringCore("description", element.getDescriptionElement(), false);
31451        composeStringExtras("description", element.getDescriptionElement(), false);
31452      }
31453      if (element.hasOperator()) {
31454        openArray("operator");
31455        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
31456          composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
31457        closeArray();
31458        if (anyHasExtras(element.getOperator())) {
31459          openArray("_operator");
31460          for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
31461            composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
31462          closeArray();
31463        }
31464      };
31465      if (element.hasValueElement()) {
31466        composeStringCore("value", element.getValueElement(), false);
31467        composeStringExtras("value", element.getValueElement(), false);
31468      }
31469  }
31470
31471  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
31472    if (element != null) {
31473      open(name);
31474      composeCodeSystemPropertyComponentInner(element);
31475      close();
31476    }
31477  }
31478
31479  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
31480      composeBackbone(element);
31481      if (element.hasCodeElement()) {
31482        composeCodeCore("code", element.getCodeElement(), false);
31483        composeCodeExtras("code", element.getCodeElement(), false);
31484      }
31485      if (element.hasUriElement()) {
31486        composeUriCore("uri", element.getUriElement(), false);
31487        composeUriExtras("uri", element.getUriElement(), false);
31488      }
31489      if (element.hasDescriptionElement()) {
31490        composeStringCore("description", element.getDescriptionElement(), false);
31491        composeStringExtras("description", element.getDescriptionElement(), false);
31492      }
31493      if (element.hasTypeElement()) {
31494        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
31495        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
31496      }
31497  }
31498
31499  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
31500    if (element != null) {
31501      open(name);
31502      composeCodeSystemConceptDefinitionComponentInner(element);
31503      close();
31504    }
31505  }
31506
31507  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
31508      composeBackbone(element);
31509      if (element.hasCodeElement()) {
31510        composeCodeCore("code", element.getCodeElement(), false);
31511        composeCodeExtras("code", element.getCodeElement(), false);
31512      }
31513      if (element.hasDisplayElement()) {
31514        composeStringCore("display", element.getDisplayElement(), false);
31515        composeStringExtras("display", element.getDisplayElement(), false);
31516      }
31517      if (element.hasDefinitionElement()) {
31518        composeStringCore("definition", element.getDefinitionElement(), false);
31519        composeStringExtras("definition", element.getDefinitionElement(), false);
31520      }
31521      if (element.hasDesignation()) {
31522        openArray("designation");
31523        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
31524          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
31525        closeArray();
31526      };
31527      if (element.hasProperty()) {
31528        openArray("property");
31529        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
31530          composeCodeSystemConceptPropertyComponent(null, e);
31531        closeArray();
31532      };
31533      if (element.hasConcept()) {
31534        openArray("concept");
31535        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
31536          composeCodeSystemConceptDefinitionComponent(null, e);
31537        closeArray();
31538      };
31539  }
31540
31541  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
31542    if (element != null) {
31543      open(name);
31544      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
31545      close();
31546    }
31547  }
31548
31549  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
31550      composeBackbone(element);
31551      if (element.hasLanguageElement()) {
31552        composeCodeCore("language", element.getLanguageElement(), false);
31553        composeCodeExtras("language", element.getLanguageElement(), false);
31554      }
31555      if (element.hasUse()) {
31556        composeCoding("use", element.getUse());
31557      }
31558      if (element.hasValueElement()) {
31559        composeStringCore("value", element.getValueElement(), false);
31560        composeStringExtras("value", element.getValueElement(), false);
31561      }
31562  }
31563
31564  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
31565    if (element != null) {
31566      open(name);
31567      composeCodeSystemConceptPropertyComponentInner(element);
31568      close();
31569    }
31570  }
31571
31572  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element) throws IOException {
31573      composeBackbone(element);
31574      if (element.hasCodeElement()) {
31575        composeCodeCore("code", element.getCodeElement(), false);
31576        composeCodeExtras("code", element.getCodeElement(), false);
31577      }
31578      if (element.hasValue()) {
31579        composeType("value", element.getValue());
31580      }
31581  }
31582
31583  protected void composeCommunication(String name, Communication element) throws IOException {
31584    if (element != null) {
31585      prop("resourceType", name);
31586      composeCommunicationInner(element);
31587    }
31588  }
31589
31590  protected void composeCommunicationInner(Communication element) throws IOException {
31591      composeDomainResourceElements(element);
31592      if (element.hasIdentifier()) {
31593        openArray("identifier");
31594        for (Identifier e : element.getIdentifier()) 
31595          composeIdentifier(null, e);
31596        closeArray();
31597      };
31598      if (element.hasInstantiates()) {
31599        openArray("instantiates");
31600        for (UriType e : element.getInstantiates()) 
31601          composeUriCore(null, e, true);
31602        closeArray();
31603        if (anyHasExtras(element.getInstantiates())) {
31604          openArray("_instantiates");
31605          for (UriType e : element.getInstantiates()) 
31606            composeUriExtras(null, e, true);
31607          closeArray();
31608        }
31609      };
31610      if (element.hasBasedOn()) {
31611        openArray("basedOn");
31612        for (Reference e : element.getBasedOn()) 
31613          composeReference(null, e);
31614        closeArray();
31615      };
31616      if (element.hasPartOf()) {
31617        openArray("partOf");
31618        for (Reference e : element.getPartOf()) 
31619          composeReference(null, e);
31620        closeArray();
31621      };
31622      if (element.hasInResponseTo()) {
31623        openArray("inResponseTo");
31624        for (Reference e : element.getInResponseTo()) 
31625          composeReference(null, e);
31626        closeArray();
31627      };
31628      if (element.hasStatusElement()) {
31629        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
31630        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
31631      }
31632      if (element.hasStatusReason()) {
31633        composeCodeableConcept("statusReason", element.getStatusReason());
31634      }
31635      if (element.hasCategory()) {
31636        openArray("category");
31637        for (CodeableConcept e : element.getCategory()) 
31638          composeCodeableConcept(null, e);
31639        closeArray();
31640      };
31641      if (element.hasPriorityElement()) {
31642        composeEnumerationCore("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
31643        composeEnumerationExtras("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
31644      }
31645      if (element.hasMedium()) {
31646        openArray("medium");
31647        for (CodeableConcept e : element.getMedium()) 
31648          composeCodeableConcept(null, e);
31649        closeArray();
31650      };
31651      if (element.hasSubject()) {
31652        composeReference("subject", element.getSubject());
31653      }
31654      if (element.hasRecipient()) {
31655        openArray("recipient");
31656        for (Reference e : element.getRecipient()) 
31657          composeReference(null, e);
31658        closeArray();
31659      };
31660      if (element.hasTopic()) {
31661        composeCodeableConcept("topic", element.getTopic());
31662      }
31663      if (element.hasAbout()) {
31664        openArray("about");
31665        for (Reference e : element.getAbout()) 
31666          composeReference(null, e);
31667        closeArray();
31668      };
31669      if (element.hasContext()) {
31670        composeReference("context", element.getContext());
31671      }
31672      if (element.hasSentElement()) {
31673        composeDateTimeCore("sent", element.getSentElement(), false);
31674        composeDateTimeExtras("sent", element.getSentElement(), false);
31675      }
31676      if (element.hasReceivedElement()) {
31677        composeDateTimeCore("received", element.getReceivedElement(), false);
31678        composeDateTimeExtras("received", element.getReceivedElement(), false);
31679      }
31680      if (element.hasSender()) {
31681        composeReference("sender", element.getSender());
31682      }
31683      if (element.hasReasonCode()) {
31684        openArray("reasonCode");
31685        for (CodeableConcept e : element.getReasonCode()) 
31686          composeCodeableConcept(null, e);
31687        closeArray();
31688      };
31689      if (element.hasReasonReference()) {
31690        openArray("reasonReference");
31691        for (Reference e : element.getReasonReference()) 
31692          composeReference(null, e);
31693        closeArray();
31694      };
31695      if (element.hasPayload()) {
31696        openArray("payload");
31697        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
31698          composeCommunicationCommunicationPayloadComponent(null, e);
31699        closeArray();
31700      };
31701      if (element.hasNote()) {
31702        openArray("note");
31703        for (Annotation e : element.getNote()) 
31704          composeAnnotation(null, e);
31705        closeArray();
31706      };
31707  }
31708
31709  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
31710    if (element != null) {
31711      open(name);
31712      composeCommunicationCommunicationPayloadComponentInner(element);
31713      close();
31714    }
31715  }
31716
31717  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
31718      composeBackbone(element);
31719      if (element.hasContent()) {
31720        composeType("content", element.getContent());
31721      }
31722  }
31723
31724  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
31725    if (element != null) {
31726      prop("resourceType", name);
31727      composeCommunicationRequestInner(element);
31728    }
31729  }
31730
31731  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
31732      composeDomainResourceElements(element);
31733      if (element.hasIdentifier()) {
31734        openArray("identifier");
31735        for (Identifier e : element.getIdentifier()) 
31736          composeIdentifier(null, e);
31737        closeArray();
31738      };
31739      if (element.hasBasedOn()) {
31740        openArray("basedOn");
31741        for (Reference e : element.getBasedOn()) 
31742          composeReference(null, e);
31743        closeArray();
31744      };
31745      if (element.hasReplaces()) {
31746        openArray("replaces");
31747        for (Reference e : element.getReplaces()) 
31748          composeReference(null, e);
31749        closeArray();
31750      };
31751      if (element.hasGroupIdentifier()) {
31752        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
31753      }
31754      if (element.hasStatusElement()) {
31755        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
31756        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
31757      }
31758      if (element.hasCategory()) {
31759        openArray("category");
31760        for (CodeableConcept e : element.getCategory()) 
31761          composeCodeableConcept(null, e);
31762        closeArray();
31763      };
31764      if (element.hasPriorityElement()) {
31765        composeEnumerationCore("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
31766        composeEnumerationExtras("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
31767      }
31768      if (element.hasMedium()) {
31769        openArray("medium");
31770        for (CodeableConcept e : element.getMedium()) 
31771          composeCodeableConcept(null, e);
31772        closeArray();
31773      };
31774      if (element.hasSubject()) {
31775        composeReference("subject", element.getSubject());
31776      }
31777      if (element.hasRecipient()) {
31778        openArray("recipient");
31779        for (Reference e : element.getRecipient()) 
31780          composeReference(null, e);
31781        closeArray();
31782      };
31783      if (element.hasAbout()) {
31784        openArray("about");
31785        for (Reference e : element.getAbout()) 
31786          composeReference(null, e);
31787        closeArray();
31788      };
31789      if (element.hasContext()) {
31790        composeReference("context", element.getContext());
31791      }
31792      if (element.hasPayload()) {
31793        openArray("payload");
31794        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
31795          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
31796        closeArray();
31797      };
31798      if (element.hasOccurrence()) {
31799        composeType("occurrence", element.getOccurrence());
31800      }
31801      if (element.hasAuthoredOnElement()) {
31802        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
31803        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
31804      }
31805      if (element.hasRequester()) {
31806        composeReference("requester", element.getRequester());
31807      }
31808      if (element.hasSender()) {
31809        composeReference("sender", element.getSender());
31810      }
31811      if (element.hasReasonCode()) {
31812        openArray("reasonCode");
31813        for (CodeableConcept e : element.getReasonCode()) 
31814          composeCodeableConcept(null, e);
31815        closeArray();
31816      };
31817      if (element.hasReasonReference()) {
31818        openArray("reasonReference");
31819        for (Reference e : element.getReasonReference()) 
31820          composeReference(null, e);
31821        closeArray();
31822      };
31823      if (element.hasNote()) {
31824        openArray("note");
31825        for (Annotation e : element.getNote()) 
31826          composeAnnotation(null, e);
31827        closeArray();
31828      };
31829  }
31830
31831  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
31832    if (element != null) {
31833      open(name);
31834      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
31835      close();
31836    }
31837  }
31838
31839  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
31840      composeBackbone(element);
31841      if (element.hasContent()) {
31842        composeType("content", element.getContent());
31843      }
31844  }
31845
31846  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
31847    if (element != null) {
31848      prop("resourceType", name);
31849      composeCompartmentDefinitionInner(element);
31850    }
31851  }
31852
31853  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
31854      composeDomainResourceElements(element);
31855      if (element.hasUrlElement()) {
31856        composeUriCore("url", element.getUrlElement(), false);
31857        composeUriExtras("url", element.getUrlElement(), false);
31858      }
31859      if (element.hasNameElement()) {
31860        composeStringCore("name", element.getNameElement(), false);
31861        composeStringExtras("name", element.getNameElement(), false);
31862      }
31863      if (element.hasTitleElement()) {
31864        composeStringCore("title", element.getTitleElement(), false);
31865        composeStringExtras("title", element.getTitleElement(), false);
31866      }
31867      if (element.hasStatusElement()) {
31868        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31869        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31870      }
31871      if (element.hasExperimentalElement()) {
31872        composeBooleanCore("experimental", element.getExperimentalElement(), false);
31873        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
31874      }
31875      if (element.hasDateElement()) {
31876        composeDateTimeCore("date", element.getDateElement(), false);
31877        composeDateTimeExtras("date", element.getDateElement(), false);
31878      }
31879      if (element.hasPublisherElement()) {
31880        composeStringCore("publisher", element.getPublisherElement(), false);
31881        composeStringExtras("publisher", element.getPublisherElement(), false);
31882      }
31883      if (element.hasContact()) {
31884        openArray("contact");
31885        for (ContactDetail e : element.getContact()) 
31886          composeContactDetail(null, e);
31887        closeArray();
31888      };
31889      if (element.hasDescriptionElement()) {
31890        composeMarkdownCore("description", element.getDescriptionElement(), false);
31891        composeMarkdownExtras("description", element.getDescriptionElement(), false);
31892      }
31893      if (element.hasUseContext()) {
31894        openArray("useContext");
31895        for (UsageContext e : element.getUseContext()) 
31896          composeUsageContext(null, e);
31897        closeArray();
31898      };
31899      if (element.hasJurisdiction()) {
31900        openArray("jurisdiction");
31901        for (CodeableConcept e : element.getJurisdiction()) 
31902          composeCodeableConcept(null, e);
31903        closeArray();
31904      };
31905      if (element.hasPurposeElement()) {
31906        composeMarkdownCore("purpose", element.getPurposeElement(), false);
31907        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
31908      }
31909      if (element.hasCodeElement()) {
31910        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
31911        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
31912      }
31913      if (element.hasSearchElement()) {
31914        composeBooleanCore("search", element.getSearchElement(), false);
31915        composeBooleanExtras("search", element.getSearchElement(), false);
31916      }
31917      if (element.hasResource()) {
31918        openArray("resource");
31919        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
31920          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
31921        closeArray();
31922      };
31923  }
31924
31925  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
31926    if (element != null) {
31927      open(name);
31928      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
31929      close();
31930    }
31931  }
31932
31933  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
31934      composeBackbone(element);
31935      if (element.hasCodeElement()) {
31936        composeCodeCore("code", element.getCodeElement(), false);
31937        composeCodeExtras("code", element.getCodeElement(), false);
31938      }
31939      if (element.hasParam()) {
31940        openArray("param");
31941        for (StringType e : element.getParam()) 
31942          composeStringCore(null, e, true);
31943        closeArray();
31944        if (anyHasExtras(element.getParam())) {
31945          openArray("_param");
31946          for (StringType e : element.getParam()) 
31947            composeStringExtras(null, e, true);
31948          closeArray();
31949        }
31950      };
31951      if (element.hasDocumentationElement()) {
31952        composeStringCore("documentation", element.getDocumentationElement(), false);
31953        composeStringExtras("documentation", element.getDocumentationElement(), false);
31954      }
31955  }
31956
31957  protected void composeComposition(String name, Composition element) throws IOException {
31958    if (element != null) {
31959      prop("resourceType", name);
31960      composeCompositionInner(element);
31961    }
31962  }
31963
31964  protected void composeCompositionInner(Composition element) throws IOException {
31965      composeDomainResourceElements(element);
31966      if (element.hasIdentifier()) {
31967        composeIdentifier("identifier", element.getIdentifier());
31968      }
31969      if (element.hasStatusElement()) {
31970        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
31971        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
31972      }
31973      if (element.hasType()) {
31974        composeCodeableConcept("type", element.getType());
31975      }
31976      if (element.hasClass_()) {
31977        composeCodeableConcept("class", element.getClass_());
31978      }
31979      if (element.hasSubject()) {
31980        composeReference("subject", element.getSubject());
31981      }
31982      if (element.hasEncounter()) {
31983        composeReference("encounter", element.getEncounter());
31984      }
31985      if (element.hasDateElement()) {
31986        composeDateTimeCore("date", element.getDateElement(), false);
31987        composeDateTimeExtras("date", element.getDateElement(), false);
31988      }
31989      if (element.hasAuthor()) {
31990        openArray("author");
31991        for (Reference e : element.getAuthor()) 
31992          composeReference(null, e);
31993        closeArray();
31994      };
31995      if (element.hasTitleElement()) {
31996        composeStringCore("title", element.getTitleElement(), false);
31997        composeStringExtras("title", element.getTitleElement(), false);
31998      }
31999      if (element.hasConfidentialityElement()) {
32000        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
32001        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
32002      }
32003      if (element.hasAttester()) {
32004        openArray("attester");
32005        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
32006          composeCompositionCompositionAttesterComponent(null, e);
32007        closeArray();
32008      };
32009      if (element.hasCustodian()) {
32010        composeReference("custodian", element.getCustodian());
32011      }
32012      if (element.hasRelatesTo()) {
32013        openArray("relatesTo");
32014        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
32015          composeCompositionCompositionRelatesToComponent(null, e);
32016        closeArray();
32017      };
32018      if (element.hasEvent()) {
32019        openArray("event");
32020        for (Composition.CompositionEventComponent e : element.getEvent()) 
32021          composeCompositionCompositionEventComponent(null, e);
32022        closeArray();
32023      };
32024      if (element.hasSection()) {
32025        openArray("section");
32026        for (Composition.SectionComponent e : element.getSection()) 
32027          composeCompositionSectionComponent(null, e);
32028        closeArray();
32029      };
32030  }
32031
32032  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
32033    if (element != null) {
32034      open(name);
32035      composeCompositionCompositionAttesterComponentInner(element);
32036      close();
32037    }
32038  }
32039
32040  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
32041      composeBackbone(element);
32042      if (element.hasModeElement()) {
32043        composeEnumerationCore("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
32044        composeEnumerationExtras("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
32045      }
32046      if (element.hasTimeElement()) {
32047        composeDateTimeCore("time", element.getTimeElement(), false);
32048        composeDateTimeExtras("time", element.getTimeElement(), false);
32049      }
32050      if (element.hasParty()) {
32051        composeReference("party", element.getParty());
32052      }
32053  }
32054
32055  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
32056    if (element != null) {
32057      open(name);
32058      composeCompositionCompositionRelatesToComponentInner(element);
32059      close();
32060    }
32061  }
32062
32063  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element) throws IOException {
32064      composeBackbone(element);
32065      if (element.hasCodeElement()) {
32066        composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
32067        composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
32068      }
32069      if (element.hasTarget()) {
32070        composeType("target", element.getTarget());
32071      }
32072  }
32073
32074  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
32075    if (element != null) {
32076      open(name);
32077      composeCompositionCompositionEventComponentInner(element);
32078      close();
32079    }
32080  }
32081
32082  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
32083      composeBackbone(element);
32084      if (element.hasCode()) {
32085        openArray("code");
32086        for (CodeableConcept e : element.getCode()) 
32087          composeCodeableConcept(null, e);
32088        closeArray();
32089      };
32090      if (element.hasPeriod()) {
32091        composePeriod("period", element.getPeriod());
32092      }
32093      if (element.hasDetail()) {
32094        openArray("detail");
32095        for (Reference e : element.getDetail()) 
32096          composeReference(null, e);
32097        closeArray();
32098      };
32099  }
32100
32101  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
32102    if (element != null) {
32103      open(name);
32104      composeCompositionSectionComponentInner(element);
32105      close();
32106    }
32107  }
32108
32109  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
32110      composeBackbone(element);
32111      if (element.hasTitleElement()) {
32112        composeStringCore("title", element.getTitleElement(), false);
32113        composeStringExtras("title", element.getTitleElement(), false);
32114      }
32115      if (element.hasCode()) {
32116        composeCodeableConcept("code", element.getCode());
32117      }
32118      if (element.hasAuthor()) {
32119        openArray("author");
32120        for (Reference e : element.getAuthor()) 
32121          composeReference(null, e);
32122        closeArray();
32123      };
32124      if (element.hasText()) {
32125        composeNarrative("text", element.getText());
32126      }
32127      if (element.hasModeElement()) {
32128        composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
32129        composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
32130      }
32131      if (element.hasOrderedBy()) {
32132        composeCodeableConcept("orderedBy", element.getOrderedBy());
32133      }
32134      if (element.hasEntry()) {
32135        openArray("entry");
32136        for (Reference e : element.getEntry()) 
32137          composeReference(null, e);
32138        closeArray();
32139      };
32140      if (element.hasEmptyReason()) {
32141        composeCodeableConcept("emptyReason", element.getEmptyReason());
32142      }
32143      if (element.hasSection()) {
32144        openArray("section");
32145        for (Composition.SectionComponent e : element.getSection()) 
32146          composeCompositionSectionComponent(null, e);
32147        closeArray();
32148      };
32149  }
32150
32151  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
32152    if (element != null) {
32153      prop("resourceType", name);
32154      composeConceptMapInner(element);
32155    }
32156  }
32157
32158  protected void composeConceptMapInner(ConceptMap element) throws IOException {
32159      composeDomainResourceElements(element);
32160      if (element.hasUrlElement()) {
32161        composeUriCore("url", element.getUrlElement(), false);
32162        composeUriExtras("url", element.getUrlElement(), false);
32163      }
32164      if (element.hasIdentifier()) {
32165        composeIdentifier("identifier", element.getIdentifier());
32166      }
32167      if (element.hasVersionElement()) {
32168        composeStringCore("version", element.getVersionElement(), false);
32169        composeStringExtras("version", element.getVersionElement(), false);
32170      }
32171      if (element.hasNameElement()) {
32172        composeStringCore("name", element.getNameElement(), false);
32173        composeStringExtras("name", element.getNameElement(), false);
32174      }
32175      if (element.hasTitleElement()) {
32176        composeStringCore("title", element.getTitleElement(), false);
32177        composeStringExtras("title", element.getTitleElement(), false);
32178      }
32179      if (element.hasStatusElement()) {
32180        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32181        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32182      }
32183      if (element.hasExperimentalElement()) {
32184        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32185        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32186      }
32187      if (element.hasDateElement()) {
32188        composeDateTimeCore("date", element.getDateElement(), false);
32189        composeDateTimeExtras("date", element.getDateElement(), false);
32190      }
32191      if (element.hasPublisherElement()) {
32192        composeStringCore("publisher", element.getPublisherElement(), false);
32193        composeStringExtras("publisher", element.getPublisherElement(), false);
32194      }
32195      if (element.hasContact()) {
32196        openArray("contact");
32197        for (ContactDetail e : element.getContact()) 
32198          composeContactDetail(null, e);
32199        closeArray();
32200      };
32201      if (element.hasDescriptionElement()) {
32202        composeMarkdownCore("description", element.getDescriptionElement(), false);
32203        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32204      }
32205      if (element.hasUseContext()) {
32206        openArray("useContext");
32207        for (UsageContext e : element.getUseContext()) 
32208          composeUsageContext(null, e);
32209        closeArray();
32210      };
32211      if (element.hasJurisdiction()) {
32212        openArray("jurisdiction");
32213        for (CodeableConcept e : element.getJurisdiction()) 
32214          composeCodeableConcept(null, e);
32215        closeArray();
32216      };
32217      if (element.hasPurposeElement()) {
32218        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32219        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32220      }
32221      if (element.hasCopyrightElement()) {
32222        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32223        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32224      }
32225      if (element.hasSource()) {
32226        composeType("source", element.getSource());
32227      }
32228      if (element.hasTarget()) {
32229        composeType("target", element.getTarget());
32230      }
32231      if (element.hasGroup()) {
32232        openArray("group");
32233        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
32234          composeConceptMapConceptMapGroupComponent(null, e);
32235        closeArray();
32236      };
32237  }
32238
32239  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
32240    if (element != null) {
32241      open(name);
32242      composeConceptMapConceptMapGroupComponentInner(element);
32243      close();
32244    }
32245  }
32246
32247  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element) throws IOException {
32248      composeBackbone(element);
32249      if (element.hasSourceElement()) {
32250        composeUriCore("source", element.getSourceElement(), false);
32251        composeUriExtras("source", element.getSourceElement(), false);
32252      }
32253      if (element.hasSourceVersionElement()) {
32254        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
32255        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
32256      }
32257      if (element.hasTargetElement()) {
32258        composeUriCore("target", element.getTargetElement(), false);
32259        composeUriExtras("target", element.getTargetElement(), false);
32260      }
32261      if (element.hasTargetVersionElement()) {
32262        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
32263        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
32264      }
32265      if (element.hasElement()) {
32266        openArray("element");
32267        for (ConceptMap.SourceElementComponent e : element.getElement()) 
32268          composeConceptMapSourceElementComponent(null, e);
32269        closeArray();
32270      };
32271      if (element.hasUnmapped()) {
32272        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
32273      }
32274  }
32275
32276  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
32277    if (element != null) {
32278      open(name);
32279      composeConceptMapSourceElementComponentInner(element);
32280      close();
32281    }
32282  }
32283
32284  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
32285      composeBackbone(element);
32286      if (element.hasCodeElement()) {
32287        composeCodeCore("code", element.getCodeElement(), false);
32288        composeCodeExtras("code", element.getCodeElement(), false);
32289      }
32290      if (element.hasDisplayElement()) {
32291        composeStringCore("display", element.getDisplayElement(), false);
32292        composeStringExtras("display", element.getDisplayElement(), false);
32293      }
32294      if (element.hasTarget()) {
32295        openArray("target");
32296        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
32297          composeConceptMapTargetElementComponent(null, e);
32298        closeArray();
32299      };
32300  }
32301
32302  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
32303    if (element != null) {
32304      open(name);
32305      composeConceptMapTargetElementComponentInner(element);
32306      close();
32307    }
32308  }
32309
32310  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
32311      composeBackbone(element);
32312      if (element.hasCodeElement()) {
32313        composeCodeCore("code", element.getCodeElement(), false);
32314        composeCodeExtras("code", element.getCodeElement(), false);
32315      }
32316      if (element.hasDisplayElement()) {
32317        composeStringCore("display", element.getDisplayElement(), false);
32318        composeStringExtras("display", element.getDisplayElement(), false);
32319      }
32320      if (element.hasEquivalenceElement()) {
32321        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
32322        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
32323      }
32324      if (element.hasCommentElement()) {
32325        composeStringCore("comment", element.getCommentElement(), false);
32326        composeStringExtras("comment", element.getCommentElement(), false);
32327      }
32328      if (element.hasDependsOn()) {
32329        openArray("dependsOn");
32330        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
32331          composeConceptMapOtherElementComponent(null, e);
32332        closeArray();
32333      };
32334      if (element.hasProduct()) {
32335        openArray("product");
32336        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
32337          composeConceptMapOtherElementComponent(null, e);
32338        closeArray();
32339      };
32340  }
32341
32342  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
32343    if (element != null) {
32344      open(name);
32345      composeConceptMapOtherElementComponentInner(element);
32346      close();
32347    }
32348  }
32349
32350  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
32351      composeBackbone(element);
32352      if (element.hasPropertyElement()) {
32353        composeUriCore("property", element.getPropertyElement(), false);
32354        composeUriExtras("property", element.getPropertyElement(), false);
32355      }
32356      if (element.hasSystemElement()) {
32357        composeCanonicalCore("system", element.getSystemElement(), false);
32358        composeCanonicalExtras("system", element.getSystemElement(), false);
32359      }
32360      if (element.hasValueElement()) {
32361        composeStringCore("value", element.getValueElement(), false);
32362        composeStringExtras("value", element.getValueElement(), false);
32363      }
32364      if (element.hasDisplayElement()) {
32365        composeStringCore("display", element.getDisplayElement(), false);
32366        composeStringExtras("display", element.getDisplayElement(), false);
32367      }
32368  }
32369
32370  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
32371    if (element != null) {
32372      open(name);
32373      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
32374      close();
32375    }
32376  }
32377
32378  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
32379      composeBackbone(element);
32380      if (element.hasModeElement()) {
32381        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
32382        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
32383      }
32384      if (element.hasCodeElement()) {
32385        composeCodeCore("code", element.getCodeElement(), false);
32386        composeCodeExtras("code", element.getCodeElement(), false);
32387      }
32388      if (element.hasDisplayElement()) {
32389        composeStringCore("display", element.getDisplayElement(), false);
32390        composeStringExtras("display", element.getDisplayElement(), false);
32391      }
32392      if (element.hasUrlElement()) {
32393        composeCanonicalCore("url", element.getUrlElement(), false);
32394        composeCanonicalExtras("url", element.getUrlElement(), false);
32395      }
32396  }
32397
32398  protected void composeCondition(String name, Condition element) throws IOException {
32399    if (element != null) {
32400      prop("resourceType", name);
32401      composeConditionInner(element);
32402    }
32403  }
32404
32405  protected void composeConditionInner(Condition element) throws IOException {
32406      composeDomainResourceElements(element);
32407      if (element.hasIdentifier()) {
32408        openArray("identifier");
32409        for (Identifier e : element.getIdentifier()) 
32410          composeIdentifier(null, e);
32411        closeArray();
32412      };
32413      if (element.hasClinicalStatusElement()) {
32414        composeEnumerationCore("clinicalStatus", element.getClinicalStatusElement(), new Condition.ConditionClinicalStatusEnumFactory(), false);
32415        composeEnumerationExtras("clinicalStatus", element.getClinicalStatusElement(), new Condition.ConditionClinicalStatusEnumFactory(), false);
32416      }
32417      if (element.hasVerificationStatusElement()) {
32418        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
32419        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
32420      }
32421      if (element.hasCategory()) {
32422        openArray("category");
32423        for (CodeableConcept e : element.getCategory()) 
32424          composeCodeableConcept(null, e);
32425        closeArray();
32426      };
32427      if (element.hasSeverity()) {
32428        composeCodeableConcept("severity", element.getSeverity());
32429      }
32430      if (element.hasCode()) {
32431        composeCodeableConcept("code", element.getCode());
32432      }
32433      if (element.hasBodySite()) {
32434        openArray("bodySite");
32435        for (CodeableConcept e : element.getBodySite()) 
32436          composeCodeableConcept(null, e);
32437        closeArray();
32438      };
32439      if (element.hasSubject()) {
32440        composeReference("subject", element.getSubject());
32441      }
32442      if (element.hasContext()) {
32443        composeReference("context", element.getContext());
32444      }
32445      if (element.hasOnset()) {
32446        composeType("onset", element.getOnset());
32447      }
32448      if (element.hasAbatement()) {
32449        composeType("abatement", element.getAbatement());
32450      }
32451      if (element.hasAssertedDateElement()) {
32452        composeDateTimeCore("assertedDate", element.getAssertedDateElement(), false);
32453        composeDateTimeExtras("assertedDate", element.getAssertedDateElement(), false);
32454      }
32455      if (element.hasRecorder()) {
32456        composeReference("recorder", element.getRecorder());
32457      }
32458      if (element.hasAsserter()) {
32459        composeReference("asserter", element.getAsserter());
32460      }
32461      if (element.hasStage()) {
32462        openArray("stage");
32463        for (Condition.ConditionStageComponent e : element.getStage()) 
32464          composeConditionConditionStageComponent(null, e);
32465        closeArray();
32466      };
32467      if (element.hasEvidence()) {
32468        openArray("evidence");
32469        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
32470          composeConditionConditionEvidenceComponent(null, e);
32471        closeArray();
32472      };
32473      if (element.hasNote()) {
32474        openArray("note");
32475        for (Annotation e : element.getNote()) 
32476          composeAnnotation(null, e);
32477        closeArray();
32478      };
32479  }
32480
32481  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
32482    if (element != null) {
32483      open(name);
32484      composeConditionConditionStageComponentInner(element);
32485      close();
32486    }
32487  }
32488
32489  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
32490      composeBackbone(element);
32491      if (element.hasSummary()) {
32492        composeCodeableConcept("summary", element.getSummary());
32493      }
32494      if (element.hasAssessment()) {
32495        openArray("assessment");
32496        for (Reference e : element.getAssessment()) 
32497          composeReference(null, e);
32498        closeArray();
32499      };
32500      if (element.hasType()) {
32501        composeCodeableConcept("type", element.getType());
32502      }
32503  }
32504
32505  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
32506    if (element != null) {
32507      open(name);
32508      composeConditionConditionEvidenceComponentInner(element);
32509      close();
32510    }
32511  }
32512
32513  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
32514      composeBackbone(element);
32515      if (element.hasCode()) {
32516        openArray("code");
32517        for (CodeableConcept e : element.getCode()) 
32518          composeCodeableConcept(null, e);
32519        closeArray();
32520      };
32521      if (element.hasDetail()) {
32522        openArray("detail");
32523        for (Reference e : element.getDetail()) 
32524          composeReference(null, e);
32525        closeArray();
32526      };
32527  }
32528
32529  protected void composeConsent(String name, Consent element) throws IOException {
32530    if (element != null) {
32531      prop("resourceType", name);
32532      composeConsentInner(element);
32533    }
32534  }
32535
32536  protected void composeConsentInner(Consent element) throws IOException {
32537      composeDomainResourceElements(element);
32538      if (element.hasIdentifier()) {
32539        openArray("identifier");
32540        for (Identifier e : element.getIdentifier()) 
32541          composeIdentifier(null, e);
32542        closeArray();
32543      };
32544      if (element.hasStatusElement()) {
32545        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
32546        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
32547      }
32548      if (element.hasScope()) {
32549        composeCodeableConcept("scope", element.getScope());
32550      }
32551      if (element.hasCategory()) {
32552        openArray("category");
32553        for (CodeableConcept e : element.getCategory()) 
32554          composeCodeableConcept(null, e);
32555        closeArray();
32556      };
32557      if (element.hasPatient()) {
32558        composeReference("patient", element.getPatient());
32559      }
32560      if (element.hasDateTimeElement()) {
32561        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
32562        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
32563      }
32564      if (element.hasPerformer()) {
32565        openArray("performer");
32566        for (Reference e : element.getPerformer()) 
32567          composeReference(null, e);
32568        closeArray();
32569      };
32570      if (element.hasOrganization()) {
32571        openArray("organization");
32572        for (Reference e : element.getOrganization()) 
32573          composeReference(null, e);
32574        closeArray();
32575      };
32576      if (element.hasSource()) {
32577        composeType("source", element.getSource());
32578      }
32579      if (element.hasPolicy()) {
32580        openArray("policy");
32581        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
32582          composeConsentConsentPolicyComponent(null, e);
32583        closeArray();
32584      };
32585      if (element.hasPolicyRule()) {
32586        composeCodeableConcept("policyRule", element.getPolicyRule());
32587      }
32588      if (element.hasVerification()) {
32589        openArray("verification");
32590        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
32591          composeConsentConsentVerificationComponent(null, e);
32592        closeArray();
32593      };
32594      if (element.hasProvision()) {
32595        composeConsentprovisionComponent("provision", element.getProvision());
32596      }
32597  }
32598
32599  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
32600    if (element != null) {
32601      open(name);
32602      composeConsentConsentPolicyComponentInner(element);
32603      close();
32604    }
32605  }
32606
32607  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
32608      composeBackbone(element);
32609      if (element.hasAuthorityElement()) {
32610        composeUriCore("authority", element.getAuthorityElement(), false);
32611        composeUriExtras("authority", element.getAuthorityElement(), false);
32612      }
32613      if (element.hasUriElement()) {
32614        composeUriCore("uri", element.getUriElement(), false);
32615        composeUriExtras("uri", element.getUriElement(), false);
32616      }
32617  }
32618
32619  protected void composeConsentConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
32620    if (element != null) {
32621      open(name);
32622      composeConsentConsentVerificationComponentInner(element);
32623      close();
32624    }
32625  }
32626
32627  protected void composeConsentConsentVerificationComponentInner(Consent.ConsentVerificationComponent element) throws IOException {
32628      composeBackbone(element);
32629      if (element.hasVerifiedElement()) {
32630        composeBooleanCore("verified", element.getVerifiedElement(), false);
32631        composeBooleanExtras("verified", element.getVerifiedElement(), false);
32632      }
32633      if (element.hasVerifiedWith()) {
32634        composeReference("verifiedWith", element.getVerifiedWith());
32635      }
32636      if (element.hasVerificationDateElement()) {
32637        composeDateTimeCore("verificationDate", element.getVerificationDateElement(), false);
32638        composeDateTimeExtras("verificationDate", element.getVerificationDateElement(), false);
32639      }
32640  }
32641
32642  protected void composeConsentprovisionComponent(String name, Consent.provisionComponent element) throws IOException {
32643    if (element != null) {
32644      open(name);
32645      composeConsentprovisionComponentInner(element);
32646      close();
32647    }
32648  }
32649
32650  protected void composeConsentprovisionComponentInner(Consent.provisionComponent element) throws IOException {
32651      composeBackbone(element);
32652      if (element.hasTypeElement()) {
32653        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
32654        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
32655      }
32656      if (element.hasPeriod()) {
32657        composePeriod("period", element.getPeriod());
32658      }
32659      if (element.hasActor()) {
32660        openArray("actor");
32661        for (Consent.provisionActorComponent e : element.getActor()) 
32662          composeConsentprovisionActorComponent(null, e);
32663        closeArray();
32664      };
32665      if (element.hasAction()) {
32666        openArray("action");
32667        for (CodeableConcept e : element.getAction()) 
32668          composeCodeableConcept(null, e);
32669        closeArray();
32670      };
32671      if (element.hasSecurityLabel()) {
32672        openArray("securityLabel");
32673        for (Coding e : element.getSecurityLabel()) 
32674          composeCoding(null, e);
32675        closeArray();
32676      };
32677      if (element.hasPurpose()) {
32678        openArray("purpose");
32679        for (Coding e : element.getPurpose()) 
32680          composeCoding(null, e);
32681        closeArray();
32682      };
32683      if (element.hasClass_()) {
32684        openArray("class");
32685        for (Coding e : element.getClass_()) 
32686          composeCoding(null, e);
32687        closeArray();
32688      };
32689      if (element.hasCode()) {
32690        openArray("code");
32691        for (CodeableConcept e : element.getCode()) 
32692          composeCodeableConcept(null, e);
32693        closeArray();
32694      };
32695      if (element.hasDataPeriod()) {
32696        composePeriod("dataPeriod", element.getDataPeriod());
32697      }
32698      if (element.hasData()) {
32699        openArray("data");
32700        for (Consent.provisionDataComponent e : element.getData()) 
32701          composeConsentprovisionDataComponent(null, e);
32702        closeArray();
32703      };
32704      if (element.hasProvision()) {
32705        openArray("provision");
32706        for (Consent.provisionComponent e : element.getProvision()) 
32707          composeConsentprovisionComponent(null, e);
32708        closeArray();
32709      };
32710  }
32711
32712  protected void composeConsentprovisionActorComponent(String name, Consent.provisionActorComponent element) throws IOException {
32713    if (element != null) {
32714      open(name);
32715      composeConsentprovisionActorComponentInner(element);
32716      close();
32717    }
32718  }
32719
32720  protected void composeConsentprovisionActorComponentInner(Consent.provisionActorComponent element) throws IOException {
32721      composeBackbone(element);
32722      if (element.hasRole()) {
32723        composeCodeableConcept("role", element.getRole());
32724      }
32725      if (element.hasReference()) {
32726        composeReference("reference", element.getReference());
32727      }
32728  }
32729
32730  protected void composeConsentprovisionDataComponent(String name, Consent.provisionDataComponent element) throws IOException {
32731    if (element != null) {
32732      open(name);
32733      composeConsentprovisionDataComponentInner(element);
32734      close();
32735    }
32736  }
32737
32738  protected void composeConsentprovisionDataComponentInner(Consent.provisionDataComponent element) throws IOException {
32739      composeBackbone(element);
32740      if (element.hasMeaningElement()) {
32741        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
32742        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
32743      }
32744      if (element.hasReference()) {
32745        composeReference("reference", element.getReference());
32746      }
32747  }
32748
32749  protected void composeContract(String name, Contract element) throws IOException {
32750    if (element != null) {
32751      prop("resourceType", name);
32752      composeContractInner(element);
32753    }
32754  }
32755
32756  protected void composeContractInner(Contract element) throws IOException {
32757      composeDomainResourceElements(element);
32758      if (element.hasIdentifier()) {
32759        openArray("identifier");
32760        for (Identifier e : element.getIdentifier()) 
32761          composeIdentifier(null, e);
32762        closeArray();
32763      };
32764      if (element.hasStatusElement()) {
32765        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
32766        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
32767      }
32768      if (element.hasContentDerivative()) {
32769        composeCodeableConcept("contentDerivative", element.getContentDerivative());
32770      }
32771      if (element.hasIssuedElement()) {
32772        composeDateTimeCore("issued", element.getIssuedElement(), false);
32773        composeDateTimeExtras("issued", element.getIssuedElement(), false);
32774      }
32775      if (element.hasApplies()) {
32776        composePeriod("applies", element.getApplies());
32777      }
32778      if (element.hasSubject()) {
32779        openArray("subject");
32780        for (Reference e : element.getSubject()) 
32781          composeReference(null, e);
32782        closeArray();
32783      };
32784      if (element.hasAuthority()) {
32785        openArray("authority");
32786        for (Reference e : element.getAuthority()) 
32787          composeReference(null, e);
32788        closeArray();
32789      };
32790      if (element.hasDomain()) {
32791        openArray("domain");
32792        for (Reference e : element.getDomain()) 
32793          composeReference(null, e);
32794        closeArray();
32795      };
32796      if (element.hasType()) {
32797        composeCodeableConcept("type", element.getType());
32798      }
32799      if (element.hasSubType()) {
32800        openArray("subType");
32801        for (CodeableConcept e : element.getSubType()) 
32802          composeCodeableConcept(null, e);
32803        closeArray();
32804      };
32805      if (element.hasTerm()) {
32806        openArray("term");
32807        for (Contract.TermComponent e : element.getTerm()) 
32808          composeContractTermComponent(null, e);
32809        closeArray();
32810      };
32811      if (element.hasSigner()) {
32812        openArray("signer");
32813        for (Contract.SignatoryComponent e : element.getSigner()) 
32814          composeContractSignatoryComponent(null, e);
32815        closeArray();
32816      };
32817      if (element.hasFriendly()) {
32818        openArray("friendly");
32819        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
32820          composeContractFriendlyLanguageComponent(null, e);
32821        closeArray();
32822      };
32823      if (element.hasLegal()) {
32824        openArray("legal");
32825        for (Contract.LegalLanguageComponent e : element.getLegal()) 
32826          composeContractLegalLanguageComponent(null, e);
32827        closeArray();
32828      };
32829      if (element.hasRule()) {
32830        composeContractComputableLanguageComponent("rule", element.getRule());
32831      }
32832      if (element.hasLegallyBinding()) {
32833        composeType("legallyBinding", element.getLegallyBinding());
32834      }
32835  }
32836
32837  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
32838    if (element != null) {
32839      open(name);
32840      composeContractTermComponentInner(element);
32841      close();
32842    }
32843  }
32844
32845  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
32846      composeBackbone(element);
32847      if (element.hasIdentifier()) {
32848        composeIdentifier("identifier", element.getIdentifier());
32849      }
32850      if (element.hasIssuedElement()) {
32851        composeDateTimeCore("issued", element.getIssuedElement(), false);
32852        composeDateTimeExtras("issued", element.getIssuedElement(), false);
32853      }
32854      if (element.hasApplies()) {
32855        composePeriod("applies", element.getApplies());
32856      }
32857      if (element.hasType()) {
32858        composeCodeableConcept("type", element.getType());
32859      }
32860      if (element.hasSubType()) {
32861        composeCodeableConcept("subType", element.getSubType());
32862      }
32863      if (element.hasOffer()) {
32864        composeContractContractOfferComponent("offer", element.getOffer());
32865      }
32866      if (element.hasAsset()) {
32867        openArray("asset");
32868        for (Contract.ContractAssetComponent e : element.getAsset()) 
32869          composeContractContractAssetComponent(null, e);
32870        closeArray();
32871      };
32872      if (element.hasAgent()) {
32873        openArray("agent");
32874        for (Contract.AgentComponent e : element.getAgent()) 
32875          composeContractAgentComponent(null, e);
32876        closeArray();
32877      };
32878      if (element.hasAction()) {
32879        openArray("action");
32880        for (CodeableConcept e : element.getAction()) 
32881          composeCodeableConcept(null, e);
32882        closeArray();
32883      };
32884      if (element.hasActionReason()) {
32885        openArray("actionReason");
32886        for (CodeableConcept e : element.getActionReason()) 
32887          composeCodeableConcept(null, e);
32888        closeArray();
32889      };
32890      if (element.hasGroup()) {
32891        openArray("group");
32892        for (Contract.TermComponent e : element.getGroup()) 
32893          composeContractTermComponent(null, e);
32894        closeArray();
32895      };
32896  }
32897
32898  protected void composeContractContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
32899    if (element != null) {
32900      open(name);
32901      composeContractContractOfferComponentInner(element);
32902      close();
32903    }
32904  }
32905
32906  protected void composeContractContractOfferComponentInner(Contract.ContractOfferComponent element) throws IOException {
32907      composeBackbone(element);
32908      if (element.hasTopic()) {
32909        composeReference("topic", element.getTopic());
32910      }
32911      if (element.hasType()) {
32912        composeCodeableConcept("type", element.getType());
32913      }
32914      if (element.hasDecision()) {
32915        composeCodeableConcept("decision", element.getDecision());
32916      }
32917      if (element.hasTextElement()) {
32918        composeStringCore("text", element.getTextElement(), false);
32919        composeStringExtras("text", element.getTextElement(), false);
32920      }
32921      if (element.hasLinkIdElement()) {
32922        composeStringCore("linkId", element.getLinkIdElement(), false);
32923        composeStringExtras("linkId", element.getLinkIdElement(), false);
32924      }
32925  }
32926
32927  protected void composeContractContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
32928    if (element != null) {
32929      open(name);
32930      composeContractContractAssetComponentInner(element);
32931      close();
32932    }
32933  }
32934
32935  protected void composeContractContractAssetComponentInner(Contract.ContractAssetComponent element) throws IOException {
32936      composeBackbone(element);
32937      if (element.hasClass_()) {
32938        composeCoding("class", element.getClass_());
32939      }
32940      if (element.hasCode()) {
32941        composeCoding("code", element.getCode());
32942      }
32943      if (element.hasPeriod()) {
32944        composePeriod("period", element.getPeriod());
32945      }
32946      if (element.hasDataPeriod()) {
32947        composePeriod("dataPeriod", element.getDataPeriod());
32948      }
32949      if (element.hasData()) {
32950        openArray("data");
32951        for (Contract.AssetDataComponent e : element.getData()) 
32952          composeContractAssetDataComponent(null, e);
32953        closeArray();
32954      };
32955      if (element.hasValuedItem()) {
32956        openArray("valuedItem");
32957        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
32958          composeContractValuedItemComponent(null, e);
32959        closeArray();
32960      };
32961      if (element.hasSecurityLabel()) {
32962        openArray("securityLabel");
32963        for (Coding e : element.getSecurityLabel()) 
32964          composeCoding(null, e);
32965        closeArray();
32966      };
32967  }
32968
32969  protected void composeContractAssetDataComponent(String name, Contract.AssetDataComponent element) throws IOException {
32970    if (element != null) {
32971      open(name);
32972      composeContractAssetDataComponentInner(element);
32973      close();
32974    }
32975  }
32976
32977  protected void composeContractAssetDataComponentInner(Contract.AssetDataComponent element) throws IOException {
32978      composeBackbone(element);
32979      if (element.hasMeaningElement()) {
32980        composeEnumerationCore("meaning", element.getMeaningElement(), new Contract.ContractDataMeaningEnumFactory(), false);
32981        composeEnumerationExtras("meaning", element.getMeaningElement(), new Contract.ContractDataMeaningEnumFactory(), false);
32982      }
32983      if (element.hasReference()) {
32984        composeReference("reference", element.getReference());
32985      }
32986  }
32987
32988  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
32989    if (element != null) {
32990      open(name);
32991      composeContractValuedItemComponentInner(element);
32992      close();
32993    }
32994  }
32995
32996  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
32997      composeBackbone(element);
32998      if (element.hasEntity()) {
32999        composeType("entity", element.getEntity());
33000      }
33001      if (element.hasIdentifier()) {
33002        composeIdentifier("identifier", element.getIdentifier());
33003      }
33004      if (element.hasEffectiveTimeElement()) {
33005        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
33006        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
33007      }
33008      if (element.hasQuantity()) {
33009        composeSimpleQuantity("quantity", element.getQuantity());
33010      }
33011      if (element.hasUnitPrice()) {
33012        composeMoney("unitPrice", element.getUnitPrice());
33013      }
33014      if (element.hasFactorElement()) {
33015        composeDecimalCore("factor", element.getFactorElement(), false);
33016        composeDecimalExtras("factor", element.getFactorElement(), false);
33017      }
33018      if (element.hasPointsElement()) {
33019        composeDecimalCore("points", element.getPointsElement(), false);
33020        composeDecimalExtras("points", element.getPointsElement(), false);
33021      }
33022      if (element.hasNet()) {
33023        composeMoney("net", element.getNet());
33024      }
33025  }
33026
33027  protected void composeContractAgentComponent(String name, Contract.AgentComponent element) throws IOException {
33028    if (element != null) {
33029      open(name);
33030      composeContractAgentComponentInner(element);
33031      close();
33032    }
33033  }
33034
33035  protected void composeContractAgentComponentInner(Contract.AgentComponent element) throws IOException {
33036      composeBackbone(element);
33037      if (element.hasActor()) {
33038        composeReference("actor", element.getActor());
33039      }
33040      if (element.hasRole()) {
33041        openArray("role");
33042        for (CodeableConcept e : element.getRole()) 
33043          composeCodeableConcept(null, e);
33044        closeArray();
33045      };
33046  }
33047
33048  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
33049    if (element != null) {
33050      open(name);
33051      composeContractSignatoryComponentInner(element);
33052      close();
33053    }
33054  }
33055
33056  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
33057      composeBackbone(element);
33058      if (element.hasType()) {
33059        composeCoding("type", element.getType());
33060      }
33061      if (element.hasParty()) {
33062        composeReference("party", element.getParty());
33063      }
33064      if (element.hasSignature()) {
33065        openArray("signature");
33066        for (Signature e : element.getSignature()) 
33067          composeSignature(null, e);
33068        closeArray();
33069      };
33070  }
33071
33072  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
33073    if (element != null) {
33074      open(name);
33075      composeContractFriendlyLanguageComponentInner(element);
33076      close();
33077    }
33078  }
33079
33080  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
33081      composeBackbone(element);
33082      if (element.hasContent()) {
33083        composeType("content", element.getContent());
33084      }
33085  }
33086
33087  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
33088    if (element != null) {
33089      open(name);
33090      composeContractLegalLanguageComponentInner(element);
33091      close();
33092    }
33093  }
33094
33095  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
33096      composeBackbone(element);
33097      if (element.hasContent()) {
33098        composeType("content", element.getContent());
33099      }
33100  }
33101
33102  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
33103    if (element != null) {
33104      open(name);
33105      composeContractComputableLanguageComponentInner(element);
33106      close();
33107    }
33108  }
33109
33110  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
33111      composeBackbone(element);
33112      if (element.hasContent()) {
33113        composeType("content", element.getContent());
33114      }
33115  }
33116
33117  protected void composeCoverage(String name, Coverage element) throws IOException {
33118    if (element != null) {
33119      prop("resourceType", name);
33120      composeCoverageInner(element);
33121    }
33122  }
33123
33124  protected void composeCoverageInner(Coverage element) throws IOException {
33125      composeDomainResourceElements(element);
33126      if (element.hasIdentifier()) {
33127        openArray("identifier");
33128        for (Identifier e : element.getIdentifier()) 
33129          composeIdentifier(null, e);
33130        closeArray();
33131      };
33132      if (element.hasStatusElement()) {
33133        composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
33134        composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
33135      }
33136      if (element.hasType()) {
33137        composeCodeableConcept("type", element.getType());
33138      }
33139      if (element.hasPolicyHolder()) {
33140        composeReference("policyHolder", element.getPolicyHolder());
33141      }
33142      if (element.hasSubscriber()) {
33143        composeReference("subscriber", element.getSubscriber());
33144      }
33145      if (element.hasSubscriberIdElement()) {
33146        composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
33147        composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
33148      }
33149      if (element.hasBeneficiary()) {
33150        composeReference("beneficiary", element.getBeneficiary());
33151      }
33152      if (element.hasDependentElement()) {
33153        composeStringCore("dependent", element.getDependentElement(), false);
33154        composeStringExtras("dependent", element.getDependentElement(), false);
33155      }
33156      if (element.hasRelationship()) {
33157        composeCodeableConcept("relationship", element.getRelationship());
33158      }
33159      if (element.hasPeriod()) {
33160        composePeriod("period", element.getPeriod());
33161      }
33162      if (element.hasPayor()) {
33163        openArray("payor");
33164        for (Reference e : element.getPayor()) 
33165          composeReference(null, e);
33166        closeArray();
33167      };
33168      if (element.hasClass_()) {
33169        openArray("class");
33170        for (Coverage.ClassComponent e : element.getClass_()) 
33171          composeCoverageClassComponent(null, e);
33172        closeArray();
33173      };
33174      if (element.hasOrderElement()) {
33175        composePositiveIntCore("order", element.getOrderElement(), false);
33176        composePositiveIntExtras("order", element.getOrderElement(), false);
33177      }
33178      if (element.hasNetworkElement()) {
33179        composeStringCore("network", element.getNetworkElement(), false);
33180        composeStringExtras("network", element.getNetworkElement(), false);
33181      }
33182      if (element.hasCopay()) {
33183        openArray("copay");
33184        for (Coverage.CoPayComponent e : element.getCopay()) 
33185          composeCoverageCoPayComponent(null, e);
33186        closeArray();
33187      };
33188      if (element.hasContract()) {
33189        openArray("contract");
33190        for (Reference e : element.getContract()) 
33191          composeReference(null, e);
33192        closeArray();
33193      };
33194  }
33195
33196  protected void composeCoverageClassComponent(String name, Coverage.ClassComponent element) throws IOException {
33197    if (element != null) {
33198      open(name);
33199      composeCoverageClassComponentInner(element);
33200      close();
33201    }
33202  }
33203
33204  protected void composeCoverageClassComponentInner(Coverage.ClassComponent element) throws IOException {
33205      composeBackbone(element);
33206      if (element.hasType()) {
33207        composeCoding("type", element.getType());
33208      }
33209      if (element.hasValueElement()) {
33210        composeStringCore("value", element.getValueElement(), false);
33211        composeStringExtras("value", element.getValueElement(), false);
33212      }
33213      if (element.hasNameElement()) {
33214        composeStringCore("name", element.getNameElement(), false);
33215        composeStringExtras("name", element.getNameElement(), false);
33216      }
33217  }
33218
33219  protected void composeCoverageCoPayComponent(String name, Coverage.CoPayComponent element) throws IOException {
33220    if (element != null) {
33221      open(name);
33222      composeCoverageCoPayComponentInner(element);
33223      close();
33224    }
33225  }
33226
33227  protected void composeCoverageCoPayComponentInner(Coverage.CoPayComponent element) throws IOException {
33228      composeBackbone(element);
33229      if (element.hasType()) {
33230        composeCoding("type", element.getType());
33231      }
33232      if (element.hasValue()) {
33233        composeQuantity("value", element.getValue());
33234      }
33235  }
33236
33237  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
33238    if (element != null) {
33239      prop("resourceType", name);
33240      composeDetectedIssueInner(element);
33241    }
33242  }
33243
33244  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
33245      composeDomainResourceElements(element);
33246      if (element.hasIdentifier()) {
33247        openArray("identifier");
33248        for (Identifier e : element.getIdentifier()) 
33249          composeIdentifier(null, e);
33250        closeArray();
33251      };
33252      if (element.hasStatusElement()) {
33253        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
33254        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
33255      }
33256      if (element.hasCategory()) {
33257        composeCodeableConcept("category", element.getCategory());
33258      }
33259      if (element.hasSeverityElement()) {
33260        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
33261        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
33262      }
33263      if (element.hasPatient()) {
33264        composeReference("patient", element.getPatient());
33265      }
33266      if (element.hasDateElement()) {
33267        composeDateTimeCore("date", element.getDateElement(), false);
33268        composeDateTimeExtras("date", element.getDateElement(), false);
33269      }
33270      if (element.hasAuthor()) {
33271        composeReference("author", element.getAuthor());
33272      }
33273      if (element.hasImplicated()) {
33274        openArray("implicated");
33275        for (Reference e : element.getImplicated()) 
33276          composeReference(null, e);
33277        closeArray();
33278      };
33279      if (element.hasDetailElement()) {
33280        composeStringCore("detail", element.getDetailElement(), false);
33281        composeStringExtras("detail", element.getDetailElement(), false);
33282      }
33283      if (element.hasReferenceElement()) {
33284        composeUriCore("reference", element.getReferenceElement(), false);
33285        composeUriExtras("reference", element.getReferenceElement(), false);
33286      }
33287      if (element.hasMitigation()) {
33288        openArray("mitigation");
33289        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
33290          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
33291        closeArray();
33292      };
33293  }
33294
33295  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
33296    if (element != null) {
33297      open(name);
33298      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
33299      close();
33300    }
33301  }
33302
33303  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
33304      composeBackbone(element);
33305      if (element.hasAction()) {
33306        composeCodeableConcept("action", element.getAction());
33307      }
33308      if (element.hasDateElement()) {
33309        composeDateTimeCore("date", element.getDateElement(), false);
33310        composeDateTimeExtras("date", element.getDateElement(), false);
33311      }
33312      if (element.hasAuthor()) {
33313        composeReference("author", element.getAuthor());
33314      }
33315  }
33316
33317  protected void composeDevice(String name, Device element) throws IOException {
33318    if (element != null) {
33319      prop("resourceType", name);
33320      composeDeviceInner(element);
33321    }
33322  }
33323
33324  protected void composeDeviceInner(Device element) throws IOException {
33325      composeDomainResourceElements(element);
33326      if (element.hasIdentifier()) {
33327        openArray("identifier");
33328        for (Identifier e : element.getIdentifier()) 
33329          composeIdentifier(null, e);
33330        closeArray();
33331      };
33332      if (element.hasUdi()) {
33333        composeDeviceDeviceUdiComponent("udi", element.getUdi());
33334      }
33335      if (element.hasStatusElement()) {
33336        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
33337        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
33338      }
33339      if (element.hasType()) {
33340        composeCodeableConcept("type", element.getType());
33341      }
33342      if (element.hasLotNumberElement()) {
33343        composeStringCore("lotNumber", element.getLotNumberElement(), false);
33344        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
33345      }
33346      if (element.hasManufacturerElement()) {
33347        composeStringCore("manufacturer", element.getManufacturerElement(), false);
33348        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
33349      }
33350      if (element.hasManufactureDateElement()) {
33351        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
33352        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
33353      }
33354      if (element.hasExpirationDateElement()) {
33355        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
33356        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
33357      }
33358      if (element.hasModelElement()) {
33359        composeStringCore("model", element.getModelElement(), false);
33360        composeStringExtras("model", element.getModelElement(), false);
33361      }
33362      if (element.hasVersionElement()) {
33363        composeStringCore("version", element.getVersionElement(), false);
33364        composeStringExtras("version", element.getVersionElement(), false);
33365      }
33366      if (element.hasPatient()) {
33367        composeReference("patient", element.getPatient());
33368      }
33369      if (element.hasOwner()) {
33370        composeReference("owner", element.getOwner());
33371      }
33372      if (element.hasContact()) {
33373        openArray("contact");
33374        for (ContactPoint e : element.getContact()) 
33375          composeContactPoint(null, e);
33376        closeArray();
33377      };
33378      if (element.hasLocation()) {
33379        composeReference("location", element.getLocation());
33380      }
33381      if (element.hasUrlElement()) {
33382        composeUriCore("url", element.getUrlElement(), false);
33383        composeUriExtras("url", element.getUrlElement(), false);
33384      }
33385      if (element.hasNote()) {
33386        openArray("note");
33387        for (Annotation e : element.getNote()) 
33388          composeAnnotation(null, e);
33389        closeArray();
33390      };
33391      if (element.hasSafety()) {
33392        openArray("safety");
33393        for (CodeableConcept e : element.getSafety()) 
33394          composeCodeableConcept(null, e);
33395        closeArray();
33396      };
33397  }
33398
33399  protected void composeDeviceDeviceUdiComponent(String name, Device.DeviceUdiComponent element) throws IOException {
33400    if (element != null) {
33401      open(name);
33402      composeDeviceDeviceUdiComponentInner(element);
33403      close();
33404    }
33405  }
33406
33407  protected void composeDeviceDeviceUdiComponentInner(Device.DeviceUdiComponent element) throws IOException {
33408      composeBackbone(element);
33409      if (element.hasDeviceIdentifierElement()) {
33410        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
33411        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
33412      }
33413      if (element.hasNameElement()) {
33414        composeStringCore("name", element.getNameElement(), false);
33415        composeStringExtras("name", element.getNameElement(), false);
33416      }
33417      if (element.hasJurisdictionElement()) {
33418        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
33419        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
33420      }
33421      if (element.hasCarrierHRFElement()) {
33422        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
33423        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
33424      }
33425      if (element.hasCarrierAIDCElement()) {
33426        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
33427        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
33428      }
33429      if (element.hasIssuerElement()) {
33430        composeUriCore("issuer", element.getIssuerElement(), false);
33431        composeUriExtras("issuer", element.getIssuerElement(), false);
33432      }
33433      if (element.hasEntryTypeElement()) {
33434        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
33435        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
33436      }
33437  }
33438
33439  protected void composeDeviceComponent(String name, DeviceComponent element) throws IOException {
33440    if (element != null) {
33441      prop("resourceType", name);
33442      composeDeviceComponentInner(element);
33443    }
33444  }
33445
33446  protected void composeDeviceComponentInner(DeviceComponent element) throws IOException {
33447      composeDomainResourceElements(element);
33448      if (element.hasIdentifier()) {
33449        openArray("identifier");
33450        for (Identifier e : element.getIdentifier()) 
33451          composeIdentifier(null, e);
33452        closeArray();
33453      };
33454      if (element.hasType()) {
33455        composeCodeableConcept("type", element.getType());
33456      }
33457      if (element.hasLastSystemChangeElement()) {
33458        composeInstantCore("lastSystemChange", element.getLastSystemChangeElement(), false);
33459        composeInstantExtras("lastSystemChange", element.getLastSystemChangeElement(), false);
33460      }
33461      if (element.hasSource()) {
33462        composeReference("source", element.getSource());
33463      }
33464      if (element.hasParent()) {
33465        composeReference("parent", element.getParent());
33466      }
33467      if (element.hasOperationalStatus()) {
33468        openArray("operationalStatus");
33469        for (CodeableConcept e : element.getOperationalStatus()) 
33470          composeCodeableConcept(null, e);
33471        closeArray();
33472      };
33473      if (element.hasParameterGroup()) {
33474        composeCodeableConcept("parameterGroup", element.getParameterGroup());
33475      }
33476      if (element.hasMeasurementPrincipleElement()) {
33477        composeEnumerationCore("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
33478        composeEnumerationExtras("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
33479      }
33480      if (element.hasProductionSpecification()) {
33481        openArray("productionSpecification");
33482        for (DeviceComponent.DeviceComponentProductionSpecificationComponent e : element.getProductionSpecification()) 
33483          composeDeviceComponentDeviceComponentProductionSpecificationComponent(null, e);
33484        closeArray();
33485      };
33486      if (element.hasLanguageCode()) {
33487        composeCodeableConcept("languageCode", element.getLanguageCode());
33488      }
33489      if (element.hasProperty()) {
33490        openArray("property");
33491        for (DeviceComponent.DeviceComponentPropertyComponent e : element.getProperty()) 
33492          composeDeviceComponentDeviceComponentPropertyComponent(null, e);
33493        closeArray();
33494      };
33495  }
33496
33497  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponent(String name, DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
33498    if (element != null) {
33499      open(name);
33500      composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(element);
33501      close();
33502    }
33503  }
33504
33505  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
33506      composeBackbone(element);
33507      if (element.hasSpecType()) {
33508        composeCodeableConcept("specType", element.getSpecType());
33509      }
33510      if (element.hasComponentId()) {
33511        composeIdentifier("componentId", element.getComponentId());
33512      }
33513      if (element.hasProductionSpecElement()) {
33514        composeStringCore("productionSpec", element.getProductionSpecElement(), false);
33515        composeStringExtras("productionSpec", element.getProductionSpecElement(), false);
33516      }
33517  }
33518
33519  protected void composeDeviceComponentDeviceComponentPropertyComponent(String name, DeviceComponent.DeviceComponentPropertyComponent element) throws IOException {
33520    if (element != null) {
33521      open(name);
33522      composeDeviceComponentDeviceComponentPropertyComponentInner(element);
33523      close();
33524    }
33525  }
33526
33527  protected void composeDeviceComponentDeviceComponentPropertyComponentInner(DeviceComponent.DeviceComponentPropertyComponent element) throws IOException {
33528      composeBackbone(element);
33529      if (element.hasType()) {
33530        composeCodeableConcept("type", element.getType());
33531      }
33532      if (element.hasValueQuantity()) {
33533        openArray("valueQuantity");
33534        for (Quantity e : element.getValueQuantity()) 
33535          composeQuantity(null, e);
33536        closeArray();
33537      };
33538      if (element.hasValueCode()) {
33539        openArray("valueCode");
33540        for (CodeableConcept e : element.getValueCode()) 
33541          composeCodeableConcept(null, e);
33542        closeArray();
33543      };
33544  }
33545
33546  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
33547    if (element != null) {
33548      prop("resourceType", name);
33549      composeDeviceMetricInner(element);
33550    }
33551  }
33552
33553  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
33554      composeDomainResourceElements(element);
33555      if (element.hasIdentifier()) {
33556        openArray("identifier");
33557        for (Identifier e : element.getIdentifier()) 
33558          composeIdentifier(null, e);
33559        closeArray();
33560      };
33561      if (element.hasType()) {
33562        composeCodeableConcept("type", element.getType());
33563      }
33564      if (element.hasUnit()) {
33565        composeCodeableConcept("unit", element.getUnit());
33566      }
33567      if (element.hasSource()) {
33568        composeReference("source", element.getSource());
33569      }
33570      if (element.hasParent()) {
33571        composeReference("parent", element.getParent());
33572      }
33573      if (element.hasOperationalStatusElement()) {
33574        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
33575        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
33576      }
33577      if (element.hasColorElement()) {
33578        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
33579        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
33580      }
33581      if (element.hasCategoryElement()) {
33582        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
33583        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
33584      }
33585      if (element.hasMeasurementPeriod()) {
33586        composeTiming("measurementPeriod", element.getMeasurementPeriod());
33587      }
33588      if (element.hasCalibration()) {
33589        openArray("calibration");
33590        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
33591          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
33592        closeArray();
33593      };
33594  }
33595
33596  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
33597    if (element != null) {
33598      open(name);
33599      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
33600      close();
33601    }
33602  }
33603
33604  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
33605      composeBackbone(element);
33606      if (element.hasTypeElement()) {
33607        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
33608        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
33609      }
33610      if (element.hasStateElement()) {
33611        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
33612        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
33613      }
33614      if (element.hasTimeElement()) {
33615        composeInstantCore("time", element.getTimeElement(), false);
33616        composeInstantExtras("time", element.getTimeElement(), false);
33617      }
33618  }
33619
33620  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
33621    if (element != null) {
33622      prop("resourceType", name);
33623      composeDeviceRequestInner(element);
33624    }
33625  }
33626
33627  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
33628      composeDomainResourceElements(element);
33629      if (element.hasIdentifier()) {
33630        openArray("identifier");
33631        for (Identifier e : element.getIdentifier()) 
33632          composeIdentifier(null, e);
33633        closeArray();
33634      };
33635      if (element.hasInstantiates()) {
33636        openArray("instantiates");
33637        for (UriType e : element.getInstantiates()) 
33638          composeUriCore(null, e, true);
33639        closeArray();
33640        if (anyHasExtras(element.getInstantiates())) {
33641          openArray("_instantiates");
33642          for (UriType e : element.getInstantiates()) 
33643            composeUriExtras(null, e, true);
33644          closeArray();
33645        }
33646      };
33647      if (element.hasBasedOn()) {
33648        openArray("basedOn");
33649        for (Reference e : element.getBasedOn()) 
33650          composeReference(null, e);
33651        closeArray();
33652      };
33653      if (element.hasPriorRequest()) {
33654        openArray("priorRequest");
33655        for (Reference e : element.getPriorRequest()) 
33656          composeReference(null, e);
33657        closeArray();
33658      };
33659      if (element.hasGroupIdentifier()) {
33660        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
33661      }
33662      if (element.hasStatusElement()) {
33663        composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
33664        composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
33665      }
33666      if (element.hasIntent()) {
33667        composeCodeableConcept("intent", element.getIntent());
33668      }
33669      if (element.hasPriorityElement()) {
33670        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
33671        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
33672      }
33673      if (element.hasCode()) {
33674        composeType("code", element.getCode());
33675      }
33676      if (element.hasParameter()) {
33677        openArray("parameter");
33678        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
33679          composeDeviceRequestDeviceRequestParameterComponent(null, e);
33680        closeArray();
33681      };
33682      if (element.hasSubject()) {
33683        composeReference("subject", element.getSubject());
33684      }
33685      if (element.hasContext()) {
33686        composeReference("context", element.getContext());
33687      }
33688      if (element.hasOccurrence()) {
33689        composeType("occurrence", element.getOccurrence());
33690      }
33691      if (element.hasAuthoredOnElement()) {
33692        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
33693        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
33694      }
33695      if (element.hasRequester()) {
33696        composeReference("requester", element.getRequester());
33697      }
33698      if (element.hasPerformerType()) {
33699        composeCodeableConcept("performerType", element.getPerformerType());
33700      }
33701      if (element.hasPerformer()) {
33702        composeReference("performer", element.getPerformer());
33703      }
33704      if (element.hasReasonCode()) {
33705        openArray("reasonCode");
33706        for (CodeableConcept e : element.getReasonCode()) 
33707          composeCodeableConcept(null, e);
33708        closeArray();
33709      };
33710      if (element.hasReasonReference()) {
33711        openArray("reasonReference");
33712        for (Reference e : element.getReasonReference()) 
33713          composeReference(null, e);
33714        closeArray();
33715      };
33716      if (element.hasInsurance()) {
33717        openArray("insurance");
33718        for (Reference e : element.getInsurance()) 
33719          composeReference(null, e);
33720        closeArray();
33721      };
33722      if (element.hasSupportingInfo()) {
33723        openArray("supportingInfo");
33724        for (Reference e : element.getSupportingInfo()) 
33725          composeReference(null, e);
33726        closeArray();
33727      };
33728      if (element.hasNote()) {
33729        openArray("note");
33730        for (Annotation e : element.getNote()) 
33731          composeAnnotation(null, e);
33732        closeArray();
33733      };
33734      if (element.hasRelevantHistory()) {
33735        openArray("relevantHistory");
33736        for (Reference e : element.getRelevantHistory()) 
33737          composeReference(null, e);
33738        closeArray();
33739      };
33740  }
33741
33742  protected void composeDeviceRequestDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
33743    if (element != null) {
33744      open(name);
33745      composeDeviceRequestDeviceRequestParameterComponentInner(element);
33746      close();
33747    }
33748  }
33749
33750  protected void composeDeviceRequestDeviceRequestParameterComponentInner(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
33751      composeBackbone(element);
33752      if (element.hasCode()) {
33753        composeCodeableConcept("code", element.getCode());
33754      }
33755      if (element.hasValue()) {
33756        composeType("value", element.getValue());
33757      }
33758  }
33759
33760  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
33761    if (element != null) {
33762      prop("resourceType", name);
33763      composeDeviceUseStatementInner(element);
33764    }
33765  }
33766
33767  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
33768      composeDomainResourceElements(element);
33769      if (element.hasIdentifier()) {
33770        openArray("identifier");
33771        for (Identifier e : element.getIdentifier()) 
33772          composeIdentifier(null, e);
33773        closeArray();
33774      };
33775      if (element.hasBasedOn()) {
33776        openArray("basedOn");
33777        for (Reference e : element.getBasedOn()) 
33778          composeReference(null, e);
33779        closeArray();
33780      };
33781      if (element.hasStatusElement()) {
33782        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
33783        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
33784      }
33785      if (element.hasSubject()) {
33786        composeReference("subject", element.getSubject());
33787      }
33788      if (element.hasDerivedFrom()) {
33789        openArray("derivedFrom");
33790        for (Reference e : element.getDerivedFrom()) 
33791          composeReference(null, e);
33792        closeArray();
33793      };
33794      if (element.hasTiming()) {
33795        composeType("timing", element.getTiming());
33796      }
33797      if (element.hasRecordedOnElement()) {
33798        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
33799        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
33800      }
33801      if (element.hasSource()) {
33802        composeReference("source", element.getSource());
33803      }
33804      if (element.hasDevice()) {
33805        composeReference("device", element.getDevice());
33806      }
33807      if (element.hasReasonCode()) {
33808        openArray("reasonCode");
33809        for (CodeableConcept e : element.getReasonCode()) 
33810          composeCodeableConcept(null, e);
33811        closeArray();
33812      };
33813      if (element.hasReasonReference()) {
33814        openArray("reasonReference");
33815        for (Reference e : element.getReasonReference()) 
33816          composeReference(null, e);
33817        closeArray();
33818      };
33819      if (element.hasBodySite()) {
33820        composeCodeableConcept("bodySite", element.getBodySite());
33821      }
33822      if (element.hasNote()) {
33823        openArray("note");
33824        for (Annotation e : element.getNote()) 
33825          composeAnnotation(null, e);
33826        closeArray();
33827      };
33828  }
33829
33830  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
33831    if (element != null) {
33832      prop("resourceType", name);
33833      composeDiagnosticReportInner(element);
33834    }
33835  }
33836
33837  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
33838      composeDomainResourceElements(element);
33839      if (element.hasIdentifier()) {
33840        openArray("identifier");
33841        for (Identifier e : element.getIdentifier()) 
33842          composeIdentifier(null, e);
33843        closeArray();
33844      };
33845      if (element.hasBasedOn()) {
33846        openArray("basedOn");
33847        for (Reference e : element.getBasedOn()) 
33848          composeReference(null, e);
33849        closeArray();
33850      };
33851      if (element.hasStatusElement()) {
33852        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
33853        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
33854      }
33855      if (element.hasCategory()) {
33856        composeCodeableConcept("category", element.getCategory());
33857      }
33858      if (element.hasCode()) {
33859        composeCodeableConcept("code", element.getCode());
33860      }
33861      if (element.hasSubject()) {
33862        composeReference("subject", element.getSubject());
33863      }
33864      if (element.hasContext()) {
33865        composeReference("context", element.getContext());
33866      }
33867      if (element.hasEffective()) {
33868        composeType("effective", element.getEffective());
33869      }
33870      if (element.hasIssuedElement()) {
33871        composeInstantCore("issued", element.getIssuedElement(), false);
33872        composeInstantExtras("issued", element.getIssuedElement(), false);
33873      }
33874      if (element.hasPerformer()) {
33875        openArray("performer");
33876        for (Reference e : element.getPerformer()) 
33877          composeReference(null, e);
33878        closeArray();
33879      };
33880      if (element.hasResultsInterpreter()) {
33881        openArray("resultsInterpreter");
33882        for (Reference e : element.getResultsInterpreter()) 
33883          composeReference(null, e);
33884        closeArray();
33885      };
33886      if (element.hasSpecimen()) {
33887        openArray("specimen");
33888        for (Reference e : element.getSpecimen()) 
33889          composeReference(null, e);
33890        closeArray();
33891      };
33892      if (element.hasResult()) {
33893        openArray("result");
33894        for (Reference e : element.getResult()) 
33895          composeReference(null, e);
33896        closeArray();
33897      };
33898      if (element.hasImagingStudy()) {
33899        openArray("imagingStudy");
33900        for (Reference e : element.getImagingStudy()) 
33901          composeReference(null, e);
33902        closeArray();
33903      };
33904      if (element.hasMedia()) {
33905        openArray("media");
33906        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
33907          composeDiagnosticReportDiagnosticReportMediaComponent(null, e);
33908        closeArray();
33909      };
33910      if (element.hasConclusionElement()) {
33911        composeStringCore("conclusion", element.getConclusionElement(), false);
33912        composeStringExtras("conclusion", element.getConclusionElement(), false);
33913      }
33914      if (element.hasCodedDiagnosis()) {
33915        openArray("codedDiagnosis");
33916        for (CodeableConcept e : element.getCodedDiagnosis()) 
33917          composeCodeableConcept(null, e);
33918        closeArray();
33919      };
33920      if (element.hasPresentedForm()) {
33921        openArray("presentedForm");
33922        for (Attachment e : element.getPresentedForm()) 
33923          composeAttachment(null, e);
33924        closeArray();
33925      };
33926  }
33927
33928  protected void composeDiagnosticReportDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
33929    if (element != null) {
33930      open(name);
33931      composeDiagnosticReportDiagnosticReportMediaComponentInner(element);
33932      close();
33933    }
33934  }
33935
33936  protected void composeDiagnosticReportDiagnosticReportMediaComponentInner(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
33937      composeBackbone(element);
33938      if (element.hasCommentElement()) {
33939        composeStringCore("comment", element.getCommentElement(), false);
33940        composeStringExtras("comment", element.getCommentElement(), false);
33941      }
33942      if (element.hasLink()) {
33943        composeReference("link", element.getLink());
33944      }
33945  }
33946
33947  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
33948    if (element != null) {
33949      prop("resourceType", name);
33950      composeDocumentManifestInner(element);
33951    }
33952  }
33953
33954  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
33955      composeDomainResourceElements(element);
33956      if (element.hasMasterIdentifier()) {
33957        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
33958      }
33959      if (element.hasIdentifier()) {
33960        openArray("identifier");
33961        for (Identifier e : element.getIdentifier()) 
33962          composeIdentifier(null, e);
33963        closeArray();
33964      };
33965      if (element.hasStatusElement()) {
33966        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
33967        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
33968      }
33969      if (element.hasType()) {
33970        composeCodeableConcept("type", element.getType());
33971      }
33972      if (element.hasSubject()) {
33973        composeReference("subject", element.getSubject());
33974      }
33975      if (element.hasCreatedElement()) {
33976        composeDateTimeCore("created", element.getCreatedElement(), false);
33977        composeDateTimeExtras("created", element.getCreatedElement(), false);
33978      }
33979      if (element.hasAgent()) {
33980        openArray("agent");
33981        for (DocumentManifest.DocumentManifestAgentComponent e : element.getAgent()) 
33982          composeDocumentManifestDocumentManifestAgentComponent(null, e);
33983        closeArray();
33984      };
33985      if (element.hasRecipient()) {
33986        openArray("recipient");
33987        for (Reference e : element.getRecipient()) 
33988          composeReference(null, e);
33989        closeArray();
33990      };
33991      if (element.hasSourceElement()) {
33992        composeUriCore("source", element.getSourceElement(), false);
33993        composeUriExtras("source", element.getSourceElement(), false);
33994      }
33995      if (element.hasDescriptionElement()) {
33996        composeStringCore("description", element.getDescriptionElement(), false);
33997        composeStringExtras("description", element.getDescriptionElement(), false);
33998      }
33999      if (element.hasContent()) {
34000        openArray("content");
34001        for (Reference e : element.getContent()) 
34002          composeReference(null, e);
34003        closeArray();
34004      };
34005      if (element.hasRelated()) {
34006        openArray("related");
34007        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
34008          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
34009        closeArray();
34010      };
34011  }
34012
34013  protected void composeDocumentManifestDocumentManifestAgentComponent(String name, DocumentManifest.DocumentManifestAgentComponent element) throws IOException {
34014    if (element != null) {
34015      open(name);
34016      composeDocumentManifestDocumentManifestAgentComponentInner(element);
34017      close();
34018    }
34019  }
34020
34021  protected void composeDocumentManifestDocumentManifestAgentComponentInner(DocumentManifest.DocumentManifestAgentComponent element) throws IOException {
34022      composeBackbone(element);
34023      if (element.hasType()) {
34024        composeCodeableConcept("type", element.getType());
34025      }
34026      if (element.hasWho()) {
34027        composeReference("who", element.getWho());
34028      }
34029  }
34030
34031  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
34032    if (element != null) {
34033      open(name);
34034      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
34035      close();
34036    }
34037  }
34038
34039  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
34040      composeBackbone(element);
34041      if (element.hasIdentifier()) {
34042        composeIdentifier("identifier", element.getIdentifier());
34043      }
34044      if (element.hasRef()) {
34045        composeReference("ref", element.getRef());
34046      }
34047  }
34048
34049  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
34050    if (element != null) {
34051      prop("resourceType", name);
34052      composeDocumentReferenceInner(element);
34053    }
34054  }
34055
34056  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
34057      composeDomainResourceElements(element);
34058      if (element.hasMasterIdentifier()) {
34059        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
34060      }
34061      if (element.hasIdentifier()) {
34062        openArray("identifier");
34063        for (Identifier e : element.getIdentifier()) 
34064          composeIdentifier(null, e);
34065        closeArray();
34066      };
34067      if (element.hasStatusElement()) {
34068        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
34069        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
34070      }
34071      if (element.hasDocStatusElement()) {
34072        composeEnumerationCore("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
34073        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
34074      }
34075      if (element.hasType()) {
34076        composeCodeableConcept("type", element.getType());
34077      }
34078      if (element.hasClass_()) {
34079        composeCodeableConcept("class", element.getClass_());
34080      }
34081      if (element.hasSubject()) {
34082        composeReference("subject", element.getSubject());
34083      }
34084      if (element.hasCreatedElement()) {
34085        composeDateTimeCore("created", element.getCreatedElement(), false);
34086        composeDateTimeExtras("created", element.getCreatedElement(), false);
34087      }
34088      if (element.hasDateElement()) {
34089        composeInstantCore("date", element.getDateElement(), false);
34090        composeInstantExtras("date", element.getDateElement(), false);
34091      }
34092      if (element.hasAgent()) {
34093        openArray("agent");
34094        for (DocumentReference.DocumentReferenceAgentComponent e : element.getAgent()) 
34095          composeDocumentReferenceDocumentReferenceAgentComponent(null, e);
34096        closeArray();
34097      };
34098      if (element.hasAuthenticator()) {
34099        composeReference("authenticator", element.getAuthenticator());
34100      }
34101      if (element.hasCustodian()) {
34102        composeReference("custodian", element.getCustodian());
34103      }
34104      if (element.hasRelatesTo()) {
34105        openArray("relatesTo");
34106        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
34107          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
34108        closeArray();
34109      };
34110      if (element.hasDescriptionElement()) {
34111        composeStringCore("description", element.getDescriptionElement(), false);
34112        composeStringExtras("description", element.getDescriptionElement(), false);
34113      }
34114      if (element.hasSecurityLabel()) {
34115        openArray("securityLabel");
34116        for (CodeableConcept e : element.getSecurityLabel()) 
34117          composeCodeableConcept(null, e);
34118        closeArray();
34119      };
34120      if (element.hasContent()) {
34121        openArray("content");
34122        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
34123          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
34124        closeArray();
34125      };
34126      if (element.hasContext()) {
34127        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
34128      }
34129  }
34130
34131  protected void composeDocumentReferenceDocumentReferenceAgentComponent(String name, DocumentReference.DocumentReferenceAgentComponent element) throws IOException {
34132    if (element != null) {
34133      open(name);
34134      composeDocumentReferenceDocumentReferenceAgentComponentInner(element);
34135      close();
34136    }
34137  }
34138
34139  protected void composeDocumentReferenceDocumentReferenceAgentComponentInner(DocumentReference.DocumentReferenceAgentComponent element) throws IOException {
34140      composeBackbone(element);
34141      if (element.hasType()) {
34142        composeCodeableConcept("type", element.getType());
34143      }
34144      if (element.hasWho()) {
34145        composeReference("who", element.getWho());
34146      }
34147  }
34148
34149  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
34150    if (element != null) {
34151      open(name);
34152      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
34153      close();
34154    }
34155  }
34156
34157  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
34158      composeBackbone(element);
34159      if (element.hasCodeElement()) {
34160        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
34161        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
34162      }
34163      if (element.hasTarget()) {
34164        composeReference("target", element.getTarget());
34165      }
34166  }
34167
34168  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
34169    if (element != null) {
34170      open(name);
34171      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
34172      close();
34173    }
34174  }
34175
34176  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
34177      composeBackbone(element);
34178      if (element.hasAttachment()) {
34179        composeAttachment("attachment", element.getAttachment());
34180      }
34181      if (element.hasFormat()) {
34182        composeCoding("format", element.getFormat());
34183      }
34184  }
34185
34186  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
34187    if (element != null) {
34188      open(name);
34189      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
34190      close();
34191    }
34192  }
34193
34194  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
34195      composeBackbone(element);
34196      if (element.hasEncounter()) {
34197        composeReference("encounter", element.getEncounter());
34198      }
34199      if (element.hasEvent()) {
34200        openArray("event");
34201        for (CodeableConcept e : element.getEvent()) 
34202          composeCodeableConcept(null, e);
34203        closeArray();
34204      };
34205      if (element.hasPeriod()) {
34206        composePeriod("period", element.getPeriod());
34207      }
34208      if (element.hasFacilityType()) {
34209        composeCodeableConcept("facilityType", element.getFacilityType());
34210      }
34211      if (element.hasPracticeSetting()) {
34212        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
34213      }
34214      if (element.hasSourcePatientInfo()) {
34215        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
34216      }
34217      if (element.hasRelated()) {
34218        openArray("related");
34219        for (DocumentReference.DocumentReferenceContextRelatedComponent e : element.getRelated()) 
34220          composeDocumentReferenceDocumentReferenceContextRelatedComponent(null, e);
34221        closeArray();
34222      };
34223  }
34224
34225  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponent(String name, DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
34226    if (element != null) {
34227      open(name);
34228      composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(element);
34229      close();
34230    }
34231  }
34232
34233  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
34234      composeBackbone(element);
34235      if (element.hasIdentifier()) {
34236        composeIdentifier("identifier", element.getIdentifier());
34237      }
34238      if (element.hasRef()) {
34239        composeReference("ref", element.getRef());
34240      }
34241  }
34242
34243  protected void composeEligibilityRequest(String name, EligibilityRequest element) throws IOException {
34244    if (element != null) {
34245      prop("resourceType", name);
34246      composeEligibilityRequestInner(element);
34247    }
34248  }
34249
34250  protected void composeEligibilityRequestInner(EligibilityRequest element) throws IOException {
34251      composeDomainResourceElements(element);
34252      if (element.hasIdentifier()) {
34253        openArray("identifier");
34254        for (Identifier e : element.getIdentifier()) 
34255          composeIdentifier(null, e);
34256        closeArray();
34257      };
34258      if (element.hasStatusElement()) {
34259        composeEnumerationCore("status", element.getStatusElement(), new EligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
34260        composeEnumerationExtras("status", element.getStatusElement(), new EligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
34261      }
34262      if (element.hasPriority()) {
34263        composeCodeableConcept("priority", element.getPriority());
34264      }
34265      if (element.hasPatient()) {
34266        composeReference("patient", element.getPatient());
34267      }
34268      if (element.hasServiced()) {
34269        composeType("serviced", element.getServiced());
34270      }
34271      if (element.hasCreatedElement()) {
34272        composeDateTimeCore("created", element.getCreatedElement(), false);
34273        composeDateTimeExtras("created", element.getCreatedElement(), false);
34274      }
34275      if (element.hasEnterer()) {
34276        composeReference("enterer", element.getEnterer());
34277      }
34278      if (element.hasProvider()) {
34279        composeReference("provider", element.getProvider());
34280      }
34281      if (element.hasInsurer()) {
34282        composeReference("insurer", element.getInsurer());
34283      }
34284      if (element.hasFacility()) {
34285        composeReference("facility", element.getFacility());
34286      }
34287      if (element.hasCoverage()) {
34288        composeReference("coverage", element.getCoverage());
34289      }
34290      if (element.hasBusinessArrangementElement()) {
34291        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
34292        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
34293      }
34294      if (element.hasBenefitCategory()) {
34295        composeCodeableConcept("benefitCategory", element.getBenefitCategory());
34296      }
34297      if (element.hasBenefitSubCategory()) {
34298        composeCodeableConcept("benefitSubCategory", element.getBenefitSubCategory());
34299      }
34300      if (element.hasAuthorization()) {
34301        openArray("authorization");
34302        for (EligibilityRequest.AuthorizationComponent e : element.getAuthorization()) 
34303          composeEligibilityRequestAuthorizationComponent(null, e);
34304        closeArray();
34305      };
34306  }
34307
34308  protected void composeEligibilityRequestAuthorizationComponent(String name, EligibilityRequest.AuthorizationComponent element) throws IOException {
34309    if (element != null) {
34310      open(name);
34311      composeEligibilityRequestAuthorizationComponentInner(element);
34312      close();
34313    }
34314  }
34315
34316  protected void composeEligibilityRequestAuthorizationComponentInner(EligibilityRequest.AuthorizationComponent element) throws IOException {
34317      composeBackbone(element);
34318      if (element.hasSequenceElement()) {
34319        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34320        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34321      }
34322      if (element.hasService()) {
34323        composeCodeableConcept("service", element.getService());
34324      }
34325      if (element.hasModifier()) {
34326        openArray("modifier");
34327        for (CodeableConcept e : element.getModifier()) 
34328          composeCodeableConcept(null, e);
34329        closeArray();
34330      };
34331      if (element.hasQuantity()) {
34332        composeSimpleQuantity("quantity", element.getQuantity());
34333      }
34334      if (element.hasUnitPrice()) {
34335        composeMoney("unitPrice", element.getUnitPrice());
34336      }
34337      if (element.hasFacility()) {
34338        composeReference("facility", element.getFacility());
34339      }
34340      if (element.hasDiagnosis()) {
34341        openArray("diagnosis");
34342        for (EligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
34343          composeEligibilityRequestDiagnosisComponent(null, e);
34344        closeArray();
34345      };
34346  }
34347
34348  protected void composeEligibilityRequestDiagnosisComponent(String name, EligibilityRequest.DiagnosisComponent element) throws IOException {
34349    if (element != null) {
34350      open(name);
34351      composeEligibilityRequestDiagnosisComponentInner(element);
34352      close();
34353    }
34354  }
34355
34356  protected void composeEligibilityRequestDiagnosisComponentInner(EligibilityRequest.DiagnosisComponent element) throws IOException {
34357      composeBackbone(element);
34358      if (element.hasDiagnosis()) {
34359        composeType("diagnosis", element.getDiagnosis());
34360      }
34361  }
34362
34363  protected void composeEligibilityResponse(String name, EligibilityResponse element) throws IOException {
34364    if (element != null) {
34365      prop("resourceType", name);
34366      composeEligibilityResponseInner(element);
34367    }
34368  }
34369
34370  protected void composeEligibilityResponseInner(EligibilityResponse element) throws IOException {
34371      composeDomainResourceElements(element);
34372      if (element.hasIdentifier()) {
34373        openArray("identifier");
34374        for (Identifier e : element.getIdentifier()) 
34375          composeIdentifier(null, e);
34376        closeArray();
34377      };
34378      if (element.hasStatusElement()) {
34379        composeEnumerationCore("status", element.getStatusElement(), new EligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
34380        composeEnumerationExtras("status", element.getStatusElement(), new EligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
34381      }
34382      if (element.hasCreatedElement()) {
34383        composeDateTimeCore("created", element.getCreatedElement(), false);
34384        composeDateTimeExtras("created", element.getCreatedElement(), false);
34385      }
34386      if (element.hasRequestProvider()) {
34387        composeReference("requestProvider", element.getRequestProvider());
34388      }
34389      if (element.hasRequest()) {
34390        composeReference("request", element.getRequest());
34391      }
34392      if (element.hasOutcomeElement()) {
34393        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
34394        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
34395      }
34396      if (element.hasDispositionElement()) {
34397        composeStringCore("disposition", element.getDispositionElement(), false);
34398        composeStringExtras("disposition", element.getDispositionElement(), false);
34399      }
34400      if (element.hasInsurer()) {
34401        composeReference("insurer", element.getInsurer());
34402      }
34403      if (element.hasInforceElement()) {
34404        composeBooleanCore("inforce", element.getInforceElement(), false);
34405        composeBooleanExtras("inforce", element.getInforceElement(), false);
34406      }
34407      if (element.hasInsurance()) {
34408        openArray("insurance");
34409        for (EligibilityResponse.InsuranceComponent e : element.getInsurance()) 
34410          composeEligibilityResponseInsuranceComponent(null, e);
34411        closeArray();
34412      };
34413      if (element.hasPreAuthRefElement()) {
34414        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
34415        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
34416      }
34417      if (element.hasAuthorization()) {
34418        openArray("authorization");
34419        for (EligibilityResponse.AuthorizationComponent e : element.getAuthorization()) 
34420          composeEligibilityResponseAuthorizationComponent(null, e);
34421        closeArray();
34422      };
34423      if (element.hasForm()) {
34424        composeCodeableConcept("form", element.getForm());
34425      }
34426      if (element.hasError()) {
34427        openArray("error");
34428        for (EligibilityResponse.ErrorsComponent e : element.getError()) 
34429          composeEligibilityResponseErrorsComponent(null, e);
34430        closeArray();
34431      };
34432  }
34433
34434  protected void composeEligibilityResponseInsuranceComponent(String name, EligibilityResponse.InsuranceComponent element) throws IOException {
34435    if (element != null) {
34436      open(name);
34437      composeEligibilityResponseInsuranceComponentInner(element);
34438      close();
34439    }
34440  }
34441
34442  protected void composeEligibilityResponseInsuranceComponentInner(EligibilityResponse.InsuranceComponent element) throws IOException {
34443      composeBackbone(element);
34444      if (element.hasCoverage()) {
34445        composeReference("coverage", element.getCoverage());
34446      }
34447      if (element.hasContract()) {
34448        composeReference("contract", element.getContract());
34449      }
34450      if (element.hasBenefitBalance()) {
34451        openArray("benefitBalance");
34452        for (EligibilityResponse.BenefitsComponent e : element.getBenefitBalance()) 
34453          composeEligibilityResponseBenefitsComponent(null, e);
34454        closeArray();
34455      };
34456  }
34457
34458  protected void composeEligibilityResponseBenefitsComponent(String name, EligibilityResponse.BenefitsComponent element) throws IOException {
34459    if (element != null) {
34460      open(name);
34461      composeEligibilityResponseBenefitsComponentInner(element);
34462      close();
34463    }
34464  }
34465
34466  protected void composeEligibilityResponseBenefitsComponentInner(EligibilityResponse.BenefitsComponent element) throws IOException {
34467      composeBackbone(element);
34468      if (element.hasCategory()) {
34469        composeCodeableConcept("category", element.getCategory());
34470      }
34471      if (element.hasSubCategory()) {
34472        composeCodeableConcept("subCategory", element.getSubCategory());
34473      }
34474      if (element.hasExcludedElement()) {
34475        composeBooleanCore("excluded", element.getExcludedElement(), false);
34476        composeBooleanExtras("excluded", element.getExcludedElement(), false);
34477      }
34478      if (element.hasNameElement()) {
34479        composeStringCore("name", element.getNameElement(), false);
34480        composeStringExtras("name", element.getNameElement(), false);
34481      }
34482      if (element.hasDescriptionElement()) {
34483        composeStringCore("description", element.getDescriptionElement(), false);
34484        composeStringExtras("description", element.getDescriptionElement(), false);
34485      }
34486      if (element.hasNetwork()) {
34487        composeCodeableConcept("network", element.getNetwork());
34488      }
34489      if (element.hasUnit()) {
34490        composeCodeableConcept("unit", element.getUnit());
34491      }
34492      if (element.hasTerm()) {
34493        composeCodeableConcept("term", element.getTerm());
34494      }
34495      if (element.hasFinancial()) {
34496        openArray("financial");
34497        for (EligibilityResponse.BenefitComponent e : element.getFinancial()) 
34498          composeEligibilityResponseBenefitComponent(null, e);
34499        closeArray();
34500      };
34501  }
34502
34503  protected void composeEligibilityResponseBenefitComponent(String name, EligibilityResponse.BenefitComponent element) throws IOException {
34504    if (element != null) {
34505      open(name);
34506      composeEligibilityResponseBenefitComponentInner(element);
34507      close();
34508    }
34509  }
34510
34511  protected void composeEligibilityResponseBenefitComponentInner(EligibilityResponse.BenefitComponent element) throws IOException {
34512      composeBackbone(element);
34513      if (element.hasType()) {
34514        composeCodeableConcept("type", element.getType());
34515      }
34516      if (element.hasAllowed()) {
34517        composeType("allowed", element.getAllowed());
34518      }
34519      if (element.hasUsed()) {
34520        composeType("used", element.getUsed());
34521      }
34522  }
34523
34524  protected void composeEligibilityResponseAuthorizationComponent(String name, EligibilityResponse.AuthorizationComponent element) throws IOException {
34525    if (element != null) {
34526      open(name);
34527      composeEligibilityResponseAuthorizationComponentInner(element);
34528      close();
34529    }
34530  }
34531
34532  protected void composeEligibilityResponseAuthorizationComponentInner(EligibilityResponse.AuthorizationComponent element) throws IOException {
34533      composeBackbone(element);
34534      if (element.hasAuthorizationSequenceElement()) {
34535        composePositiveIntCore("authorizationSequence", element.getAuthorizationSequenceElement(), false);
34536        composePositiveIntExtras("authorizationSequence", element.getAuthorizationSequenceElement(), false);
34537      }
34538      if (element.hasRequiredElement()) {
34539        composeBooleanCore("required", element.getRequiredElement(), false);
34540        composeBooleanExtras("required", element.getRequiredElement(), false);
34541      }
34542      if (element.hasNote()) {
34543        openArray("note");
34544        for (Annotation e : element.getNote()) 
34545          composeAnnotation(null, e);
34546        closeArray();
34547      };
34548  }
34549
34550  protected void composeEligibilityResponseErrorsComponent(String name, EligibilityResponse.ErrorsComponent element) throws IOException {
34551    if (element != null) {
34552      open(name);
34553      composeEligibilityResponseErrorsComponentInner(element);
34554      close();
34555    }
34556  }
34557
34558  protected void composeEligibilityResponseErrorsComponentInner(EligibilityResponse.ErrorsComponent element) throws IOException {
34559      composeBackbone(element);
34560      if (element.hasCode()) {
34561        composeCodeableConcept("code", element.getCode());
34562      }
34563  }
34564
34565  protected void composeEncounter(String name, Encounter element) throws IOException {
34566    if (element != null) {
34567      prop("resourceType", name);
34568      composeEncounterInner(element);
34569    }
34570  }
34571
34572  protected void composeEncounterInner(Encounter element) throws IOException {
34573      composeDomainResourceElements(element);
34574      if (element.hasIdentifier()) {
34575        openArray("identifier");
34576        for (Identifier e : element.getIdentifier()) 
34577          composeIdentifier(null, e);
34578        closeArray();
34579      };
34580      if (element.hasStatusElement()) {
34581        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
34582        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
34583      }
34584      if (element.hasStatusHistory()) {
34585        openArray("statusHistory");
34586        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
34587          composeEncounterStatusHistoryComponent(null, e);
34588        closeArray();
34589      };
34590      if (element.hasClass_()) {
34591        composeCoding("class", element.getClass_());
34592      }
34593      if (element.hasClassHistory()) {
34594        openArray("classHistory");
34595        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
34596          composeEncounterClassHistoryComponent(null, e);
34597        closeArray();
34598      };
34599      if (element.hasType()) {
34600        openArray("type");
34601        for (CodeableConcept e : element.getType()) 
34602          composeCodeableConcept(null, e);
34603        closeArray();
34604      };
34605      if (element.hasServiceType()) {
34606        composeCodeableConcept("serviceType", element.getServiceType());
34607      }
34608      if (element.hasPriority()) {
34609        composeCodeableConcept("priority", element.getPriority());
34610      }
34611      if (element.hasSubject()) {
34612        composeReference("subject", element.getSubject());
34613      }
34614      if (element.hasEpisodeOfCare()) {
34615        openArray("episodeOfCare");
34616        for (Reference e : element.getEpisodeOfCare()) 
34617          composeReference(null, e);
34618        closeArray();
34619      };
34620      if (element.hasBasedOn()) {
34621        openArray("basedOn");
34622        for (Reference e : element.getBasedOn()) 
34623          composeReference(null, e);
34624        closeArray();
34625      };
34626      if (element.hasParticipant()) {
34627        openArray("participant");
34628        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
34629          composeEncounterEncounterParticipantComponent(null, e);
34630        closeArray();
34631      };
34632      if (element.hasAppointment()) {
34633        composeReference("appointment", element.getAppointment());
34634      }
34635      if (element.hasPeriod()) {
34636        composePeriod("period", element.getPeriod());
34637      }
34638      if (element.hasLength()) {
34639        composeDuration("length", element.getLength());
34640      }
34641      if (element.hasReason()) {
34642        openArray("reason");
34643        for (CodeableConcept e : element.getReason()) 
34644          composeCodeableConcept(null, e);
34645        closeArray();
34646      };
34647      if (element.hasDiagnosis()) {
34648        openArray("diagnosis");
34649        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
34650          composeEncounterDiagnosisComponent(null, e);
34651        closeArray();
34652      };
34653      if (element.hasAccount()) {
34654        openArray("account");
34655        for (Reference e : element.getAccount()) 
34656          composeReference(null, e);
34657        closeArray();
34658      };
34659      if (element.hasHospitalization()) {
34660        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
34661      }
34662      if (element.hasLocation()) {
34663        openArray("location");
34664        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
34665          composeEncounterEncounterLocationComponent(null, e);
34666        closeArray();
34667      };
34668      if (element.hasServiceProvider()) {
34669        composeReference("serviceProvider", element.getServiceProvider());
34670      }
34671      if (element.hasPartOf()) {
34672        composeReference("partOf", element.getPartOf());
34673      }
34674  }
34675
34676  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
34677    if (element != null) {
34678      open(name);
34679      composeEncounterStatusHistoryComponentInner(element);
34680      close();
34681    }
34682  }
34683
34684  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element) throws IOException {
34685      composeBackbone(element);
34686      if (element.hasStatusElement()) {
34687        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
34688        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
34689      }
34690      if (element.hasPeriod()) {
34691        composePeriod("period", element.getPeriod());
34692      }
34693  }
34694
34695  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
34696    if (element != null) {
34697      open(name);
34698      composeEncounterClassHistoryComponentInner(element);
34699      close();
34700    }
34701  }
34702
34703  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element) throws IOException {
34704      composeBackbone(element);
34705      if (element.hasClass_()) {
34706        composeCoding("class", element.getClass_());
34707      }
34708      if (element.hasPeriod()) {
34709        composePeriod("period", element.getPeriod());
34710      }
34711  }
34712
34713  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
34714    if (element != null) {
34715      open(name);
34716      composeEncounterEncounterParticipantComponentInner(element);
34717      close();
34718    }
34719  }
34720
34721  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
34722      composeBackbone(element);
34723      if (element.hasType()) {
34724        openArray("type");
34725        for (CodeableConcept e : element.getType()) 
34726          composeCodeableConcept(null, e);
34727        closeArray();
34728      };
34729      if (element.hasPeriod()) {
34730        composePeriod("period", element.getPeriod());
34731      }
34732      if (element.hasIndividual()) {
34733        composeReference("individual", element.getIndividual());
34734      }
34735  }
34736
34737  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
34738    if (element != null) {
34739      open(name);
34740      composeEncounterDiagnosisComponentInner(element);
34741      close();
34742    }
34743  }
34744
34745  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
34746      composeBackbone(element);
34747      if (element.hasCondition()) {
34748        composeReference("condition", element.getCondition());
34749      }
34750      if (element.hasRole()) {
34751        composeCodeableConcept("role", element.getRole());
34752      }
34753      if (element.hasRankElement()) {
34754        composePositiveIntCore("rank", element.getRankElement(), false);
34755        composePositiveIntExtras("rank", element.getRankElement(), false);
34756      }
34757  }
34758
34759  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
34760    if (element != null) {
34761      open(name);
34762      composeEncounterEncounterHospitalizationComponentInner(element);
34763      close();
34764    }
34765  }
34766
34767  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
34768      composeBackbone(element);
34769      if (element.hasPreAdmissionIdentifier()) {
34770        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
34771      }
34772      if (element.hasOrigin()) {
34773        composeReference("origin", element.getOrigin());
34774      }
34775      if (element.hasAdmitSource()) {
34776        composeCodeableConcept("admitSource", element.getAdmitSource());
34777      }
34778      if (element.hasReAdmission()) {
34779        composeCodeableConcept("reAdmission", element.getReAdmission());
34780      }
34781      if (element.hasDietPreference()) {
34782        openArray("dietPreference");
34783        for (CodeableConcept e : element.getDietPreference()) 
34784          composeCodeableConcept(null, e);
34785        closeArray();
34786      };
34787      if (element.hasSpecialCourtesy()) {
34788        openArray("specialCourtesy");
34789        for (CodeableConcept e : element.getSpecialCourtesy()) 
34790          composeCodeableConcept(null, e);
34791        closeArray();
34792      };
34793      if (element.hasSpecialArrangement()) {
34794        openArray("specialArrangement");
34795        for (CodeableConcept e : element.getSpecialArrangement()) 
34796          composeCodeableConcept(null, e);
34797        closeArray();
34798      };
34799      if (element.hasDestination()) {
34800        composeReference("destination", element.getDestination());
34801      }
34802      if (element.hasDischargeDisposition()) {
34803        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
34804      }
34805  }
34806
34807  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
34808    if (element != null) {
34809      open(name);
34810      composeEncounterEncounterLocationComponentInner(element);
34811      close();
34812    }
34813  }
34814
34815  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
34816      composeBackbone(element);
34817      if (element.hasLocation()) {
34818        composeReference("location", element.getLocation());
34819      }
34820      if (element.hasStatusElement()) {
34821        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
34822        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
34823      }
34824      if (element.hasPeriod()) {
34825        composePeriod("period", element.getPeriod());
34826      }
34827  }
34828
34829  protected void composeEndpoint(String name, Endpoint element) throws IOException {
34830    if (element != null) {
34831      prop("resourceType", name);
34832      composeEndpointInner(element);
34833    }
34834  }
34835
34836  protected void composeEndpointInner(Endpoint element) throws IOException {
34837      composeDomainResourceElements(element);
34838      if (element.hasIdentifier()) {
34839        openArray("identifier");
34840        for (Identifier e : element.getIdentifier()) 
34841          composeIdentifier(null, e);
34842        closeArray();
34843      };
34844      if (element.hasStatusElement()) {
34845        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
34846        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
34847      }
34848      if (element.hasConnectionType()) {
34849        composeCoding("connectionType", element.getConnectionType());
34850      }
34851      if (element.hasNameElement()) {
34852        composeStringCore("name", element.getNameElement(), false);
34853        composeStringExtras("name", element.getNameElement(), false);
34854      }
34855      if (element.hasManagingOrganization()) {
34856        composeReference("managingOrganization", element.getManagingOrganization());
34857      }
34858      if (element.hasContact()) {
34859        openArray("contact");
34860        for (ContactPoint e : element.getContact()) 
34861          composeContactPoint(null, e);
34862        closeArray();
34863      };
34864      if (element.hasPeriod()) {
34865        composePeriod("period", element.getPeriod());
34866      }
34867      if (element.hasPayloadType()) {
34868        openArray("payloadType");
34869        for (CodeableConcept e : element.getPayloadType()) 
34870          composeCodeableConcept(null, e);
34871        closeArray();
34872      };
34873      if (element.hasPayloadMimeType()) {
34874        openArray("payloadMimeType");
34875        for (CodeType e : element.getPayloadMimeType()) 
34876          composeCodeCore(null, e, true);
34877        closeArray();
34878        if (anyHasExtras(element.getPayloadMimeType())) {
34879          openArray("_payloadMimeType");
34880          for (CodeType e : element.getPayloadMimeType()) 
34881            composeCodeExtras(null, e, true);
34882          closeArray();
34883        }
34884      };
34885      if (element.hasAddressElement()) {
34886        composeUrlCore("address", element.getAddressElement(), false);
34887        composeUrlExtras("address", element.getAddressElement(), false);
34888      }
34889      if (element.hasHeader()) {
34890        openArray("header");
34891        for (StringType e : element.getHeader()) 
34892          composeStringCore(null, e, true);
34893        closeArray();
34894        if (anyHasExtras(element.getHeader())) {
34895          openArray("_header");
34896          for (StringType e : element.getHeader()) 
34897            composeStringExtras(null, e, true);
34898          closeArray();
34899        }
34900      };
34901  }
34902
34903  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
34904    if (element != null) {
34905      prop("resourceType", name);
34906      composeEnrollmentRequestInner(element);
34907    }
34908  }
34909
34910  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
34911      composeDomainResourceElements(element);
34912      if (element.hasIdentifier()) {
34913        openArray("identifier");
34914        for (Identifier e : element.getIdentifier()) 
34915          composeIdentifier(null, e);
34916        closeArray();
34917      };
34918      if (element.hasStatusElement()) {
34919        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
34920        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
34921      }
34922      if (element.hasCreatedElement()) {
34923        composeDateTimeCore("created", element.getCreatedElement(), false);
34924        composeDateTimeExtras("created", element.getCreatedElement(), false);
34925      }
34926      if (element.hasInsurer()) {
34927        composeReference("insurer", element.getInsurer());
34928      }
34929      if (element.hasProvider()) {
34930        composeReference("provider", element.getProvider());
34931      }
34932      if (element.hasCandidate()) {
34933        composeReference("candidate", element.getCandidate());
34934      }
34935      if (element.hasCoverage()) {
34936        composeReference("coverage", element.getCoverage());
34937      }
34938  }
34939
34940  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
34941    if (element != null) {
34942      prop("resourceType", name);
34943      composeEnrollmentResponseInner(element);
34944    }
34945  }
34946
34947  protected void composeEnrollmentResponseInner(EnrollmentResponse 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 EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
34957        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
34958      }
34959      if (element.hasRequest()) {
34960        composeReference("request", element.getRequest());
34961      }
34962      if (element.hasOutcomeElement()) {
34963        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
34964        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
34965      }
34966      if (element.hasDispositionElement()) {
34967        composeStringCore("disposition", element.getDispositionElement(), false);
34968        composeStringExtras("disposition", element.getDispositionElement(), false);
34969      }
34970      if (element.hasCreatedElement()) {
34971        composeDateTimeCore("created", element.getCreatedElement(), false);
34972        composeDateTimeExtras("created", element.getCreatedElement(), false);
34973      }
34974      if (element.hasOrganization()) {
34975        composeReference("organization", element.getOrganization());
34976      }
34977      if (element.hasRequestProvider()) {
34978        composeReference("requestProvider", element.getRequestProvider());
34979      }
34980  }
34981
34982  protected void composeEntryDefinition(String name, EntryDefinition element) throws IOException {
34983    if (element != null) {
34984      prop("resourceType", name);
34985      composeEntryDefinitionInner(element);
34986    }
34987  }
34988
34989  protected void composeEntryDefinitionInner(EntryDefinition element) throws IOException {
34990      composeDomainResourceElements(element);
34991      if (element.hasType()) {
34992        composeCodeableConcept("type", element.getType());
34993      }
34994      if (element.hasPurpose()) {
34995        composeCodeableConcept("purpose", element.getPurpose());
34996      }
34997      if (element.hasReferencedItem()) {
34998        composeReference("referencedItem", element.getReferencedItem());
34999      }
35000      if (element.hasIdentifier()) {
35001        composeIdentifier("identifier", element.getIdentifier());
35002      }
35003      if (element.hasAdditionalIdentifier()) {
35004        openArray("additionalIdentifier");
35005        for (Identifier e : element.getAdditionalIdentifier()) 
35006          composeIdentifier(null, e);
35007        closeArray();
35008      };
35009      if (element.hasClassification()) {
35010        openArray("classification");
35011        for (CodeableConcept e : element.getClassification()) 
35012          composeCodeableConcept(null, e);
35013        closeArray();
35014      };
35015      if (element.hasStatus()) {
35016        composeCodeableConcept("status", element.getStatus());
35017      }
35018      if (element.hasValidityPeriod()) {
35019        composePeriod("validityPeriod", element.getValidityPeriod());
35020      }
35021      if (element.hasLastUpdatedElement()) {
35022        composeDateTimeCore("lastUpdated", element.getLastUpdatedElement(), false);
35023        composeDateTimeExtras("lastUpdated", element.getLastUpdatedElement(), false);
35024      }
35025      if (element.hasAdditionalCharacteristic()) {
35026        openArray("additionalCharacteristic");
35027        for (CodeableConcept e : element.getAdditionalCharacteristic()) 
35028          composeCodeableConcept(null, e);
35029        closeArray();
35030      };
35031      if (element.hasAdditionalClassification()) {
35032        openArray("additionalClassification");
35033        for (CodeableConcept e : element.getAdditionalClassification()) 
35034          composeCodeableConcept(null, e);
35035        closeArray();
35036      };
35037      if (element.hasRelatedEntry()) {
35038        openArray("relatedEntry");
35039        for (EntryDefinition.EntryDefinitionRelatedEntryComponent e : element.getRelatedEntry()) 
35040          composeEntryDefinitionEntryDefinitionRelatedEntryComponent(null, e);
35041        closeArray();
35042      };
35043  }
35044
35045  protected void composeEntryDefinitionEntryDefinitionRelatedEntryComponent(String name, EntryDefinition.EntryDefinitionRelatedEntryComponent element) throws IOException {
35046    if (element != null) {
35047      open(name);
35048      composeEntryDefinitionEntryDefinitionRelatedEntryComponentInner(element);
35049      close();
35050    }
35051  }
35052
35053  protected void composeEntryDefinitionEntryDefinitionRelatedEntryComponentInner(EntryDefinition.EntryDefinitionRelatedEntryComponent element) throws IOException {
35054      composeBackbone(element);
35055      if (element.hasRelationtype()) {
35056        composeCodeableConcept("relationtype", element.getRelationtype());
35057      }
35058      if (element.hasItem()) {
35059        composeReference("item", element.getItem());
35060      }
35061  }
35062
35063  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
35064    if (element != null) {
35065      prop("resourceType", name);
35066      composeEpisodeOfCareInner(element);
35067    }
35068  }
35069
35070  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
35071      composeDomainResourceElements(element);
35072      if (element.hasIdentifier()) {
35073        openArray("identifier");
35074        for (Identifier e : element.getIdentifier()) 
35075          composeIdentifier(null, e);
35076        closeArray();
35077      };
35078      if (element.hasStatusElement()) {
35079        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
35080        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
35081      }
35082      if (element.hasStatusHistory()) {
35083        openArray("statusHistory");
35084        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
35085          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
35086        closeArray();
35087      };
35088      if (element.hasType()) {
35089        openArray("type");
35090        for (CodeableConcept e : element.getType()) 
35091          composeCodeableConcept(null, e);
35092        closeArray();
35093      };
35094      if (element.hasDiagnosis()) {
35095        openArray("diagnosis");
35096        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
35097          composeEpisodeOfCareDiagnosisComponent(null, e);
35098        closeArray();
35099      };
35100      if (element.hasPatient()) {
35101        composeReference("patient", element.getPatient());
35102      }
35103      if (element.hasManagingOrganization()) {
35104        composeReference("managingOrganization", element.getManagingOrganization());
35105      }
35106      if (element.hasPeriod()) {
35107        composePeriod("period", element.getPeriod());
35108      }
35109      if (element.hasReferralRequest()) {
35110        openArray("referralRequest");
35111        for (Reference e : element.getReferralRequest()) 
35112          composeReference(null, e);
35113        closeArray();
35114      };
35115      if (element.hasCareManager()) {
35116        composeReference("careManager", element.getCareManager());
35117      }
35118      if (element.hasTeam()) {
35119        openArray("team");
35120        for (Reference e : element.getTeam()) 
35121          composeReference(null, e);
35122        closeArray();
35123      };
35124      if (element.hasAccount()) {
35125        openArray("account");
35126        for (Reference e : element.getAccount()) 
35127          composeReference(null, e);
35128        closeArray();
35129      };
35130  }
35131
35132  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
35133    if (element != null) {
35134      open(name);
35135      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
35136      close();
35137    }
35138  }
35139
35140  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
35141      composeBackbone(element);
35142      if (element.hasStatusElement()) {
35143        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
35144        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
35145      }
35146      if (element.hasPeriod()) {
35147        composePeriod("period", element.getPeriod());
35148      }
35149  }
35150
35151  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
35152    if (element != null) {
35153      open(name);
35154      composeEpisodeOfCareDiagnosisComponentInner(element);
35155      close();
35156    }
35157  }
35158
35159  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element) throws IOException {
35160      composeBackbone(element);
35161      if (element.hasCondition()) {
35162        composeReference("condition", element.getCondition());
35163      }
35164      if (element.hasRole()) {
35165        composeCodeableConcept("role", element.getRole());
35166      }
35167      if (element.hasRankElement()) {
35168        composePositiveIntCore("rank", element.getRankElement(), false);
35169        composePositiveIntExtras("rank", element.getRankElement(), false);
35170      }
35171  }
35172
35173  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
35174    if (element != null) {
35175      prop("resourceType", name);
35176      composeEventDefinitionInner(element);
35177    }
35178  }
35179
35180  protected void composeEventDefinitionInner(EventDefinition element) throws IOException {
35181      composeDomainResourceElements(element);
35182      if (element.hasUrlElement()) {
35183        composeUriCore("url", element.getUrlElement(), false);
35184        composeUriExtras("url", element.getUrlElement(), false);
35185      }
35186      if (element.hasIdentifier()) {
35187        openArray("identifier");
35188        for (Identifier e : element.getIdentifier()) 
35189          composeIdentifier(null, e);
35190        closeArray();
35191      };
35192      if (element.hasVersionElement()) {
35193        composeStringCore("version", element.getVersionElement(), false);
35194        composeStringExtras("version", element.getVersionElement(), false);
35195      }
35196      if (element.hasNameElement()) {
35197        composeStringCore("name", element.getNameElement(), false);
35198        composeStringExtras("name", element.getNameElement(), false);
35199      }
35200      if (element.hasTitleElement()) {
35201        composeStringCore("title", element.getTitleElement(), false);
35202        composeStringExtras("title", element.getTitleElement(), false);
35203      }
35204      if (element.hasSubtitleElement()) {
35205        composeStringCore("subtitle", element.getSubtitleElement(), false);
35206        composeStringExtras("subtitle", element.getSubtitleElement(), false);
35207      }
35208      if (element.hasStatusElement()) {
35209        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35210        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35211      }
35212      if (element.hasExperimentalElement()) {
35213        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35214        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35215      }
35216      if (element.hasSubject()) {
35217        composeType("subject", element.getSubject());
35218      }
35219      if (element.hasDateElement()) {
35220        composeDateTimeCore("date", element.getDateElement(), false);
35221        composeDateTimeExtras("date", element.getDateElement(), false);
35222      }
35223      if (element.hasPublisherElement()) {
35224        composeStringCore("publisher", element.getPublisherElement(), false);
35225        composeStringExtras("publisher", element.getPublisherElement(), false);
35226      }
35227      if (element.hasContact()) {
35228        openArray("contact");
35229        for (ContactDetail e : element.getContact()) 
35230          composeContactDetail(null, e);
35231        closeArray();
35232      };
35233      if (element.hasDescriptionElement()) {
35234        composeMarkdownCore("description", element.getDescriptionElement(), false);
35235        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35236      }
35237      if (element.hasUseContext()) {
35238        openArray("useContext");
35239        for (UsageContext e : element.getUseContext()) 
35240          composeUsageContext(null, e);
35241        closeArray();
35242      };
35243      if (element.hasJurisdiction()) {
35244        openArray("jurisdiction");
35245        for (CodeableConcept e : element.getJurisdiction()) 
35246          composeCodeableConcept(null, e);
35247        closeArray();
35248      };
35249      if (element.hasPurposeElement()) {
35250        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35251        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35252      }
35253      if (element.hasUsageElement()) {
35254        composeStringCore("usage", element.getUsageElement(), false);
35255        composeStringExtras("usage", element.getUsageElement(), false);
35256      }
35257      if (element.hasCopyrightElement()) {
35258        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35259        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35260      }
35261      if (element.hasApprovalDateElement()) {
35262        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
35263        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
35264      }
35265      if (element.hasLastReviewDateElement()) {
35266        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
35267        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
35268      }
35269      if (element.hasEffectivePeriod()) {
35270        composePeriod("effectivePeriod", element.getEffectivePeriod());
35271      }
35272      if (element.hasTopic()) {
35273        openArray("topic");
35274        for (CodeableConcept e : element.getTopic()) 
35275          composeCodeableConcept(null, e);
35276        closeArray();
35277      };
35278      if (element.hasContributor()) {
35279        openArray("contributor");
35280        for (Contributor e : element.getContributor()) 
35281          composeContributor(null, e);
35282        closeArray();
35283      };
35284      if (element.hasRelatedArtifact()) {
35285        openArray("relatedArtifact");
35286        for (RelatedArtifact e : element.getRelatedArtifact()) 
35287          composeRelatedArtifact(null, e);
35288        closeArray();
35289      };
35290      if (element.hasTrigger()) {
35291        composeTriggerDefinition("trigger", element.getTrigger());
35292      }
35293  }
35294
35295  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
35296    if (element != null) {
35297      prop("resourceType", name);
35298      composeExampleScenarioInner(element);
35299    }
35300  }
35301
35302  protected void composeExampleScenarioInner(ExampleScenario element) throws IOException {
35303      composeDomainResourceElements(element);
35304      if (element.hasUrlElement()) {
35305        composeUriCore("url", element.getUrlElement(), false);
35306        composeUriExtras("url", element.getUrlElement(), false);
35307      }
35308      if (element.hasIdentifier()) {
35309        openArray("identifier");
35310        for (Identifier e : element.getIdentifier()) 
35311          composeIdentifier(null, e);
35312        closeArray();
35313      };
35314      if (element.hasVersionElement()) {
35315        composeStringCore("version", element.getVersionElement(), false);
35316        composeStringExtras("version", element.getVersionElement(), false);
35317      }
35318      if (element.hasNameElement()) {
35319        composeStringCore("name", element.getNameElement(), false);
35320        composeStringExtras("name", element.getNameElement(), false);
35321      }
35322      if (element.hasStatusElement()) {
35323        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35324        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35325      }
35326      if (element.hasExperimentalElement()) {
35327        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35328        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35329      }
35330      if (element.hasDateElement()) {
35331        composeDateTimeCore("date", element.getDateElement(), false);
35332        composeDateTimeExtras("date", element.getDateElement(), false);
35333      }
35334      if (element.hasPublisherElement()) {
35335        composeStringCore("publisher", element.getPublisherElement(), false);
35336        composeStringExtras("publisher", element.getPublisherElement(), false);
35337      }
35338      if (element.hasContact()) {
35339        openArray("contact");
35340        for (ContactDetail e : element.getContact()) 
35341          composeContactDetail(null, e);
35342        closeArray();
35343      };
35344      if (element.hasUseContext()) {
35345        openArray("useContext");
35346        for (UsageContext e : element.getUseContext()) 
35347          composeUsageContext(null, e);
35348        closeArray();
35349      };
35350      if (element.hasJurisdiction()) {
35351        openArray("jurisdiction");
35352        for (CodeableConcept e : element.getJurisdiction()) 
35353          composeCodeableConcept(null, e);
35354        closeArray();
35355      };
35356      if (element.hasCopyrightElement()) {
35357        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35358        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35359      }
35360      if (element.hasPurposeElement()) {
35361        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35362        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35363      }
35364      if (element.hasActor()) {
35365        openArray("actor");
35366        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
35367          composeExampleScenarioExampleScenarioActorComponent(null, e);
35368        closeArray();
35369      };
35370      if (element.hasInstance()) {
35371        openArray("instance");
35372        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
35373          composeExampleScenarioExampleScenarioInstanceComponent(null, e);
35374        closeArray();
35375      };
35376      if (element.hasProcess()) {
35377        openArray("process");
35378        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
35379          composeExampleScenarioExampleScenarioProcessComponent(null, e);
35380        closeArray();
35381      };
35382      if (element.hasWorkflow()) {
35383        openArray("workflow");
35384        for (CanonicalType e : element.getWorkflow()) 
35385          composeCanonicalCore(null, e, true);
35386        closeArray();
35387        if (anyHasExtras(element.getWorkflow())) {
35388          openArray("_workflow");
35389          for (CanonicalType e : element.getWorkflow()) 
35390            composeCanonicalExtras(null, e, true);
35391          closeArray();
35392        }
35393      };
35394  }
35395
35396  protected void composeExampleScenarioExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
35397    if (element != null) {
35398      open(name);
35399      composeExampleScenarioExampleScenarioActorComponentInner(element);
35400      close();
35401    }
35402  }
35403
35404  protected void composeExampleScenarioExampleScenarioActorComponentInner(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
35405      composeBackbone(element);
35406      if (element.hasActorIdElement()) {
35407        composeStringCore("actorId", element.getActorIdElement(), false);
35408        composeStringExtras("actorId", element.getActorIdElement(), false);
35409      }
35410      if (element.hasTypeElement()) {
35411        composeEnumerationCore("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
35412        composeEnumerationExtras("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
35413      }
35414      if (element.hasNameElement()) {
35415        composeStringCore("name", element.getNameElement(), false);
35416        composeStringExtras("name", element.getNameElement(), false);
35417      }
35418      if (element.hasDescriptionElement()) {
35419        composeMarkdownCore("description", element.getDescriptionElement(), false);
35420        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35421      }
35422  }
35423
35424  protected void composeExampleScenarioExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
35425    if (element != null) {
35426      open(name);
35427      composeExampleScenarioExampleScenarioInstanceComponentInner(element);
35428      close();
35429    }
35430  }
35431
35432  protected void composeExampleScenarioExampleScenarioInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
35433      composeBackbone(element);
35434      if (element.hasResourceIdElement()) {
35435        composeStringCore("resourceId", element.getResourceIdElement(), false);
35436        composeStringExtras("resourceId", element.getResourceIdElement(), false);
35437      }
35438      if (element.hasResourceTypeElement()) {
35439        composeEnumerationCore("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
35440        composeEnumerationExtras("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
35441      }
35442      if (element.hasNameElement()) {
35443        composeStringCore("name", element.getNameElement(), false);
35444        composeStringExtras("name", element.getNameElement(), false);
35445      }
35446      if (element.hasDescriptionElement()) {
35447        composeMarkdownCore("description", element.getDescriptionElement(), false);
35448        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35449      }
35450      if (element.hasVersion()) {
35451        openArray("version");
35452        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
35453          composeExampleScenarioExampleScenarioInstanceVersionComponent(null, e);
35454        closeArray();
35455      };
35456      if (element.hasContainedInstance()) {
35457        openArray("containedInstance");
35458        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
35459          composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(null, e);
35460        closeArray();
35461      };
35462  }
35463
35464  protected void composeExampleScenarioExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
35465    if (element != null) {
35466      open(name);
35467      composeExampleScenarioExampleScenarioInstanceVersionComponentInner(element);
35468      close();
35469    }
35470  }
35471
35472  protected void composeExampleScenarioExampleScenarioInstanceVersionComponentInner(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
35473      composeBackbone(element);
35474      if (element.hasVersionIdElement()) {
35475        composeStringCore("versionId", element.getVersionIdElement(), false);
35476        composeStringExtras("versionId", element.getVersionIdElement(), false);
35477      }
35478      if (element.hasDescriptionElement()) {
35479        composeMarkdownCore("description", element.getDescriptionElement(), false);
35480        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35481      }
35482  }
35483
35484  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
35485    if (element != null) {
35486      open(name);
35487      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(element);
35488      close();
35489    }
35490  }
35491
35492  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
35493      composeBackbone(element);
35494      if (element.hasResourceIdElement()) {
35495        composeStringCore("resourceId", element.getResourceIdElement(), false);
35496        composeStringExtras("resourceId", element.getResourceIdElement(), false);
35497      }
35498      if (element.hasVersionIdElement()) {
35499        composeStringCore("versionId", element.getVersionIdElement(), false);
35500        composeStringExtras("versionId", element.getVersionIdElement(), false);
35501      }
35502  }
35503
35504  protected void composeExampleScenarioExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
35505    if (element != null) {
35506      open(name);
35507      composeExampleScenarioExampleScenarioProcessComponentInner(element);
35508      close();
35509    }
35510  }
35511
35512  protected void composeExampleScenarioExampleScenarioProcessComponentInner(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
35513      composeBackbone(element);
35514      if (element.hasTitleElement()) {
35515        composeStringCore("title", element.getTitleElement(), false);
35516        composeStringExtras("title", element.getTitleElement(), false);
35517      }
35518      if (element.hasDescriptionElement()) {
35519        composeMarkdownCore("description", element.getDescriptionElement(), false);
35520        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35521      }
35522      if (element.hasPreConditionsElement()) {
35523        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
35524        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
35525      }
35526      if (element.hasPostConditionsElement()) {
35527        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
35528        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
35529      }
35530      if (element.hasStep()) {
35531        openArray("step");
35532        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
35533          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
35534        closeArray();
35535      };
35536  }
35537
35538  protected void composeExampleScenarioExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
35539    if (element != null) {
35540      open(name);
35541      composeExampleScenarioExampleScenarioProcessStepComponentInner(element);
35542      close();
35543    }
35544  }
35545
35546  protected void composeExampleScenarioExampleScenarioProcessStepComponentInner(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
35547      composeBackbone(element);
35548      if (element.hasProcess()) {
35549        openArray("process");
35550        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
35551          composeExampleScenarioExampleScenarioProcessComponent(null, e);
35552        closeArray();
35553      };
35554      if (element.hasPauseElement()) {
35555        composeBooleanCore("pause", element.getPauseElement(), false);
35556        composeBooleanExtras("pause", element.getPauseElement(), false);
35557      }
35558      if (element.hasOperation()) {
35559        composeExampleScenarioExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
35560      }
35561      if (element.hasAlternative()) {
35562        composeExampleScenarioExampleScenarioProcessStepAlternativeComponent("alternative", element.getAlternative());
35563      }
35564  }
35565
35566  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
35567    if (element != null) {
35568      open(name);
35569      composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(element);
35570      close();
35571    }
35572  }
35573
35574  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
35575      composeBackbone(element);
35576      if (element.hasNumberElement()) {
35577        composeStringCore("number", element.getNumberElement(), false);
35578        composeStringExtras("number", element.getNumberElement(), false);
35579      }
35580      if (element.hasTypeElement()) {
35581        composeStringCore("type", element.getTypeElement(), false);
35582        composeStringExtras("type", element.getTypeElement(), false);
35583      }
35584      if (element.hasNameElement()) {
35585        composeStringCore("name", element.getNameElement(), false);
35586        composeStringExtras("name", element.getNameElement(), false);
35587      }
35588      if (element.hasInitiatorElement()) {
35589        composeStringCore("initiator", element.getInitiatorElement(), false);
35590        composeStringExtras("initiator", element.getInitiatorElement(), false);
35591      }
35592      if (element.hasReceiverElement()) {
35593        composeStringCore("receiver", element.getReceiverElement(), false);
35594        composeStringExtras("receiver", element.getReceiverElement(), false);
35595      }
35596      if (element.hasDescriptionElement()) {
35597        composeMarkdownCore("description", element.getDescriptionElement(), false);
35598        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35599      }
35600      if (element.hasInitiatorActiveElement()) {
35601        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
35602        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
35603      }
35604      if (element.hasReceiverActiveElement()) {
35605        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
35606        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
35607      }
35608      if (element.hasRequest()) {
35609        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
35610      }
35611      if (element.hasResponse()) {
35612        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
35613      }
35614  }
35615
35616  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
35617    if (element != null) {
35618      open(name);
35619      composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(element);
35620      close();
35621    }
35622  }
35623
35624  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
35625      composeBackbone(element);
35626      if (element.hasNameElement()) {
35627        composeStringCore("name", element.getNameElement(), false);
35628        composeStringExtras("name", element.getNameElement(), false);
35629      }
35630      if (element.hasOption()) {
35631        openArray("option");
35632        for (ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent e : element.getOption()) 
35633          composeExampleScenarioExampleScenarioProcessStepAlternativeOptionComponent(null, e);
35634        closeArray();
35635      };
35636  }
35637
35638  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeOptionComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent element) throws IOException {
35639    if (element != null) {
35640      open(name);
35641      composeExampleScenarioExampleScenarioProcessStepAlternativeOptionComponentInner(element);
35642      close();
35643    }
35644  }
35645
35646  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeOptionComponentInner(ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent element) throws IOException {
35647      composeBackbone(element);
35648      if (element.hasDescriptionElement()) {
35649        composeMarkdownCore("description", element.getDescriptionElement(), false);
35650        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35651      }
35652      if (element.hasStep()) {
35653        openArray("step");
35654        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
35655          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
35656        closeArray();
35657      };
35658      if (element.hasPause()) {
35659        openArray("pause");
35660        for (BooleanType e : element.getPause()) 
35661          composeBooleanCore(null, e, true);
35662        closeArray();
35663        if (anyHasExtras(element.getPause())) {
35664          openArray("_pause");
35665          for (BooleanType e : element.getPause()) 
35666            composeBooleanExtras(null, e, true);
35667          closeArray();
35668        }
35669      };
35670  }
35671
35672  protected void composeExpansionProfile(String name, ExpansionProfile element) throws IOException {
35673    if (element != null) {
35674      prop("resourceType", name);
35675      composeExpansionProfileInner(element);
35676    }
35677  }
35678
35679  protected void composeExpansionProfileInner(ExpansionProfile element) throws IOException {
35680      composeDomainResourceElements(element);
35681      if (element.hasUrlElement()) {
35682        composeUriCore("url", element.getUrlElement(), false);
35683        composeUriExtras("url", element.getUrlElement(), false);
35684      }
35685      if (element.hasIdentifier()) {
35686        composeIdentifier("identifier", element.getIdentifier());
35687      }
35688      if (element.hasVersionElement()) {
35689        composeStringCore("version", element.getVersionElement(), false);
35690        composeStringExtras("version", element.getVersionElement(), false);
35691      }
35692      if (element.hasNameElement()) {
35693        composeStringCore("name", element.getNameElement(), false);
35694        composeStringExtras("name", element.getNameElement(), false);
35695      }
35696      if (element.hasStatusElement()) {
35697        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35698        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35699      }
35700      if (element.hasExperimentalElement()) {
35701        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35702        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35703      }
35704      if (element.hasDateElement()) {
35705        composeDateTimeCore("date", element.getDateElement(), false);
35706        composeDateTimeExtras("date", element.getDateElement(), false);
35707      }
35708      if (element.hasPublisherElement()) {
35709        composeStringCore("publisher", element.getPublisherElement(), false);
35710        composeStringExtras("publisher", element.getPublisherElement(), false);
35711      }
35712      if (element.hasContact()) {
35713        openArray("contact");
35714        for (ContactDetail e : element.getContact()) 
35715          composeContactDetail(null, e);
35716        closeArray();
35717      };
35718      if (element.hasDescriptionElement()) {
35719        composeMarkdownCore("description", element.getDescriptionElement(), false);
35720        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35721      }
35722      if (element.hasUseContext()) {
35723        openArray("useContext");
35724        for (UsageContext e : element.getUseContext()) 
35725          composeUsageContext(null, e);
35726        closeArray();
35727      };
35728      if (element.hasJurisdiction()) {
35729        openArray("jurisdiction");
35730        for (CodeableConcept e : element.getJurisdiction()) 
35731          composeCodeableConcept(null, e);
35732        closeArray();
35733      };
35734      if (element.hasFixedVersion()) {
35735        openArray("fixedVersion");
35736        for (ExpansionProfile.ExpansionProfileFixedVersionComponent e : element.getFixedVersion()) 
35737          composeExpansionProfileExpansionProfileFixedVersionComponent(null, e);
35738        closeArray();
35739      };
35740      if (element.hasExcludedSystem()) {
35741        composeExpansionProfileExpansionProfileExcludedSystemComponent("excludedSystem", element.getExcludedSystem());
35742      }
35743      if (element.hasIncludeDesignationsElement()) {
35744        composeBooleanCore("includeDesignations", element.getIncludeDesignationsElement(), false);
35745        composeBooleanExtras("includeDesignations", element.getIncludeDesignationsElement(), false);
35746      }
35747      if (element.hasDesignation()) {
35748        composeExpansionProfileExpansionProfileDesignationComponent("designation", element.getDesignation());
35749      }
35750      if (element.hasIncludeDefinitionElement()) {
35751        composeBooleanCore("includeDefinition", element.getIncludeDefinitionElement(), false);
35752        composeBooleanExtras("includeDefinition", element.getIncludeDefinitionElement(), false);
35753      }
35754      if (element.hasActiveOnlyElement()) {
35755        composeBooleanCore("activeOnly", element.getActiveOnlyElement(), false);
35756        composeBooleanExtras("activeOnly", element.getActiveOnlyElement(), false);
35757      }
35758      if (element.hasExcludeNestedElement()) {
35759        composeBooleanCore("excludeNested", element.getExcludeNestedElement(), false);
35760        composeBooleanExtras("excludeNested", element.getExcludeNestedElement(), false);
35761      }
35762      if (element.hasExcludeNotForUIElement()) {
35763        composeBooleanCore("excludeNotForUI", element.getExcludeNotForUIElement(), false);
35764        composeBooleanExtras("excludeNotForUI", element.getExcludeNotForUIElement(), false);
35765      }
35766      if (element.hasExcludePostCoordinatedElement()) {
35767        composeBooleanCore("excludePostCoordinated", element.getExcludePostCoordinatedElement(), false);
35768        composeBooleanExtras("excludePostCoordinated", element.getExcludePostCoordinatedElement(), false);
35769      }
35770      if (element.hasDisplayLanguageElement()) {
35771        composeCodeCore("displayLanguage", element.getDisplayLanguageElement(), false);
35772        composeCodeExtras("displayLanguage", element.getDisplayLanguageElement(), false);
35773      }
35774      if (element.hasLimitedExpansionElement()) {
35775        composeBooleanCore("limitedExpansion", element.getLimitedExpansionElement(), false);
35776        composeBooleanExtras("limitedExpansion", element.getLimitedExpansionElement(), false);
35777      }
35778  }
35779
35780  protected void composeExpansionProfileExpansionProfileFixedVersionComponent(String name, ExpansionProfile.ExpansionProfileFixedVersionComponent element) throws IOException {
35781    if (element != null) {
35782      open(name);
35783      composeExpansionProfileExpansionProfileFixedVersionComponentInner(element);
35784      close();
35785    }
35786  }
35787
35788  protected void composeExpansionProfileExpansionProfileFixedVersionComponentInner(ExpansionProfile.ExpansionProfileFixedVersionComponent element) throws IOException {
35789      composeBackbone(element);
35790      if (element.hasSystemElement()) {
35791        composeUriCore("system", element.getSystemElement(), false);
35792        composeUriExtras("system", element.getSystemElement(), false);
35793      }
35794      if (element.hasVersionElement()) {
35795        composeStringCore("version", element.getVersionElement(), false);
35796        composeStringExtras("version", element.getVersionElement(), false);
35797      }
35798      if (element.hasModeElement()) {
35799        composeEnumerationCore("mode", element.getModeElement(), new ExpansionProfile.SystemVersionProcessingModeEnumFactory(), false);
35800        composeEnumerationExtras("mode", element.getModeElement(), new ExpansionProfile.SystemVersionProcessingModeEnumFactory(), false);
35801      }
35802  }
35803
35804  protected void composeExpansionProfileExpansionProfileExcludedSystemComponent(String name, ExpansionProfile.ExpansionProfileExcludedSystemComponent element) throws IOException {
35805    if (element != null) {
35806      open(name);
35807      composeExpansionProfileExpansionProfileExcludedSystemComponentInner(element);
35808      close();
35809    }
35810  }
35811
35812  protected void composeExpansionProfileExpansionProfileExcludedSystemComponentInner(ExpansionProfile.ExpansionProfileExcludedSystemComponent element) throws IOException {
35813      composeBackbone(element);
35814      if (element.hasSystemElement()) {
35815        composeUriCore("system", element.getSystemElement(), false);
35816        composeUriExtras("system", element.getSystemElement(), false);
35817      }
35818      if (element.hasVersionElement()) {
35819        composeStringCore("version", element.getVersionElement(), false);
35820        composeStringExtras("version", element.getVersionElement(), false);
35821      }
35822  }
35823
35824  protected void composeExpansionProfileExpansionProfileDesignationComponent(String name, ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
35825    if (element != null) {
35826      open(name);
35827      composeExpansionProfileExpansionProfileDesignationComponentInner(element);
35828      close();
35829    }
35830  }
35831
35832  protected void composeExpansionProfileExpansionProfileDesignationComponentInner(ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
35833      composeBackbone(element);
35834      if (element.hasInclude()) {
35835        composeExpansionProfileDesignationIncludeComponent("include", element.getInclude());
35836      }
35837      if (element.hasExclude()) {
35838        composeExpansionProfileDesignationExcludeComponent("exclude", element.getExclude());
35839      }
35840  }
35841
35842  protected void composeExpansionProfileDesignationIncludeComponent(String name, ExpansionProfile.DesignationIncludeComponent element) throws IOException {
35843    if (element != null) {
35844      open(name);
35845      composeExpansionProfileDesignationIncludeComponentInner(element);
35846      close();
35847    }
35848  }
35849
35850  protected void composeExpansionProfileDesignationIncludeComponentInner(ExpansionProfile.DesignationIncludeComponent element) throws IOException {
35851      composeBackbone(element);
35852      if (element.hasDesignation()) {
35853        openArray("designation");
35854        for (ExpansionProfile.DesignationIncludeDesignationComponent e : element.getDesignation()) 
35855          composeExpansionProfileDesignationIncludeDesignationComponent(null, e);
35856        closeArray();
35857      };
35858  }
35859
35860  protected void composeExpansionProfileDesignationIncludeDesignationComponent(String name, ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
35861    if (element != null) {
35862      open(name);
35863      composeExpansionProfileDesignationIncludeDesignationComponentInner(element);
35864      close();
35865    }
35866  }
35867
35868  protected void composeExpansionProfileDesignationIncludeDesignationComponentInner(ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
35869      composeBackbone(element);
35870      if (element.hasLanguageElement()) {
35871        composeCodeCore("language", element.getLanguageElement(), false);
35872        composeCodeExtras("language", element.getLanguageElement(), false);
35873      }
35874      if (element.hasUse()) {
35875        composeCoding("use", element.getUse());
35876      }
35877  }
35878
35879  protected void composeExpansionProfileDesignationExcludeComponent(String name, ExpansionProfile.DesignationExcludeComponent element) throws IOException {
35880    if (element != null) {
35881      open(name);
35882      composeExpansionProfileDesignationExcludeComponentInner(element);
35883      close();
35884    }
35885  }
35886
35887  protected void composeExpansionProfileDesignationExcludeComponentInner(ExpansionProfile.DesignationExcludeComponent element) throws IOException {
35888      composeBackbone(element);
35889      if (element.hasDesignation()) {
35890        openArray("designation");
35891        for (ExpansionProfile.DesignationExcludeDesignationComponent e : element.getDesignation()) 
35892          composeExpansionProfileDesignationExcludeDesignationComponent(null, e);
35893        closeArray();
35894      };
35895  }
35896
35897  protected void composeExpansionProfileDesignationExcludeDesignationComponent(String name, ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
35898    if (element != null) {
35899      open(name);
35900      composeExpansionProfileDesignationExcludeDesignationComponentInner(element);
35901      close();
35902    }
35903  }
35904
35905  protected void composeExpansionProfileDesignationExcludeDesignationComponentInner(ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
35906      composeBackbone(element);
35907      if (element.hasLanguageElement()) {
35908        composeCodeCore("language", element.getLanguageElement(), false);
35909        composeCodeExtras("language", element.getLanguageElement(), false);
35910      }
35911      if (element.hasUse()) {
35912        composeCoding("use", element.getUse());
35913      }
35914  }
35915
35916  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
35917    if (element != null) {
35918      prop("resourceType", name);
35919      composeExplanationOfBenefitInner(element);
35920    }
35921  }
35922
35923  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
35924      composeDomainResourceElements(element);
35925      if (element.hasIdentifier()) {
35926        openArray("identifier");
35927        for (Identifier e : element.getIdentifier()) 
35928          composeIdentifier(null, e);
35929        closeArray();
35930      };
35931      if (element.hasStatusElement()) {
35932        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
35933        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
35934      }
35935      if (element.hasType()) {
35936        composeCodeableConcept("type", element.getType());
35937      }
35938      if (element.hasSubType()) {
35939        openArray("subType");
35940        for (CodeableConcept e : element.getSubType()) 
35941          composeCodeableConcept(null, e);
35942        closeArray();
35943      };
35944      if (element.hasUseElement()) {
35945        composeEnumerationCore("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
35946        composeEnumerationExtras("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
35947      }
35948      if (element.hasPatient()) {
35949        composeReference("patient", element.getPatient());
35950      }
35951      if (element.hasBillablePeriod()) {
35952        composePeriod("billablePeriod", element.getBillablePeriod());
35953      }
35954      if (element.hasCreatedElement()) {
35955        composeDateTimeCore("created", element.getCreatedElement(), false);
35956        composeDateTimeExtras("created", element.getCreatedElement(), false);
35957      }
35958      if (element.hasEnterer()) {
35959        composeReference("enterer", element.getEnterer());
35960      }
35961      if (element.hasInsurer()) {
35962        composeReference("insurer", element.getInsurer());
35963      }
35964      if (element.hasProvider()) {
35965        composeReference("provider", element.getProvider());
35966      }
35967      if (element.hasReferral()) {
35968        composeReference("referral", element.getReferral());
35969      }
35970      if (element.hasFacility()) {
35971        composeReference("facility", element.getFacility());
35972      }
35973      if (element.hasClaim()) {
35974        composeReference("claim", element.getClaim());
35975      }
35976      if (element.hasClaimResponse()) {
35977        composeReference("claimResponse", element.getClaimResponse());
35978      }
35979      if (element.hasOutcomeElement()) {
35980        composeEnumerationCore("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
35981        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
35982      }
35983      if (element.hasDispositionElement()) {
35984        composeStringCore("disposition", element.getDispositionElement(), false);
35985        composeStringExtras("disposition", element.getDispositionElement(), false);
35986      }
35987      if (element.hasRelated()) {
35988        openArray("related");
35989        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
35990          composeExplanationOfBenefitRelatedClaimComponent(null, e);
35991        closeArray();
35992      };
35993      if (element.hasPrescription()) {
35994        composeReference("prescription", element.getPrescription());
35995      }
35996      if (element.hasOriginalPrescription()) {
35997        composeReference("originalPrescription", element.getOriginalPrescription());
35998      }
35999      if (element.hasPayee()) {
36000        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
36001      }
36002      if (element.hasInformation()) {
36003        openArray("information");
36004        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getInformation()) 
36005          composeExplanationOfBenefitSupportingInformationComponent(null, e);
36006        closeArray();
36007      };
36008      if (element.hasCareTeam()) {
36009        openArray("careTeam");
36010        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
36011          composeExplanationOfBenefitCareTeamComponent(null, e);
36012        closeArray();
36013      };
36014      if (element.hasDiagnosis()) {
36015        openArray("diagnosis");
36016        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
36017          composeExplanationOfBenefitDiagnosisComponent(null, e);
36018        closeArray();
36019      };
36020      if (element.hasProcedure()) {
36021        openArray("procedure");
36022        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
36023          composeExplanationOfBenefitProcedureComponent(null, e);
36024        closeArray();
36025      };
36026      if (element.hasPrecedenceElement()) {
36027        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
36028        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
36029      }
36030      if (element.hasInsurance()) {
36031        composeExplanationOfBenefitInsuranceComponent("insurance", element.getInsurance());
36032      }
36033      if (element.hasAccident()) {
36034        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
36035      }
36036      if (element.hasItem()) {
36037        openArray("item");
36038        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
36039          composeExplanationOfBenefitItemComponent(null, e);
36040        closeArray();
36041      };
36042      if (element.hasAddItem()) {
36043        openArray("addItem");
36044        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
36045          composeExplanationOfBenefitAddedItemComponent(null, e);
36046        closeArray();
36047      };
36048      if (element.hasTotal()) {
36049        openArray("total");
36050        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
36051          composeExplanationOfBenefitTotalComponent(null, e);
36052        closeArray();
36053      };
36054      if (element.hasPayment()) {
36055        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
36056      }
36057      if (element.hasForm()) {
36058        composeCodeableConcept("form", element.getForm());
36059      }
36060      if (element.hasProcessNote()) {
36061        openArray("processNote");
36062        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
36063          composeExplanationOfBenefitNoteComponent(null, e);
36064        closeArray();
36065      };
36066      if (element.hasBenefitBalance()) {
36067        openArray("benefitBalance");
36068        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
36069          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
36070        closeArray();
36071      };
36072  }
36073
36074  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
36075    if (element != null) {
36076      open(name);
36077      composeExplanationOfBenefitRelatedClaimComponentInner(element);
36078      close();
36079    }
36080  }
36081
36082  protected void composeExplanationOfBenefitRelatedClaimComponentInner(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
36083      composeBackbone(element);
36084      if (element.hasClaim()) {
36085        composeReference("claim", element.getClaim());
36086      }
36087      if (element.hasRelationship()) {
36088        composeCodeableConcept("relationship", element.getRelationship());
36089      }
36090      if (element.hasReference()) {
36091        composeIdentifier("reference", element.getReference());
36092      }
36093  }
36094
36095  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
36096    if (element != null) {
36097      open(name);
36098      composeExplanationOfBenefitPayeeComponentInner(element);
36099      close();
36100    }
36101  }
36102
36103  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
36104      composeBackbone(element);
36105      if (element.hasType()) {
36106        composeCodeableConcept("type", element.getType());
36107      }
36108      if (element.hasResource()) {
36109        composeCoding("resource", element.getResource());
36110      }
36111      if (element.hasParty()) {
36112        composeReference("party", element.getParty());
36113      }
36114  }
36115
36116  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
36117    if (element != null) {
36118      open(name);
36119      composeExplanationOfBenefitSupportingInformationComponentInner(element);
36120      close();
36121    }
36122  }
36123
36124  protected void composeExplanationOfBenefitSupportingInformationComponentInner(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
36125      composeBackbone(element);
36126      if (element.hasSequenceElement()) {
36127        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36128        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36129      }
36130      if (element.hasCategory()) {
36131        composeCodeableConcept("category", element.getCategory());
36132      }
36133      if (element.hasCode()) {
36134        composeCodeableConcept("code", element.getCode());
36135      }
36136      if (element.hasTiming()) {
36137        composeType("timing", element.getTiming());
36138      }
36139      if (element.hasValue()) {
36140        composeType("value", element.getValue());
36141      }
36142      if (element.hasReason()) {
36143        composeCoding("reason", element.getReason());
36144      }
36145  }
36146
36147  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
36148    if (element != null) {
36149      open(name);
36150      composeExplanationOfBenefitCareTeamComponentInner(element);
36151      close();
36152    }
36153  }
36154
36155  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
36156      composeBackbone(element);
36157      if (element.hasSequenceElement()) {
36158        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36159        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36160      }
36161      if (element.hasProvider()) {
36162        composeReference("provider", element.getProvider());
36163      }
36164      if (element.hasResponsibleElement()) {
36165        composeBooleanCore("responsible", element.getResponsibleElement(), false);
36166        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
36167      }
36168      if (element.hasRole()) {
36169        composeCodeableConcept("role", element.getRole());
36170      }
36171      if (element.hasQualification()) {
36172        composeCodeableConcept("qualification", element.getQualification());
36173      }
36174  }
36175
36176  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
36177    if (element != null) {
36178      open(name);
36179      composeExplanationOfBenefitDiagnosisComponentInner(element);
36180      close();
36181    }
36182  }
36183
36184  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
36185      composeBackbone(element);
36186      if (element.hasSequenceElement()) {
36187        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36188        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36189      }
36190      if (element.hasDiagnosis()) {
36191        composeType("diagnosis", element.getDiagnosis());
36192      }
36193      if (element.hasType()) {
36194        openArray("type");
36195        for (CodeableConcept e : element.getType()) 
36196          composeCodeableConcept(null, e);
36197        closeArray();
36198      };
36199      if (element.hasPackageCode()) {
36200        composeCodeableConcept("packageCode", element.getPackageCode());
36201      }
36202  }
36203
36204  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
36205    if (element != null) {
36206      open(name);
36207      composeExplanationOfBenefitProcedureComponentInner(element);
36208      close();
36209    }
36210  }
36211
36212  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
36213      composeBackbone(element);
36214      if (element.hasSequenceElement()) {
36215        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36216        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36217      }
36218      if (element.hasDateElement()) {
36219        composeDateTimeCore("date", element.getDateElement(), false);
36220        composeDateTimeExtras("date", element.getDateElement(), false);
36221      }
36222      if (element.hasProcedure()) {
36223        composeType("procedure", element.getProcedure());
36224      }
36225  }
36226
36227  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
36228    if (element != null) {
36229      open(name);
36230      composeExplanationOfBenefitInsuranceComponentInner(element);
36231      close();
36232    }
36233  }
36234
36235  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
36236      composeBackbone(element);
36237      if (element.hasCoverage()) {
36238        composeReference("coverage", element.getCoverage());
36239      }
36240      if (element.hasPreAuthRef()) {
36241        openArray("preAuthRef");
36242        for (StringType e : element.getPreAuthRef()) 
36243          composeStringCore(null, e, true);
36244        closeArray();
36245        if (anyHasExtras(element.getPreAuthRef())) {
36246          openArray("_preAuthRef");
36247          for (StringType e : element.getPreAuthRef()) 
36248            composeStringExtras(null, e, true);
36249          closeArray();
36250        }
36251      };
36252  }
36253
36254  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
36255    if (element != null) {
36256      open(name);
36257      composeExplanationOfBenefitAccidentComponentInner(element);
36258      close();
36259    }
36260  }
36261
36262  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element) throws IOException {
36263      composeBackbone(element);
36264      if (element.hasDateElement()) {
36265        composeDateCore("date", element.getDateElement(), false);
36266        composeDateExtras("date", element.getDateElement(), false);
36267      }
36268      if (element.hasType()) {
36269        composeCodeableConcept("type", element.getType());
36270      }
36271      if (element.hasLocation()) {
36272        composeType("location", element.getLocation());
36273      }
36274  }
36275
36276  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
36277    if (element != null) {
36278      open(name);
36279      composeExplanationOfBenefitItemComponentInner(element);
36280      close();
36281    }
36282  }
36283
36284  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element) throws IOException {
36285      composeBackbone(element);
36286      if (element.hasSequenceElement()) {
36287        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36288        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36289      }
36290      if (element.hasCareTeamSequence()) {
36291        openArray("careTeamSequence");
36292        for (PositiveIntType e : element.getCareTeamSequence()) 
36293          composePositiveIntCore(null, e, true);
36294        closeArray();
36295        if (anyHasExtras(element.getCareTeamSequence())) {
36296          openArray("_careTeamSequence");
36297          for (PositiveIntType e : element.getCareTeamSequence()) 
36298            composePositiveIntExtras(null, e, true);
36299          closeArray();
36300        }
36301      };
36302      if (element.hasDiagnosisSequence()) {
36303        openArray("diagnosisSequence");
36304        for (PositiveIntType e : element.getDiagnosisSequence()) 
36305          composePositiveIntCore(null, e, true);
36306        closeArray();
36307        if (anyHasExtras(element.getDiagnosisSequence())) {
36308          openArray("_diagnosisSequence");
36309          for (PositiveIntType e : element.getDiagnosisSequence()) 
36310            composePositiveIntExtras(null, e, true);
36311          closeArray();
36312        }
36313      };
36314      if (element.hasProcedureSequence()) {
36315        openArray("procedureSequence");
36316        for (PositiveIntType e : element.getProcedureSequence()) 
36317          composePositiveIntCore(null, e, true);
36318        closeArray();
36319        if (anyHasExtras(element.getProcedureSequence())) {
36320          openArray("_procedureSequence");
36321          for (PositiveIntType e : element.getProcedureSequence()) 
36322            composePositiveIntExtras(null, e, true);
36323          closeArray();
36324        }
36325      };
36326      if (element.hasInformationSequence()) {
36327        openArray("informationSequence");
36328        for (PositiveIntType e : element.getInformationSequence()) 
36329          composePositiveIntCore(null, e, true);
36330        closeArray();
36331        if (anyHasExtras(element.getInformationSequence())) {
36332          openArray("_informationSequence");
36333          for (PositiveIntType e : element.getInformationSequence()) 
36334            composePositiveIntExtras(null, e, true);
36335          closeArray();
36336        }
36337      };
36338      if (element.hasRevenue()) {
36339        composeCodeableConcept("revenue", element.getRevenue());
36340      }
36341      if (element.hasCategory()) {
36342        composeCodeableConcept("category", element.getCategory());
36343      }
36344      if (element.hasService()) {
36345        composeCodeableConcept("service", element.getService());
36346      }
36347      if (element.hasModifier()) {
36348        openArray("modifier");
36349        for (CodeableConcept e : element.getModifier()) 
36350          composeCodeableConcept(null, e);
36351        closeArray();
36352      };
36353      if (element.hasProgramCode()) {
36354        openArray("programCode");
36355        for (CodeableConcept e : element.getProgramCode()) 
36356          composeCodeableConcept(null, e);
36357        closeArray();
36358      };
36359      if (element.hasServiced()) {
36360        composeType("serviced", element.getServiced());
36361      }
36362      if (element.hasLocation()) {
36363        composeType("location", element.getLocation());
36364      }
36365      if (element.hasQuantity()) {
36366        composeSimpleQuantity("quantity", element.getQuantity());
36367      }
36368      if (element.hasUnitPrice()) {
36369        composeMoney("unitPrice", element.getUnitPrice());
36370      }
36371      if (element.hasFactorElement()) {
36372        composeDecimalCore("factor", element.getFactorElement(), false);
36373        composeDecimalExtras("factor", element.getFactorElement(), false);
36374      }
36375      if (element.hasNet()) {
36376        composeMoney("net", element.getNet());
36377      }
36378      if (element.hasUdi()) {
36379        openArray("udi");
36380        for (Reference e : element.getUdi()) 
36381          composeReference(null, e);
36382        closeArray();
36383      };
36384      if (element.hasBodySite()) {
36385        composeCodeableConcept("bodySite", element.getBodySite());
36386      }
36387      if (element.hasSubSite()) {
36388        openArray("subSite");
36389        for (CodeableConcept e : element.getSubSite()) 
36390          composeCodeableConcept(null, e);
36391        closeArray();
36392      };
36393      if (element.hasEncounter()) {
36394        openArray("encounter");
36395        for (Reference e : element.getEncounter()) 
36396          composeReference(null, e);
36397        closeArray();
36398      };
36399      if (element.hasNoteNumber()) {
36400        openArray("noteNumber");
36401        for (PositiveIntType e : element.getNoteNumber()) 
36402          composePositiveIntCore(null, e, true);
36403        closeArray();
36404        if (anyHasExtras(element.getNoteNumber())) {
36405          openArray("_noteNumber");
36406          for (PositiveIntType e : element.getNoteNumber()) 
36407            composePositiveIntExtras(null, e, true);
36408          closeArray();
36409        }
36410      };
36411      if (element.hasAdjudication()) {
36412        openArray("adjudication");
36413        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
36414          composeExplanationOfBenefitAdjudicationComponent(null, e);
36415        closeArray();
36416      };
36417      if (element.hasDetail()) {
36418        openArray("detail");
36419        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
36420          composeExplanationOfBenefitDetailComponent(null, e);
36421        closeArray();
36422      };
36423  }
36424
36425  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
36426    if (element != null) {
36427      open(name);
36428      composeExplanationOfBenefitAdjudicationComponentInner(element);
36429      close();
36430    }
36431  }
36432
36433  protected void composeExplanationOfBenefitAdjudicationComponentInner(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
36434      composeBackbone(element);
36435      if (element.hasCategory()) {
36436        composeCodeableConcept("category", element.getCategory());
36437      }
36438      if (element.hasReason()) {
36439        composeCodeableConcept("reason", element.getReason());
36440      }
36441      if (element.hasAmount()) {
36442        composeMoney("amount", element.getAmount());
36443      }
36444      if (element.hasValueElement()) {
36445        composeDecimalCore("value", element.getValueElement(), false);
36446        composeDecimalExtras("value", element.getValueElement(), false);
36447      }
36448  }
36449
36450  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
36451    if (element != null) {
36452      open(name);
36453      composeExplanationOfBenefitDetailComponentInner(element);
36454      close();
36455    }
36456  }
36457
36458  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
36459      composeBackbone(element);
36460      if (element.hasSequenceElement()) {
36461        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36462        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36463      }
36464      if (element.hasRevenue()) {
36465        composeCodeableConcept("revenue", element.getRevenue());
36466      }
36467      if (element.hasCategory()) {
36468        composeCodeableConcept("category", element.getCategory());
36469      }
36470      if (element.hasService()) {
36471        composeCodeableConcept("service", element.getService());
36472      }
36473      if (element.hasModifier()) {
36474        openArray("modifier");
36475        for (CodeableConcept e : element.getModifier()) 
36476          composeCodeableConcept(null, e);
36477        closeArray();
36478      };
36479      if (element.hasProgramCode()) {
36480        openArray("programCode");
36481        for (CodeableConcept e : element.getProgramCode()) 
36482          composeCodeableConcept(null, e);
36483        closeArray();
36484      };
36485      if (element.hasQuantity()) {
36486        composeSimpleQuantity("quantity", element.getQuantity());
36487      }
36488      if (element.hasUnitPrice()) {
36489        composeMoney("unitPrice", element.getUnitPrice());
36490      }
36491      if (element.hasFactorElement()) {
36492        composeDecimalCore("factor", element.getFactorElement(), false);
36493        composeDecimalExtras("factor", element.getFactorElement(), false);
36494      }
36495      if (element.hasNet()) {
36496        composeMoney("net", element.getNet());
36497      }
36498      if (element.hasUdi()) {
36499        openArray("udi");
36500        for (Reference e : element.getUdi()) 
36501          composeReference(null, e);
36502        closeArray();
36503      };
36504      if (element.hasNoteNumber()) {
36505        openArray("noteNumber");
36506        for (PositiveIntType e : element.getNoteNumber()) 
36507          composePositiveIntCore(null, e, true);
36508        closeArray();
36509        if (anyHasExtras(element.getNoteNumber())) {
36510          openArray("_noteNumber");
36511          for (PositiveIntType e : element.getNoteNumber()) 
36512            composePositiveIntExtras(null, e, true);
36513          closeArray();
36514        }
36515      };
36516      if (element.hasAdjudication()) {
36517        openArray("adjudication");
36518        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
36519          composeExplanationOfBenefitAdjudicationComponent(null, e);
36520        closeArray();
36521      };
36522      if (element.hasSubDetail()) {
36523        openArray("subDetail");
36524        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
36525          composeExplanationOfBenefitSubDetailComponent(null, e);
36526        closeArray();
36527      };
36528  }
36529
36530  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
36531    if (element != null) {
36532      open(name);
36533      composeExplanationOfBenefitSubDetailComponentInner(element);
36534      close();
36535    }
36536  }
36537
36538  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
36539      composeBackbone(element);
36540      if (element.hasSequenceElement()) {
36541        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36542        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36543      }
36544      if (element.hasRevenue()) {
36545        composeCodeableConcept("revenue", element.getRevenue());
36546      }
36547      if (element.hasCategory()) {
36548        composeCodeableConcept("category", element.getCategory());
36549      }
36550      if (element.hasService()) {
36551        composeCodeableConcept("service", element.getService());
36552      }
36553      if (element.hasModifier()) {
36554        openArray("modifier");
36555        for (CodeableConcept e : element.getModifier()) 
36556          composeCodeableConcept(null, e);
36557        closeArray();
36558      };
36559      if (element.hasProgramCode()) {
36560        openArray("programCode");
36561        for (CodeableConcept e : element.getProgramCode()) 
36562          composeCodeableConcept(null, e);
36563        closeArray();
36564      };
36565      if (element.hasQuantity()) {
36566        composeSimpleQuantity("quantity", element.getQuantity());
36567      }
36568      if (element.hasUnitPrice()) {
36569        composeMoney("unitPrice", element.getUnitPrice());
36570      }
36571      if (element.hasFactorElement()) {
36572        composeDecimalCore("factor", element.getFactorElement(), false);
36573        composeDecimalExtras("factor", element.getFactorElement(), false);
36574      }
36575      if (element.hasNet()) {
36576        composeMoney("net", element.getNet());
36577      }
36578      if (element.hasUdi()) {
36579        openArray("udi");
36580        for (Reference e : element.getUdi()) 
36581          composeReference(null, e);
36582        closeArray();
36583      };
36584      if (element.hasNoteNumber()) {
36585        openArray("noteNumber");
36586        for (PositiveIntType e : element.getNoteNumber()) 
36587          composePositiveIntCore(null, e, true);
36588        closeArray();
36589        if (anyHasExtras(element.getNoteNumber())) {
36590          openArray("_noteNumber");
36591          for (PositiveIntType e : element.getNoteNumber()) 
36592            composePositiveIntExtras(null, e, true);
36593          closeArray();
36594        }
36595      };
36596      if (element.hasAdjudication()) {
36597        openArray("adjudication");
36598        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
36599          composeExplanationOfBenefitAdjudicationComponent(null, e);
36600        closeArray();
36601      };
36602  }
36603
36604  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
36605    if (element != null) {
36606      open(name);
36607      composeExplanationOfBenefitAddedItemComponentInner(element);
36608      close();
36609    }
36610  }
36611
36612  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
36613      composeBackbone(element);
36614      if (element.hasItemSequence()) {
36615        openArray("itemSequence");
36616        for (PositiveIntType e : element.getItemSequence()) 
36617          composePositiveIntCore(null, e, true);
36618        closeArray();
36619        if (anyHasExtras(element.getItemSequence())) {
36620          openArray("_itemSequence");
36621          for (PositiveIntType e : element.getItemSequence()) 
36622            composePositiveIntExtras(null, e, true);
36623          closeArray();
36624        }
36625      };
36626      if (element.hasDetailSequence()) {
36627        openArray("detailSequence");
36628        for (PositiveIntType e : element.getDetailSequence()) 
36629          composePositiveIntCore(null, e, true);
36630        closeArray();
36631        if (anyHasExtras(element.getDetailSequence())) {
36632          openArray("_detailSequence");
36633          for (PositiveIntType e : element.getDetailSequence()) 
36634            composePositiveIntExtras(null, e, true);
36635          closeArray();
36636        }
36637      };
36638      if (element.hasSubDetailSequence()) {
36639        openArray("subDetailSequence");
36640        for (PositiveIntType e : element.getSubDetailSequence()) 
36641          composePositiveIntCore(null, e, true);
36642        closeArray();
36643        if (anyHasExtras(element.getSubDetailSequence())) {
36644          openArray("_subDetailSequence");
36645          for (PositiveIntType e : element.getSubDetailSequence()) 
36646            composePositiveIntExtras(null, e, true);
36647          closeArray();
36648        }
36649      };
36650      if (element.hasService()) {
36651        composeCodeableConcept("service", element.getService());
36652      }
36653      if (element.hasModifier()) {
36654        openArray("modifier");
36655        for (CodeableConcept e : element.getModifier()) 
36656          composeCodeableConcept(null, e);
36657        closeArray();
36658      };
36659      if (element.hasFee()) {
36660        composeMoney("fee", element.getFee());
36661      }
36662      if (element.hasNoteNumber()) {
36663        openArray("noteNumber");
36664        for (PositiveIntType e : element.getNoteNumber()) 
36665          composePositiveIntCore(null, e, true);
36666        closeArray();
36667        if (anyHasExtras(element.getNoteNumber())) {
36668          openArray("_noteNumber");
36669          for (PositiveIntType e : element.getNoteNumber()) 
36670            composePositiveIntExtras(null, e, true);
36671          closeArray();
36672        }
36673      };
36674      if (element.hasAdjudication()) {
36675        openArray("adjudication");
36676        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
36677          composeExplanationOfBenefitAdjudicationComponent(null, e);
36678        closeArray();
36679      };
36680  }
36681
36682  protected void composeExplanationOfBenefitTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
36683    if (element != null) {
36684      open(name);
36685      composeExplanationOfBenefitTotalComponentInner(element);
36686      close();
36687    }
36688  }
36689
36690  protected void composeExplanationOfBenefitTotalComponentInner(ExplanationOfBenefit.TotalComponent element) throws IOException {
36691      composeBackbone(element);
36692      if (element.hasCategory()) {
36693        composeCodeableConcept("category", element.getCategory());
36694      }
36695      if (element.hasAmount()) {
36696        composeMoney("amount", element.getAmount());
36697      }
36698  }
36699
36700  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
36701    if (element != null) {
36702      open(name);
36703      composeExplanationOfBenefitPaymentComponentInner(element);
36704      close();
36705    }
36706  }
36707
36708  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element) throws IOException {
36709      composeBackbone(element);
36710      if (element.hasType()) {
36711        composeCodeableConcept("type", element.getType());
36712      }
36713      if (element.hasAdjustment()) {
36714        composeMoney("adjustment", element.getAdjustment());
36715      }
36716      if (element.hasAdjustmentReason()) {
36717        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
36718      }
36719      if (element.hasDateElement()) {
36720        composeDateCore("date", element.getDateElement(), false);
36721        composeDateExtras("date", element.getDateElement(), false);
36722      }
36723      if (element.hasAmount()) {
36724        composeMoney("amount", element.getAmount());
36725      }
36726      if (element.hasIdentifier()) {
36727        composeIdentifier("identifier", element.getIdentifier());
36728      }
36729  }
36730
36731  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
36732    if (element != null) {
36733      open(name);
36734      composeExplanationOfBenefitNoteComponentInner(element);
36735      close();
36736    }
36737  }
36738
36739  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element) throws IOException {
36740      composeBackbone(element);
36741      if (element.hasNumberElement()) {
36742        composePositiveIntCore("number", element.getNumberElement(), false);
36743        composePositiveIntExtras("number", element.getNumberElement(), false);
36744      }
36745      if (element.hasTypeElement()) {
36746        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
36747        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
36748      }
36749      if (element.hasTextElement()) {
36750        composeStringCore("text", element.getTextElement(), false);
36751        composeStringExtras("text", element.getTextElement(), false);
36752      }
36753      if (element.hasLanguage()) {
36754        composeCodeableConcept("language", element.getLanguage());
36755      }
36756  }
36757
36758  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
36759    if (element != null) {
36760      open(name);
36761      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
36762      close();
36763    }
36764  }
36765
36766  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
36767      composeBackbone(element);
36768      if (element.hasCategory()) {
36769        composeCodeableConcept("category", element.getCategory());
36770      }
36771      if (element.hasSubCategory()) {
36772        composeCodeableConcept("subCategory", element.getSubCategory());
36773      }
36774      if (element.hasExcludedElement()) {
36775        composeBooleanCore("excluded", element.getExcludedElement(), false);
36776        composeBooleanExtras("excluded", element.getExcludedElement(), false);
36777      }
36778      if (element.hasNameElement()) {
36779        composeStringCore("name", element.getNameElement(), false);
36780        composeStringExtras("name", element.getNameElement(), false);
36781      }
36782      if (element.hasDescriptionElement()) {
36783        composeStringCore("description", element.getDescriptionElement(), false);
36784        composeStringExtras("description", element.getDescriptionElement(), false);
36785      }
36786      if (element.hasNetwork()) {
36787        composeCodeableConcept("network", element.getNetwork());
36788      }
36789      if (element.hasUnit()) {
36790        composeCodeableConcept("unit", element.getUnit());
36791      }
36792      if (element.hasTerm()) {
36793        composeCodeableConcept("term", element.getTerm());
36794      }
36795      if (element.hasFinancial()) {
36796        openArray("financial");
36797        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
36798          composeExplanationOfBenefitBenefitComponent(null, e);
36799        closeArray();
36800      };
36801  }
36802
36803  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
36804    if (element != null) {
36805      open(name);
36806      composeExplanationOfBenefitBenefitComponentInner(element);
36807      close();
36808    }
36809  }
36810
36811  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
36812      composeBackbone(element);
36813      if (element.hasType()) {
36814        composeCodeableConcept("type", element.getType());
36815      }
36816      if (element.hasAllowed()) {
36817        composeType("allowed", element.getAllowed());
36818      }
36819      if (element.hasUsed()) {
36820        composeType("used", element.getUsed());
36821      }
36822  }
36823
36824  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
36825    if (element != null) {
36826      prop("resourceType", name);
36827      composeFamilyMemberHistoryInner(element);
36828    }
36829  }
36830
36831  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
36832      composeDomainResourceElements(element);
36833      if (element.hasIdentifier()) {
36834        openArray("identifier");
36835        for (Identifier e : element.getIdentifier()) 
36836          composeIdentifier(null, e);
36837        closeArray();
36838      };
36839      if (element.hasInstantiates()) {
36840        openArray("instantiates");
36841        for (UriType e : element.getInstantiates()) 
36842          composeUriCore(null, e, true);
36843        closeArray();
36844        if (anyHasExtras(element.getInstantiates())) {
36845          openArray("_instantiates");
36846          for (UriType e : element.getInstantiates()) 
36847            composeUriExtras(null, e, true);
36848          closeArray();
36849        }
36850      };
36851      if (element.hasStatusElement()) {
36852        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
36853        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
36854      }
36855      if (element.hasDataAbsentReason()) {
36856        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
36857      }
36858      if (element.hasPatient()) {
36859        composeReference("patient", element.getPatient());
36860      }
36861      if (element.hasDateElement()) {
36862        composeDateTimeCore("date", element.getDateElement(), false);
36863        composeDateTimeExtras("date", element.getDateElement(), false);
36864      }
36865      if (element.hasNameElement()) {
36866        composeStringCore("name", element.getNameElement(), false);
36867        composeStringExtras("name", element.getNameElement(), false);
36868      }
36869      if (element.hasRelationship()) {
36870        composeCodeableConcept("relationship", element.getRelationship());
36871      }
36872      if (element.hasGenderElement()) {
36873        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
36874        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
36875      }
36876      if (element.hasBorn()) {
36877        composeType("born", element.getBorn());
36878      }
36879      if (element.hasAge()) {
36880        composeType("age", element.getAge());
36881      }
36882      if (element.hasEstimatedAgeElement()) {
36883        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
36884        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
36885      }
36886      if (element.hasDeceased()) {
36887        composeType("deceased", element.getDeceased());
36888      }
36889      if (element.hasReasonCode()) {
36890        openArray("reasonCode");
36891        for (CodeableConcept e : element.getReasonCode()) 
36892          composeCodeableConcept(null, e);
36893        closeArray();
36894      };
36895      if (element.hasReasonReference()) {
36896        openArray("reasonReference");
36897        for (Reference e : element.getReasonReference()) 
36898          composeReference(null, e);
36899        closeArray();
36900      };
36901      if (element.hasNote()) {
36902        openArray("note");
36903        for (Annotation e : element.getNote()) 
36904          composeAnnotation(null, e);
36905        closeArray();
36906      };
36907      if (element.hasCondition()) {
36908        openArray("condition");
36909        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
36910          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
36911        closeArray();
36912      };
36913  }
36914
36915  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
36916    if (element != null) {
36917      open(name);
36918      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
36919      close();
36920    }
36921  }
36922
36923  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
36924      composeBackbone(element);
36925      if (element.hasCode()) {
36926        composeCodeableConcept("code", element.getCode());
36927      }
36928      if (element.hasOutcome()) {
36929        composeCodeableConcept("outcome", element.getOutcome());
36930      }
36931      if (element.hasOnset()) {
36932        composeType("onset", element.getOnset());
36933      }
36934      if (element.hasNote()) {
36935        openArray("note");
36936        for (Annotation e : element.getNote()) 
36937          composeAnnotation(null, e);
36938        closeArray();
36939      };
36940  }
36941
36942  protected void composeFlag(String name, Flag element) throws IOException {
36943    if (element != null) {
36944      prop("resourceType", name);
36945      composeFlagInner(element);
36946    }
36947  }
36948
36949  protected void composeFlagInner(Flag element) throws IOException {
36950      composeDomainResourceElements(element);
36951      if (element.hasIdentifier()) {
36952        openArray("identifier");
36953        for (Identifier e : element.getIdentifier()) 
36954          composeIdentifier(null, e);
36955        closeArray();
36956      };
36957      if (element.hasStatusElement()) {
36958        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
36959        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
36960      }
36961      if (element.hasCategory()) {
36962        openArray("category");
36963        for (CodeableConcept e : element.getCategory()) 
36964          composeCodeableConcept(null, e);
36965        closeArray();
36966      };
36967      if (element.hasCode()) {
36968        composeCodeableConcept("code", element.getCode());
36969      }
36970      if (element.hasSubject()) {
36971        composeReference("subject", element.getSubject());
36972      }
36973      if (element.hasPeriod()) {
36974        composePeriod("period", element.getPeriod());
36975      }
36976      if (element.hasEncounter()) {
36977        composeReference("encounter", element.getEncounter());
36978      }
36979      if (element.hasAuthor()) {
36980        composeReference("author", element.getAuthor());
36981      }
36982  }
36983
36984  protected void composeGoal(String name, Goal element) throws IOException {
36985    if (element != null) {
36986      prop("resourceType", name);
36987      composeGoalInner(element);
36988    }
36989  }
36990
36991  protected void composeGoalInner(Goal element) throws IOException {
36992      composeDomainResourceElements(element);
36993      if (element.hasIdentifier()) {
36994        openArray("identifier");
36995        for (Identifier e : element.getIdentifier()) 
36996          composeIdentifier(null, e);
36997        closeArray();
36998      };
36999      if (element.hasStatusElement()) {
37000        composeEnumerationCore("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
37001        composeEnumerationExtras("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
37002      }
37003      if (element.hasCategory()) {
37004        openArray("category");
37005        for (CodeableConcept e : element.getCategory()) 
37006          composeCodeableConcept(null, e);
37007        closeArray();
37008      };
37009      if (element.hasPriority()) {
37010        composeCodeableConcept("priority", element.getPriority());
37011      }
37012      if (element.hasDescription()) {
37013        composeCodeableConcept("description", element.getDescription());
37014      }
37015      if (element.hasSubject()) {
37016        composeReference("subject", element.getSubject());
37017      }
37018      if (element.hasStart()) {
37019        composeType("start", element.getStart());
37020      }
37021      if (element.hasTarget()) {
37022        composeGoalGoalTargetComponent("target", element.getTarget());
37023      }
37024      if (element.hasStatusDateElement()) {
37025        composeDateCore("statusDate", element.getStatusDateElement(), false);
37026        composeDateExtras("statusDate", element.getStatusDateElement(), false);
37027      }
37028      if (element.hasStatusReasonElement()) {
37029        composeStringCore("statusReason", element.getStatusReasonElement(), false);
37030        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
37031      }
37032      if (element.hasExpressedBy()) {
37033        composeReference("expressedBy", element.getExpressedBy());
37034      }
37035      if (element.hasAddresses()) {
37036        openArray("addresses");
37037        for (Reference e : element.getAddresses()) 
37038          composeReference(null, e);
37039        closeArray();
37040      };
37041      if (element.hasNote()) {
37042        openArray("note");
37043        for (Annotation e : element.getNote()) 
37044          composeAnnotation(null, e);
37045        closeArray();
37046      };
37047      if (element.hasOutcomeCode()) {
37048        openArray("outcomeCode");
37049        for (CodeableConcept e : element.getOutcomeCode()) 
37050          composeCodeableConcept(null, e);
37051        closeArray();
37052      };
37053      if (element.hasOutcomeReference()) {
37054        openArray("outcomeReference");
37055        for (Reference e : element.getOutcomeReference()) 
37056          composeReference(null, e);
37057        closeArray();
37058      };
37059  }
37060
37061  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
37062    if (element != null) {
37063      open(name);
37064      composeGoalGoalTargetComponentInner(element);
37065      close();
37066    }
37067  }
37068
37069  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
37070      composeBackbone(element);
37071      if (element.hasMeasure()) {
37072        composeCodeableConcept("measure", element.getMeasure());
37073      }
37074      if (element.hasDetail()) {
37075        composeType("detail", element.getDetail());
37076      }
37077      if (element.hasDue()) {
37078        composeType("due", element.getDue());
37079      }
37080  }
37081
37082  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
37083    if (element != null) {
37084      prop("resourceType", name);
37085      composeGraphDefinitionInner(element);
37086    }
37087  }
37088
37089  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
37090      composeDomainResourceElements(element);
37091      if (element.hasUrlElement()) {
37092        composeUriCore("url", element.getUrlElement(), false);
37093        composeUriExtras("url", element.getUrlElement(), false);
37094      }
37095      if (element.hasVersionElement()) {
37096        composeStringCore("version", element.getVersionElement(), false);
37097        composeStringExtras("version", element.getVersionElement(), false);
37098      }
37099      if (element.hasNameElement()) {
37100        composeStringCore("name", element.getNameElement(), false);
37101        composeStringExtras("name", element.getNameElement(), false);
37102      }
37103      if (element.hasStatusElement()) {
37104        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37105        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37106      }
37107      if (element.hasExperimentalElement()) {
37108        composeBooleanCore("experimental", element.getExperimentalElement(), false);
37109        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
37110      }
37111      if (element.hasDateElement()) {
37112        composeDateTimeCore("date", element.getDateElement(), false);
37113        composeDateTimeExtras("date", element.getDateElement(), false);
37114      }
37115      if (element.hasPublisherElement()) {
37116        composeStringCore("publisher", element.getPublisherElement(), false);
37117        composeStringExtras("publisher", element.getPublisherElement(), false);
37118      }
37119      if (element.hasContact()) {
37120        openArray("contact");
37121        for (ContactDetail e : element.getContact()) 
37122          composeContactDetail(null, e);
37123        closeArray();
37124      };
37125      if (element.hasDescriptionElement()) {
37126        composeMarkdownCore("description", element.getDescriptionElement(), false);
37127        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37128      }
37129      if (element.hasUseContext()) {
37130        openArray("useContext");
37131        for (UsageContext e : element.getUseContext()) 
37132          composeUsageContext(null, e);
37133        closeArray();
37134      };
37135      if (element.hasJurisdiction()) {
37136        openArray("jurisdiction");
37137        for (CodeableConcept e : element.getJurisdiction()) 
37138          composeCodeableConcept(null, e);
37139        closeArray();
37140      };
37141      if (element.hasPurposeElement()) {
37142        composeMarkdownCore("purpose", element.getPurposeElement(), false);
37143        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
37144      }
37145      if (element.hasStartElement()) {
37146        composeCodeCore("start", element.getStartElement(), false);
37147        composeCodeExtras("start", element.getStartElement(), false);
37148      }
37149      if (element.hasProfileElement()) {
37150        composeCanonicalCore("profile", element.getProfileElement(), false);
37151        composeCanonicalExtras("profile", element.getProfileElement(), false);
37152      }
37153      if (element.hasLink()) {
37154        openArray("link");
37155        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
37156          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
37157        closeArray();
37158      };
37159  }
37160
37161  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
37162    if (element != null) {
37163      open(name);
37164      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
37165      close();
37166    }
37167  }
37168
37169  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
37170      composeBackbone(element);
37171      if (element.hasPathElement()) {
37172        composeStringCore("path", element.getPathElement(), false);
37173        composeStringExtras("path", element.getPathElement(), false);
37174      }
37175      if (element.hasSliceNameElement()) {
37176        composeStringCore("sliceName", element.getSliceNameElement(), false);
37177        composeStringExtras("sliceName", element.getSliceNameElement(), false);
37178      }
37179      if (element.hasMinElement()) {
37180        composeIntegerCore("min", element.getMinElement(), false);
37181        composeIntegerExtras("min", element.getMinElement(), false);
37182      }
37183      if (element.hasMaxElement()) {
37184        composeStringCore("max", element.getMaxElement(), false);
37185        composeStringExtras("max", element.getMaxElement(), false);
37186      }
37187      if (element.hasDescriptionElement()) {
37188        composeStringCore("description", element.getDescriptionElement(), false);
37189        composeStringExtras("description", element.getDescriptionElement(), false);
37190      }
37191      if (element.hasTarget()) {
37192        openArray("target");
37193        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
37194          composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
37195        closeArray();
37196      };
37197  }
37198
37199  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
37200    if (element != null) {
37201      open(name);
37202      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
37203      close();
37204    }
37205  }
37206
37207  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
37208      composeBackbone(element);
37209      if (element.hasTypeElement()) {
37210        composeCodeCore("type", element.getTypeElement(), false);
37211        composeCodeExtras("type", element.getTypeElement(), false);
37212      }
37213      if (element.hasParamsElement()) {
37214        composeStringCore("params", element.getParamsElement(), false);
37215        composeStringExtras("params", element.getParamsElement(), false);
37216      }
37217      if (element.hasProfileElement()) {
37218        composeCanonicalCore("profile", element.getProfileElement(), false);
37219        composeCanonicalExtras("profile", element.getProfileElement(), false);
37220      }
37221      if (element.hasCompartment()) {
37222        openArray("compartment");
37223        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
37224          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
37225        closeArray();
37226      };
37227      if (element.hasLink()) {
37228        openArray("link");
37229        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
37230          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
37231        closeArray();
37232      };
37233  }
37234
37235  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
37236    if (element != null) {
37237      open(name);
37238      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
37239      close();
37240    }
37241  }
37242
37243  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
37244      composeBackbone(element);
37245      if (element.hasUseElement()) {
37246        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
37247        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
37248      }
37249      if (element.hasCodeElement()) {
37250        composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
37251        composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
37252      }
37253      if (element.hasRuleElement()) {
37254        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
37255        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
37256      }
37257      if (element.hasExpressionElement()) {
37258        composeStringCore("expression", element.getExpressionElement(), false);
37259        composeStringExtras("expression", element.getExpressionElement(), false);
37260      }
37261      if (element.hasDescriptionElement()) {
37262        composeStringCore("description", element.getDescriptionElement(), false);
37263        composeStringExtras("description", element.getDescriptionElement(), false);
37264      }
37265  }
37266
37267  protected void composeGroup(String name, Group element) throws IOException {
37268    if (element != null) {
37269      prop("resourceType", name);
37270      composeGroupInner(element);
37271    }
37272  }
37273
37274  protected void composeGroupInner(Group element) throws IOException {
37275      composeDomainResourceElements(element);
37276      if (element.hasIdentifier()) {
37277        openArray("identifier");
37278        for (Identifier e : element.getIdentifier()) 
37279          composeIdentifier(null, e);
37280        closeArray();
37281      };
37282      if (element.hasActiveElement()) {
37283        composeBooleanCore("active", element.getActiveElement(), false);
37284        composeBooleanExtras("active", element.getActiveElement(), false);
37285      }
37286      if (element.hasTypeElement()) {
37287        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
37288        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
37289      }
37290      if (element.hasActualElement()) {
37291        composeBooleanCore("actual", element.getActualElement(), false);
37292        composeBooleanExtras("actual", element.getActualElement(), false);
37293      }
37294      if (element.hasCode()) {
37295        composeCodeableConcept("code", element.getCode());
37296      }
37297      if (element.hasNameElement()) {
37298        composeStringCore("name", element.getNameElement(), false);
37299        composeStringExtras("name", element.getNameElement(), false);
37300      }
37301      if (element.hasQuantityElement()) {
37302        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
37303        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
37304      }
37305      if (element.hasCharacteristic()) {
37306        openArray("characteristic");
37307        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
37308          composeGroupGroupCharacteristicComponent(null, e);
37309        closeArray();
37310      };
37311      if (element.hasMember()) {
37312        openArray("member");
37313        for (Group.GroupMemberComponent e : element.getMember()) 
37314          composeGroupGroupMemberComponent(null, e);
37315        closeArray();
37316      };
37317  }
37318
37319  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
37320    if (element != null) {
37321      open(name);
37322      composeGroupGroupCharacteristicComponentInner(element);
37323      close();
37324    }
37325  }
37326
37327  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
37328      composeBackbone(element);
37329      if (element.hasCode()) {
37330        composeCodeableConcept("code", element.getCode());
37331      }
37332      if (element.hasValue()) {
37333        composeType("value", element.getValue());
37334      }
37335      if (element.hasExcludeElement()) {
37336        composeBooleanCore("exclude", element.getExcludeElement(), false);
37337        composeBooleanExtras("exclude", element.getExcludeElement(), false);
37338      }
37339      if (element.hasPeriod()) {
37340        composePeriod("period", element.getPeriod());
37341      }
37342  }
37343
37344  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
37345    if (element != null) {
37346      open(name);
37347      composeGroupGroupMemberComponentInner(element);
37348      close();
37349    }
37350  }
37351
37352  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
37353      composeBackbone(element);
37354      if (element.hasEntity()) {
37355        composeReference("entity", element.getEntity());
37356      }
37357      if (element.hasPeriod()) {
37358        composePeriod("period", element.getPeriod());
37359      }
37360      if (element.hasInactiveElement()) {
37361        composeBooleanCore("inactive", element.getInactiveElement(), false);
37362        composeBooleanExtras("inactive", element.getInactiveElement(), false);
37363      }
37364  }
37365
37366  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
37367    if (element != null) {
37368      prop("resourceType", name);
37369      composeGuidanceResponseInner(element);
37370    }
37371  }
37372
37373  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
37374      composeDomainResourceElements(element);
37375      if (element.hasRequestIdElement()) {
37376        composeIdCore("requestId", element.getRequestIdElement(), false);
37377        composeIdExtras("requestId", element.getRequestIdElement(), false);
37378      }
37379      if (element.hasIdentifier()) {
37380        openArray("identifier");
37381        for (Identifier e : element.getIdentifier()) 
37382          composeIdentifier(null, e);
37383        closeArray();
37384      };
37385      if (element.hasModule()) {
37386        composeType("module", element.getModule());
37387      }
37388      if (element.hasStatusElement()) {
37389        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
37390        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
37391      }
37392      if (element.hasSubject()) {
37393        composeReference("subject", element.getSubject());
37394      }
37395      if (element.hasContext()) {
37396        composeReference("context", element.getContext());
37397      }
37398      if (element.hasOccurrenceDateTimeElement()) {
37399        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
37400        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
37401      }
37402      if (element.hasPerformer()) {
37403        composeReference("performer", element.getPerformer());
37404      }
37405      if (element.hasReasonCode()) {
37406        openArray("reasonCode");
37407        for (CodeableConcept e : element.getReasonCode()) 
37408          composeCodeableConcept(null, e);
37409        closeArray();
37410      };
37411      if (element.hasReasonReference()) {
37412        openArray("reasonReference");
37413        for (Reference e : element.getReasonReference()) 
37414          composeReference(null, e);
37415        closeArray();
37416      };
37417      if (element.hasNote()) {
37418        openArray("note");
37419        for (Annotation e : element.getNote()) 
37420          composeAnnotation(null, e);
37421        closeArray();
37422      };
37423      if (element.hasEvaluationMessage()) {
37424        openArray("evaluationMessage");
37425        for (Reference e : element.getEvaluationMessage()) 
37426          composeReference(null, e);
37427        closeArray();
37428      };
37429      if (element.hasOutputParameters()) {
37430        composeReference("outputParameters", element.getOutputParameters());
37431      }
37432      if (element.hasResult()) {
37433        composeReference("result", element.getResult());
37434      }
37435      if (element.hasDataRequirement()) {
37436        openArray("dataRequirement");
37437        for (DataRequirement e : element.getDataRequirement()) 
37438          composeDataRequirement(null, e);
37439        closeArray();
37440      };
37441  }
37442
37443  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
37444    if (element != null) {
37445      prop("resourceType", name);
37446      composeHealthcareServiceInner(element);
37447    }
37448  }
37449
37450  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
37451      composeDomainResourceElements(element);
37452      if (element.hasIdentifier()) {
37453        openArray("identifier");
37454        for (Identifier e : element.getIdentifier()) 
37455          composeIdentifier(null, e);
37456        closeArray();
37457      };
37458      if (element.hasActiveElement()) {
37459        composeBooleanCore("active", element.getActiveElement(), false);
37460        composeBooleanExtras("active", element.getActiveElement(), false);
37461      }
37462      if (element.hasProvidedBy()) {
37463        composeReference("providedBy", element.getProvidedBy());
37464      }
37465      if (element.hasCategory()) {
37466        openArray("category");
37467        for (CodeableConcept e : element.getCategory()) 
37468          composeCodeableConcept(null, e);
37469        closeArray();
37470      };
37471      if (element.hasType()) {
37472        openArray("type");
37473        for (CodeableConcept e : element.getType()) 
37474          composeCodeableConcept(null, e);
37475        closeArray();
37476      };
37477      if (element.hasSpecialty()) {
37478        openArray("specialty");
37479        for (CodeableConcept e : element.getSpecialty()) 
37480          composeCodeableConcept(null, e);
37481        closeArray();
37482      };
37483      if (element.hasLocation()) {
37484        openArray("location");
37485        for (Reference e : element.getLocation()) 
37486          composeReference(null, e);
37487        closeArray();
37488      };
37489      if (element.hasNameElement()) {
37490        composeStringCore("name", element.getNameElement(), false);
37491        composeStringExtras("name", element.getNameElement(), false);
37492      }
37493      if (element.hasCommentElement()) {
37494        composeStringCore("comment", element.getCommentElement(), false);
37495        composeStringExtras("comment", element.getCommentElement(), false);
37496      }
37497      if (element.hasExtraDetailsElement()) {
37498        composeStringCore("extraDetails", element.getExtraDetailsElement(), false);
37499        composeStringExtras("extraDetails", element.getExtraDetailsElement(), false);
37500      }
37501      if (element.hasPhoto()) {
37502        composeAttachment("photo", element.getPhoto());
37503      }
37504      if (element.hasTelecom()) {
37505        openArray("telecom");
37506        for (ContactPoint e : element.getTelecom()) 
37507          composeContactPoint(null, e);
37508        closeArray();
37509      };
37510      if (element.hasCoverageArea()) {
37511        openArray("coverageArea");
37512        for (Reference e : element.getCoverageArea()) 
37513          composeReference(null, e);
37514        closeArray();
37515      };
37516      if (element.hasServiceProvisionCode()) {
37517        openArray("serviceProvisionCode");
37518        for (CodeableConcept e : element.getServiceProvisionCode()) 
37519          composeCodeableConcept(null, e);
37520        closeArray();
37521      };
37522      if (element.hasEligibility()) {
37523        composeCodeableConcept("eligibility", element.getEligibility());
37524      }
37525      if (element.hasEligibilityNoteElement()) {
37526        composeStringCore("eligibilityNote", element.getEligibilityNoteElement(), false);
37527        composeStringExtras("eligibilityNote", element.getEligibilityNoteElement(), false);
37528      }
37529      if (element.hasProgramName()) {
37530        openArray("programName");
37531        for (StringType e : element.getProgramName()) 
37532          composeStringCore(null, e, true);
37533        closeArray();
37534        if (anyHasExtras(element.getProgramName())) {
37535          openArray("_programName");
37536          for (StringType e : element.getProgramName()) 
37537            composeStringExtras(null, e, true);
37538          closeArray();
37539        }
37540      };
37541      if (element.hasCharacteristic()) {
37542        openArray("characteristic");
37543        for (CodeableConcept e : element.getCharacteristic()) 
37544          composeCodeableConcept(null, e);
37545        closeArray();
37546      };
37547      if (element.hasReferralMethod()) {
37548        openArray("referralMethod");
37549        for (CodeableConcept e : element.getReferralMethod()) 
37550          composeCodeableConcept(null, e);
37551        closeArray();
37552      };
37553      if (element.hasAppointmentRequiredElement()) {
37554        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
37555        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
37556      }
37557      if (element.hasAvailableTime()) {
37558        openArray("availableTime");
37559        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
37560          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
37561        closeArray();
37562      };
37563      if (element.hasNotAvailable()) {
37564        openArray("notAvailable");
37565        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
37566          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
37567        closeArray();
37568      };
37569      if (element.hasAvailabilityExceptionsElement()) {
37570        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
37571        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
37572      }
37573      if (element.hasEndpoint()) {
37574        openArray("endpoint");
37575        for (Reference e : element.getEndpoint()) 
37576          composeReference(null, e);
37577        closeArray();
37578      };
37579  }
37580
37581  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
37582    if (element != null) {
37583      open(name);
37584      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
37585      close();
37586    }
37587  }
37588
37589  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
37590      composeBackbone(element);
37591      if (element.hasDaysOfWeek()) {
37592        openArray("daysOfWeek");
37593        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
37594          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
37595        closeArray();
37596        if (anyHasExtras(element.getDaysOfWeek())) {
37597          openArray("_daysOfWeek");
37598          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
37599            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
37600          closeArray();
37601        }
37602      };
37603      if (element.hasAllDayElement()) {
37604        composeBooleanCore("allDay", element.getAllDayElement(), false);
37605        composeBooleanExtras("allDay", element.getAllDayElement(), false);
37606      }
37607      if (element.hasAvailableStartTimeElement()) {
37608        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
37609        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
37610      }
37611      if (element.hasAvailableEndTimeElement()) {
37612        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
37613        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
37614      }
37615  }
37616
37617  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
37618    if (element != null) {
37619      open(name);
37620      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
37621      close();
37622    }
37623  }
37624
37625  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
37626      composeBackbone(element);
37627      if (element.hasDescriptionElement()) {
37628        composeStringCore("description", element.getDescriptionElement(), false);
37629        composeStringExtras("description", element.getDescriptionElement(), false);
37630      }
37631      if (element.hasDuring()) {
37632        composePeriod("during", element.getDuring());
37633      }
37634  }
37635
37636  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
37637    if (element != null) {
37638      prop("resourceType", name);
37639      composeImagingStudyInner(element);
37640    }
37641  }
37642
37643  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
37644      composeDomainResourceElements(element);
37645      if (element.hasIdentifier()) {
37646        openArray("identifier");
37647        for (Identifier e : element.getIdentifier()) 
37648          composeIdentifier(null, e);
37649        closeArray();
37650      };
37651      if (element.hasStatusElement()) {
37652        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
37653        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
37654      }
37655      if (element.hasModality()) {
37656        openArray("modality");
37657        for (Coding e : element.getModality()) 
37658          composeCoding(null, e);
37659        closeArray();
37660      };
37661      if (element.hasSubject()) {
37662        composeReference("subject", element.getSubject());
37663      }
37664      if (element.hasContext()) {
37665        composeReference("context", element.getContext());
37666      }
37667      if (element.hasStartedElement()) {
37668        composeDateTimeCore("started", element.getStartedElement(), false);
37669        composeDateTimeExtras("started", element.getStartedElement(), false);
37670      }
37671      if (element.hasBasedOn()) {
37672        openArray("basedOn");
37673        for (Reference e : element.getBasedOn()) 
37674          composeReference(null, e);
37675        closeArray();
37676      };
37677      if (element.hasReferrer()) {
37678        composeReference("referrer", element.getReferrer());
37679      }
37680      if (element.hasInterpreter()) {
37681        openArray("interpreter");
37682        for (Reference e : element.getInterpreter()) 
37683          composeReference(null, e);
37684        closeArray();
37685      };
37686      if (element.hasEndpoint()) {
37687        openArray("endpoint");
37688        for (Reference e : element.getEndpoint()) 
37689          composeReference(null, e);
37690        closeArray();
37691      };
37692      if (element.hasNumberOfSeriesElement()) {
37693        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
37694        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
37695      }
37696      if (element.hasNumberOfInstancesElement()) {
37697        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
37698        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
37699      }
37700      if (element.hasProcedureReference()) {
37701        composeReference("procedureReference", element.getProcedureReference());
37702      }
37703      if (element.hasProcedureCode()) {
37704        openArray("procedureCode");
37705        for (CodeableConcept e : element.getProcedureCode()) 
37706          composeCodeableConcept(null, e);
37707        closeArray();
37708      };
37709      if (element.hasLocation()) {
37710        composeReference("location", element.getLocation());
37711      }
37712      if (element.hasReasonCode()) {
37713        openArray("reasonCode");
37714        for (CodeableConcept e : element.getReasonCode()) 
37715          composeCodeableConcept(null, e);
37716        closeArray();
37717      };
37718      if (element.hasReasonReference()) {
37719        openArray("reasonReference");
37720        for (Reference e : element.getReasonReference()) 
37721          composeReference(null, e);
37722        closeArray();
37723      };
37724      if (element.hasNote()) {
37725        openArray("note");
37726        for (Annotation e : element.getNote()) 
37727          composeAnnotation(null, e);
37728        closeArray();
37729      };
37730      if (element.hasSeries()) {
37731        openArray("series");
37732        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
37733          composeImagingStudyImagingStudySeriesComponent(null, e);
37734        closeArray();
37735      };
37736  }
37737
37738  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
37739    if (element != null) {
37740      open(name);
37741      composeImagingStudyImagingStudySeriesComponentInner(element);
37742      close();
37743    }
37744  }
37745
37746  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
37747      composeBackbone(element);
37748      if (element.hasIdentifier()) {
37749        composeIdentifier("identifier", element.getIdentifier());
37750      }
37751      if (element.hasNumberElement()) {
37752        composeUnsignedIntCore("number", element.getNumberElement(), false);
37753        composeUnsignedIntExtras("number", element.getNumberElement(), false);
37754      }
37755      if (element.hasModality()) {
37756        composeCoding("modality", element.getModality());
37757      }
37758      if (element.hasDescriptionElement()) {
37759        composeStringCore("description", element.getDescriptionElement(), false);
37760        composeStringExtras("description", element.getDescriptionElement(), false);
37761      }
37762      if (element.hasNumberOfInstancesElement()) {
37763        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
37764        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
37765      }
37766      if (element.hasEndpoint()) {
37767        openArray("endpoint");
37768        for (Reference e : element.getEndpoint()) 
37769          composeReference(null, e);
37770        closeArray();
37771      };
37772      if (element.hasBodySite()) {
37773        composeCoding("bodySite", element.getBodySite());
37774      }
37775      if (element.hasLaterality()) {
37776        composeCoding("laterality", element.getLaterality());
37777      }
37778      if (element.hasSpecimen()) {
37779        openArray("specimen");
37780        for (Reference e : element.getSpecimen()) 
37781          composeReference(null, e);
37782        closeArray();
37783      };
37784      if (element.hasStartedElement()) {
37785        composeDateTimeCore("started", element.getStartedElement(), false);
37786        composeDateTimeExtras("started", element.getStartedElement(), false);
37787      }
37788      if (element.hasPerformer()) {
37789        openArray("performer");
37790        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
37791          composeImagingStudyImagingStudySeriesPerformerComponent(null, e);
37792        closeArray();
37793      };
37794      if (element.hasInstance()) {
37795        openArray("instance");
37796        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
37797          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
37798        closeArray();
37799      };
37800  }
37801
37802  protected void composeImagingStudyImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
37803    if (element != null) {
37804      open(name);
37805      composeImagingStudyImagingStudySeriesPerformerComponentInner(element);
37806      close();
37807    }
37808  }
37809
37810  protected void composeImagingStudyImagingStudySeriesPerformerComponentInner(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
37811      composeBackbone(element);
37812      if (element.hasFunction()) {
37813        composeCodeableConcept("function", element.getFunction());
37814      }
37815      if (element.hasActor()) {
37816        composeReference("actor", element.getActor());
37817      }
37818  }
37819
37820  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
37821    if (element != null) {
37822      open(name);
37823      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
37824      close();
37825    }
37826  }
37827
37828  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
37829      composeBackbone(element);
37830      if (element.hasIdentifier()) {
37831        composeIdentifier("identifier", element.getIdentifier());
37832      }
37833      if (element.hasNumberElement()) {
37834        composeUnsignedIntCore("number", element.getNumberElement(), false);
37835        composeUnsignedIntExtras("number", element.getNumberElement(), false);
37836      }
37837      if (element.hasSopClass()) {
37838        composeCoding("sopClass", element.getSopClass());
37839      }
37840      if (element.hasTitleElement()) {
37841        composeStringCore("title", element.getTitleElement(), false);
37842        composeStringExtras("title", element.getTitleElement(), false);
37843      }
37844  }
37845
37846  protected void composeImmunization(String name, Immunization element) throws IOException {
37847    if (element != null) {
37848      prop("resourceType", name);
37849      composeImmunizationInner(element);
37850    }
37851  }
37852
37853  protected void composeImmunizationInner(Immunization element) throws IOException {
37854      composeDomainResourceElements(element);
37855      if (element.hasIdentifier()) {
37856        openArray("identifier");
37857        for (Identifier e : element.getIdentifier()) 
37858          composeIdentifier(null, e);
37859        closeArray();
37860      };
37861      if (element.hasStatusElement()) {
37862        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
37863        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
37864      }
37865      if (element.hasStatusReason()) {
37866        composeCodeableConcept("statusReason", element.getStatusReason());
37867      }
37868      if (element.hasVaccineCode()) {
37869        composeCodeableConcept("vaccineCode", element.getVaccineCode());
37870      }
37871      if (element.hasPatient()) {
37872        composeReference("patient", element.getPatient());
37873      }
37874      if (element.hasEncounter()) {
37875        composeReference("encounter", element.getEncounter());
37876      }
37877      if (element.hasDateElement()) {
37878        composeDateTimeCore("date", element.getDateElement(), false);
37879        composeDateTimeExtras("date", element.getDateElement(), false);
37880      }
37881      if (element.hasPrimarySourceElement()) {
37882        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
37883        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
37884      }
37885      if (element.hasReportOrigin()) {
37886        composeCodeableConcept("reportOrigin", element.getReportOrigin());
37887      }
37888      if (element.hasLocation()) {
37889        composeReference("location", element.getLocation());
37890      }
37891      if (element.hasManufacturer()) {
37892        composeReference("manufacturer", element.getManufacturer());
37893      }
37894      if (element.hasLotNumberElement()) {
37895        composeStringCore("lotNumber", element.getLotNumberElement(), false);
37896        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
37897      }
37898      if (element.hasExpirationDateElement()) {
37899        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
37900        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
37901      }
37902      if (element.hasSite()) {
37903        composeCodeableConcept("site", element.getSite());
37904      }
37905      if (element.hasRoute()) {
37906        composeCodeableConcept("route", element.getRoute());
37907      }
37908      if (element.hasDoseQuantity()) {
37909        composeSimpleQuantity("doseQuantity", element.getDoseQuantity());
37910      }
37911      if (element.hasPerformer()) {
37912        openArray("performer");
37913        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
37914          composeImmunizationImmunizationPerformerComponent(null, e);
37915        closeArray();
37916      };
37917      if (element.hasNote()) {
37918        openArray("note");
37919        for (Annotation e : element.getNote()) 
37920          composeAnnotation(null, e);
37921        closeArray();
37922      };
37923      if (element.hasReasonCode()) {
37924        openArray("reasonCode");
37925        for (CodeableConcept e : element.getReasonCode()) 
37926          composeCodeableConcept(null, e);
37927        closeArray();
37928      };
37929      if (element.hasReasonReference()) {
37930        openArray("reasonReference");
37931        for (Reference e : element.getReasonReference()) 
37932          composeReference(null, e);
37933        closeArray();
37934      };
37935      if (element.hasIsPotentElement()) {
37936        composeBooleanCore("isPotent", element.getIsPotentElement(), false);
37937        composeBooleanExtras("isPotent", element.getIsPotentElement(), false);
37938      }
37939      if (element.hasSubpotentReason()) {
37940        openArray("subpotentReason");
37941        for (CodeableConcept e : element.getSubpotentReason()) 
37942          composeCodeableConcept(null, e);
37943        closeArray();
37944      };
37945      if (element.hasEducation()) {
37946        openArray("education");
37947        for (Immunization.ImmunizationEducationComponent e : element.getEducation()) 
37948          composeImmunizationImmunizationEducationComponent(null, e);
37949        closeArray();
37950      };
37951      if (element.hasProgramEligibility()) {
37952        openArray("programEligibility");
37953        for (CodeableConcept e : element.getProgramEligibility()) 
37954          composeCodeableConcept(null, e);
37955        closeArray();
37956      };
37957      if (element.hasFundingSource()) {
37958        composeCodeableConcept("fundingSource", element.getFundingSource());
37959      }
37960  }
37961
37962  protected void composeImmunizationImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
37963    if (element != null) {
37964      open(name);
37965      composeImmunizationImmunizationPerformerComponentInner(element);
37966      close();
37967    }
37968  }
37969
37970  protected void composeImmunizationImmunizationPerformerComponentInner(Immunization.ImmunizationPerformerComponent element) throws IOException {
37971      composeBackbone(element);
37972      if (element.hasFunction()) {
37973        composeCodeableConcept("function", element.getFunction());
37974      }
37975      if (element.hasActor()) {
37976        composeReference("actor", element.getActor());
37977      }
37978  }
37979
37980  protected void composeImmunizationImmunizationEducationComponent(String name, Immunization.ImmunizationEducationComponent element) throws IOException {
37981    if (element != null) {
37982      open(name);
37983      composeImmunizationImmunizationEducationComponentInner(element);
37984      close();
37985    }
37986  }
37987
37988  protected void composeImmunizationImmunizationEducationComponentInner(Immunization.ImmunizationEducationComponent element) throws IOException {
37989      composeBackbone(element);
37990      if (element.hasDocumentTypeElement()) {
37991        composeStringCore("documentType", element.getDocumentTypeElement(), false);
37992        composeStringExtras("documentType", element.getDocumentTypeElement(), false);
37993      }
37994      if (element.hasReferenceElement()) {
37995        composeUriCore("reference", element.getReferenceElement(), false);
37996        composeUriExtras("reference", element.getReferenceElement(), false);
37997      }
37998      if (element.hasPublicationDateElement()) {
37999        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
38000        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
38001      }
38002      if (element.hasPresentationDateElement()) {
38003        composeDateTimeCore("presentationDate", element.getPresentationDateElement(), false);
38004        composeDateTimeExtras("presentationDate", element.getPresentationDateElement(), false);
38005      }
38006  }
38007
38008  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
38009    if (element != null) {
38010      prop("resourceType", name);
38011      composeImmunizationEvaluationInner(element);
38012    }
38013  }
38014
38015  protected void composeImmunizationEvaluationInner(ImmunizationEvaluation element) throws IOException {
38016      composeDomainResourceElements(element);
38017      if (element.hasIdentifier()) {
38018        openArray("identifier");
38019        for (Identifier e : element.getIdentifier()) 
38020          composeIdentifier(null, e);
38021        closeArray();
38022      };
38023      if (element.hasStatusElement()) {
38024        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
38025        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
38026      }
38027      if (element.hasPatient()) {
38028        composeReference("patient", element.getPatient());
38029      }
38030      if (element.hasDateElement()) {
38031        composeDateTimeCore("date", element.getDateElement(), false);
38032        composeDateTimeExtras("date", element.getDateElement(), false);
38033      }
38034      if (element.hasAuthority()) {
38035        composeReference("authority", element.getAuthority());
38036      }
38037      if (element.hasTargetDisease()) {
38038        openArray("targetDisease");
38039        for (CodeableConcept e : element.getTargetDisease()) 
38040          composeCodeableConcept(null, e);
38041        closeArray();
38042      };
38043      if (element.hasImmunizationEvent()) {
38044        composeReference("immunizationEvent", element.getImmunizationEvent());
38045      }
38046      if (element.hasDoseStatus()) {
38047        composeCodeableConcept("doseStatus", element.getDoseStatus());
38048      }
38049      if (element.hasDoseStatusReason()) {
38050        openArray("doseStatusReason");
38051        for (CodeableConcept e : element.getDoseStatusReason()) 
38052          composeCodeableConcept(null, e);
38053        closeArray();
38054      };
38055      if (element.hasDescriptionElement()) {
38056        composeStringCore("description", element.getDescriptionElement(), false);
38057        composeStringExtras("description", element.getDescriptionElement(), false);
38058      }
38059      if (element.hasSeriesElement()) {
38060        composeStringCore("series", element.getSeriesElement(), false);
38061        composeStringExtras("series", element.getSeriesElement(), false);
38062      }
38063      if (element.hasDoseNumber()) {
38064        composeType("doseNumber", element.getDoseNumber());
38065      }
38066      if (element.hasSeriesDoses()) {
38067        composeType("seriesDoses", element.getSeriesDoses());
38068      }
38069  }
38070
38071  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
38072    if (element != null) {
38073      prop("resourceType", name);
38074      composeImmunizationRecommendationInner(element);
38075    }
38076  }
38077
38078  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
38079      composeDomainResourceElements(element);
38080      if (element.hasIdentifier()) {
38081        openArray("identifier");
38082        for (Identifier e : element.getIdentifier()) 
38083          composeIdentifier(null, e);
38084        closeArray();
38085      };
38086      if (element.hasPatient()) {
38087        composeReference("patient", element.getPatient());
38088      }
38089      if (element.hasDateElement()) {
38090        composeDateTimeCore("date", element.getDateElement(), false);
38091        composeDateTimeExtras("date", element.getDateElement(), false);
38092      }
38093      if (element.hasAuthority()) {
38094        composeReference("authority", element.getAuthority());
38095      }
38096      if (element.hasRecommendation()) {
38097        openArray("recommendation");
38098        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
38099          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
38100        closeArray();
38101      };
38102  }
38103
38104  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
38105    if (element != null) {
38106      open(name);
38107      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
38108      close();
38109    }
38110  }
38111
38112  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
38113      composeBackbone(element);
38114      if (element.hasVaccineCode()) {
38115        openArray("vaccineCode");
38116        for (CodeableConcept e : element.getVaccineCode()) 
38117          composeCodeableConcept(null, e);
38118        closeArray();
38119      };
38120      if (element.hasTargetDisease()) {
38121        composeCodeableConcept("targetDisease", element.getTargetDisease());
38122      }
38123      if (element.hasContraindicatedVaccineCode()) {
38124        openArray("contraindicatedVaccineCode");
38125        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
38126          composeCodeableConcept(null, e);
38127        closeArray();
38128      };
38129      if (element.hasForecastStatus()) {
38130        composeCodeableConcept("forecastStatus", element.getForecastStatus());
38131      }
38132      if (element.hasForecastReason()) {
38133        openArray("forecastReason");
38134        for (CodeableConcept e : element.getForecastReason()) 
38135          composeCodeableConcept(null, e);
38136        closeArray();
38137      };
38138      if (element.hasDateCriterion()) {
38139        openArray("dateCriterion");
38140        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
38141          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
38142        closeArray();
38143      };
38144      if (element.hasDescriptionElement()) {
38145        composeStringCore("description", element.getDescriptionElement(), false);
38146        composeStringExtras("description", element.getDescriptionElement(), false);
38147      }
38148      if (element.hasSeriesElement()) {
38149        composeStringCore("series", element.getSeriesElement(), false);
38150        composeStringExtras("series", element.getSeriesElement(), false);
38151      }
38152      if (element.hasDoseNumber()) {
38153        composeType("doseNumber", element.getDoseNumber());
38154      }
38155      if (element.hasSeriesDoses()) {
38156        composeType("seriesDoses", element.getSeriesDoses());
38157      }
38158      if (element.hasSupportingImmunization()) {
38159        openArray("supportingImmunization");
38160        for (Reference e : element.getSupportingImmunization()) 
38161          composeReference(null, e);
38162        closeArray();
38163      };
38164      if (element.hasSupportingPatientInformation()) {
38165        openArray("supportingPatientInformation");
38166        for (Reference e : element.getSupportingPatientInformation()) 
38167          composeReference(null, e);
38168        closeArray();
38169      };
38170  }
38171
38172  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
38173    if (element != null) {
38174      open(name);
38175      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
38176      close();
38177    }
38178  }
38179
38180  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
38181      composeBackbone(element);
38182      if (element.hasCode()) {
38183        composeCodeableConcept("code", element.getCode());
38184      }
38185      if (element.hasValueElement()) {
38186        composeDateTimeCore("value", element.getValueElement(), false);
38187        composeDateTimeExtras("value", element.getValueElement(), false);
38188      }
38189  }
38190
38191  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
38192    if (element != null) {
38193      prop("resourceType", name);
38194      composeImplementationGuideInner(element);
38195    }
38196  }
38197
38198  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
38199      composeDomainResourceElements(element);
38200      if (element.hasUrlElement()) {
38201        composeUriCore("url", element.getUrlElement(), false);
38202        composeUriExtras("url", element.getUrlElement(), false);
38203      }
38204      if (element.hasVersionElement()) {
38205        composeStringCore("version", element.getVersionElement(), false);
38206        composeStringExtras("version", element.getVersionElement(), false);
38207      }
38208      if (element.hasNameElement()) {
38209        composeStringCore("name", element.getNameElement(), false);
38210        composeStringExtras("name", element.getNameElement(), false);
38211      }
38212      if (element.hasStatusElement()) {
38213        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38214        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38215      }
38216      if (element.hasExperimentalElement()) {
38217        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38218        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38219      }
38220      if (element.hasDateElement()) {
38221        composeDateTimeCore("date", element.getDateElement(), false);
38222        composeDateTimeExtras("date", element.getDateElement(), false);
38223      }
38224      if (element.hasPublisherElement()) {
38225        composeStringCore("publisher", element.getPublisherElement(), false);
38226        composeStringExtras("publisher", element.getPublisherElement(), false);
38227      }
38228      if (element.hasContact()) {
38229        openArray("contact");
38230        for (ContactDetail e : element.getContact()) 
38231          composeContactDetail(null, e);
38232        closeArray();
38233      };
38234      if (element.hasDescriptionElement()) {
38235        composeMarkdownCore("description", element.getDescriptionElement(), false);
38236        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38237      }
38238      if (element.hasUseContext()) {
38239        openArray("useContext");
38240        for (UsageContext e : element.getUseContext()) 
38241          composeUsageContext(null, e);
38242        closeArray();
38243      };
38244      if (element.hasJurisdiction()) {
38245        openArray("jurisdiction");
38246        for (CodeableConcept e : element.getJurisdiction()) 
38247          composeCodeableConcept(null, e);
38248        closeArray();
38249      };
38250      if (element.hasCopyrightElement()) {
38251        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
38252        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
38253      }
38254      if (element.hasFhirVersionElement()) {
38255        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
38256        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
38257      }
38258      if (element.hasDependsOn()) {
38259        openArray("dependsOn");
38260        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
38261          composeImplementationGuideImplementationGuideDependsOnComponent(null, e);
38262        closeArray();
38263      };
38264      if (element.hasGlobal()) {
38265        openArray("global");
38266        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
38267          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
38268        closeArray();
38269      };
38270      if (element.hasDefinition()) {
38271        composeImplementationGuideImplementationGuideDefinitionComponent("definition", element.getDefinition());
38272      }
38273      if (element.hasManifest()) {
38274        composeImplementationGuideImplementationGuideManifestComponent("manifest", element.getManifest());
38275      }
38276  }
38277
38278  protected void composeImplementationGuideImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
38279    if (element != null) {
38280      open(name);
38281      composeImplementationGuideImplementationGuideDependsOnComponentInner(element);
38282      close();
38283    }
38284  }
38285
38286  protected void composeImplementationGuideImplementationGuideDependsOnComponentInner(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
38287      composeBackbone(element);
38288      if (element.hasUriElement()) {
38289        composeCanonicalCore("uri", element.getUriElement(), false);
38290        composeCanonicalExtras("uri", element.getUriElement(), false);
38291      }
38292      if (element.hasVersionElement()) {
38293        composeStringCore("version", element.getVersionElement(), false);
38294        composeStringExtras("version", element.getVersionElement(), false);
38295      }
38296  }
38297
38298  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
38299    if (element != null) {
38300      open(name);
38301      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
38302      close();
38303    }
38304  }
38305
38306  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
38307      composeBackbone(element);
38308      if (element.hasTypeElement()) {
38309        composeCodeCore("type", element.getTypeElement(), false);
38310        composeCodeExtras("type", element.getTypeElement(), false);
38311      }
38312      if (element.hasProfileElement()) {
38313        composeCanonicalCore("profile", element.getProfileElement(), false);
38314        composeCanonicalExtras("profile", element.getProfileElement(), false);
38315      }
38316  }
38317
38318  protected void composeImplementationGuideImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
38319    if (element != null) {
38320      open(name);
38321      composeImplementationGuideImplementationGuideDefinitionComponentInner(element);
38322      close();
38323    }
38324  }
38325
38326  protected void composeImplementationGuideImplementationGuideDefinitionComponentInner(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
38327      composeBackbone(element);
38328      if (element.hasPackage()) {
38329        openArray("package");
38330        for (ImplementationGuide.ImplementationGuideDefinitionPackageComponent e : element.getPackage()) 
38331          composeImplementationGuideImplementationGuideDefinitionPackageComponent(null, e);
38332        closeArray();
38333      };
38334      if (element.hasResource()) {
38335        openArray("resource");
38336        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
38337          composeImplementationGuideImplementationGuideDefinitionResourceComponent(null, e);
38338        closeArray();
38339      };
38340      if (element.hasPage()) {
38341        composeImplementationGuideImplementationGuideDefinitionPageComponent("page", element.getPage());
38342      }
38343      if (element.hasParameter()) {
38344        openArray("parameter");
38345        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
38346          composeImplementationGuideImplementationGuideDefinitionParameterComponent(null, e);
38347        closeArray();
38348      };
38349      if (element.hasTemplate()) {
38350        openArray("template");
38351        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
38352          composeImplementationGuideImplementationGuideDefinitionTemplateComponent(null, e);
38353        closeArray();
38354      };
38355  }
38356
38357  protected void composeImplementationGuideImplementationGuideDefinitionPackageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPackageComponent element) throws IOException {
38358    if (element != null) {
38359      open(name);
38360      composeImplementationGuideImplementationGuideDefinitionPackageComponentInner(element);
38361      close();
38362    }
38363  }
38364
38365  protected void composeImplementationGuideImplementationGuideDefinitionPackageComponentInner(ImplementationGuide.ImplementationGuideDefinitionPackageComponent element) throws IOException {
38366      composeBackbone(element);
38367      if (element.hasNameElement()) {
38368        composeStringCore("name", element.getNameElement(), false);
38369        composeStringExtras("name", element.getNameElement(), false);
38370      }
38371      if (element.hasDescriptionElement()) {
38372        composeStringCore("description", element.getDescriptionElement(), false);
38373        composeStringExtras("description", element.getDescriptionElement(), false);
38374      }
38375  }
38376
38377  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
38378    if (element != null) {
38379      open(name);
38380      composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(element);
38381      close();
38382    }
38383  }
38384
38385  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
38386      composeBackbone(element);
38387      if (element.hasReference()) {
38388        composeReference("reference", element.getReference());
38389      }
38390      if (element.hasNameElement()) {
38391        composeStringCore("name", element.getNameElement(), false);
38392        composeStringExtras("name", element.getNameElement(), false);
38393      }
38394      if (element.hasDescriptionElement()) {
38395        composeStringCore("description", element.getDescriptionElement(), false);
38396        composeStringExtras("description", element.getDescriptionElement(), false);
38397      }
38398      if (element.hasExample()) {
38399        composeType("example", element.getExample());
38400      }
38401      if (element.hasPackageElement()) {
38402        composeIdCore("package", element.getPackageElement(), false);
38403        composeIdExtras("package", element.getPackageElement(), false);
38404      }
38405  }
38406
38407  protected void composeImplementationGuideImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
38408    if (element != null) {
38409      open(name);
38410      composeImplementationGuideImplementationGuideDefinitionPageComponentInner(element);
38411      close();
38412    }
38413  }
38414
38415  protected void composeImplementationGuideImplementationGuideDefinitionPageComponentInner(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
38416      composeBackbone(element);
38417      if (element.hasName()) {
38418        composeType("name", element.getName());
38419      }
38420      if (element.hasTitleElement()) {
38421        composeStringCore("title", element.getTitleElement(), false);
38422        composeStringExtras("title", element.getTitleElement(), false);
38423      }
38424      if (element.hasGenerationElement()) {
38425        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
38426        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
38427      }
38428      if (element.hasPage()) {
38429        openArray("page");
38430        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
38431          composeImplementationGuideImplementationGuideDefinitionPageComponent(null, e);
38432        closeArray();
38433      };
38434  }
38435
38436  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
38437    if (element != null) {
38438      open(name);
38439      composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(element);
38440      close();
38441    }
38442  }
38443
38444  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
38445      composeBackbone(element);
38446      if (element.hasCodeElement()) {
38447        composeEnumerationCore("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false);
38448        composeEnumerationExtras("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false);
38449      }
38450      if (element.hasValueElement()) {
38451        composeStringCore("value", element.getValueElement(), false);
38452        composeStringExtras("value", element.getValueElement(), false);
38453      }
38454  }
38455
38456  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
38457    if (element != null) {
38458      open(name);
38459      composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(element);
38460      close();
38461    }
38462  }
38463
38464  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
38465      composeBackbone(element);
38466      if (element.hasCodeElement()) {
38467        composeCodeCore("code", element.getCodeElement(), false);
38468        composeCodeExtras("code", element.getCodeElement(), false);
38469      }
38470      if (element.hasSourceElement()) {
38471        composeStringCore("source", element.getSourceElement(), false);
38472        composeStringExtras("source", element.getSourceElement(), false);
38473      }
38474      if (element.hasScopeElement()) {
38475        composeStringCore("scope", element.getScopeElement(), false);
38476        composeStringExtras("scope", element.getScopeElement(), false);
38477      }
38478  }
38479
38480  protected void composeImplementationGuideImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
38481    if (element != null) {
38482      open(name);
38483      composeImplementationGuideImplementationGuideManifestComponentInner(element);
38484      close();
38485    }
38486  }
38487
38488  protected void composeImplementationGuideImplementationGuideManifestComponentInner(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
38489      composeBackbone(element);
38490      if (element.hasRenderingElement()) {
38491        composeUrlCore("rendering", element.getRenderingElement(), false);
38492        composeUrlExtras("rendering", element.getRenderingElement(), false);
38493      }
38494      if (element.hasResource()) {
38495        openArray("resource");
38496        for (ImplementationGuide.ImplementationGuideManifestResourceComponent e : element.getResource()) 
38497          composeImplementationGuideImplementationGuideManifestResourceComponent(null, e);
38498        closeArray();
38499      };
38500      if (element.hasPage()) {
38501        openArray("page");
38502        for (ImplementationGuide.ImplementationGuideManifestPageComponent e : element.getPage()) 
38503          composeImplementationGuideImplementationGuideManifestPageComponent(null, e);
38504        closeArray();
38505      };
38506      if (element.hasImage()) {
38507        openArray("image");
38508        for (StringType e : element.getImage()) 
38509          composeStringCore(null, e, true);
38510        closeArray();
38511        if (anyHasExtras(element.getImage())) {
38512          openArray("_image");
38513          for (StringType e : element.getImage()) 
38514            composeStringExtras(null, e, true);
38515          closeArray();
38516        }
38517      };
38518      if (element.hasOther()) {
38519        openArray("other");
38520        for (StringType e : element.getOther()) 
38521          composeStringCore(null, e, true);
38522        closeArray();
38523        if (anyHasExtras(element.getOther())) {
38524          openArray("_other");
38525          for (StringType e : element.getOther()) 
38526            composeStringExtras(null, e, true);
38527          closeArray();
38528        }
38529      };
38530  }
38531
38532  protected void composeImplementationGuideImplementationGuideManifestResourceComponent(String name, ImplementationGuide.ImplementationGuideManifestResourceComponent element) throws IOException {
38533    if (element != null) {
38534      open(name);
38535      composeImplementationGuideImplementationGuideManifestResourceComponentInner(element);
38536      close();
38537    }
38538  }
38539
38540  protected void composeImplementationGuideImplementationGuideManifestResourceComponentInner(ImplementationGuide.ImplementationGuideManifestResourceComponent element) throws IOException {
38541      composeBackbone(element);
38542      if (element.hasReference()) {
38543        composeReference("reference", element.getReference());
38544      }
38545      if (element.hasExample()) {
38546        composeType("example", element.getExample());
38547      }
38548      if (element.hasRelativePathElement()) {
38549        composeUrlCore("relativePath", element.getRelativePathElement(), false);
38550        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
38551      }
38552  }
38553
38554  protected void composeImplementationGuideImplementationGuideManifestPageComponent(String name, ImplementationGuide.ImplementationGuideManifestPageComponent element) throws IOException {
38555    if (element != null) {
38556      open(name);
38557      composeImplementationGuideImplementationGuideManifestPageComponentInner(element);
38558      close();
38559    }
38560  }
38561
38562  protected void composeImplementationGuideImplementationGuideManifestPageComponentInner(ImplementationGuide.ImplementationGuideManifestPageComponent element) throws IOException {
38563      composeBackbone(element);
38564      if (element.hasNameElement()) {
38565        composeStringCore("name", element.getNameElement(), false);
38566        composeStringExtras("name", element.getNameElement(), false);
38567      }
38568      if (element.hasTitleElement()) {
38569        composeStringCore("title", element.getTitleElement(), false);
38570        composeStringExtras("title", element.getTitleElement(), false);
38571      }
38572      if (element.hasAnchor()) {
38573        openArray("anchor");
38574        for (StringType e : element.getAnchor()) 
38575          composeStringCore(null, e, true);
38576        closeArray();
38577        if (anyHasExtras(element.getAnchor())) {
38578          openArray("_anchor");
38579          for (StringType e : element.getAnchor()) 
38580            composeStringExtras(null, e, true);
38581          closeArray();
38582        }
38583      };
38584  }
38585
38586  protected void composeInvoice(String name, Invoice element) throws IOException {
38587    if (element != null) {
38588      prop("resourceType", name);
38589      composeInvoiceInner(element);
38590    }
38591  }
38592
38593  protected void composeInvoiceInner(Invoice element) throws IOException {
38594      composeDomainResourceElements(element);
38595      if (element.hasIdentifier()) {
38596        openArray("identifier");
38597        for (Identifier e : element.getIdentifier()) 
38598          composeIdentifier(null, e);
38599        closeArray();
38600      };
38601      if (element.hasStatusElement()) {
38602        composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
38603        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
38604      }
38605      if (element.hasCancelledReasonElement()) {
38606        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
38607        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
38608      }
38609      if (element.hasType()) {
38610        composeCodeableConcept("type", element.getType());
38611      }
38612      if (element.hasSubject()) {
38613        composeReference("subject", element.getSubject());
38614      }
38615      if (element.hasRecipient()) {
38616        composeReference("recipient", element.getRecipient());
38617      }
38618      if (element.hasDateElement()) {
38619        composeDateTimeCore("date", element.getDateElement(), false);
38620        composeDateTimeExtras("date", element.getDateElement(), false);
38621      }
38622      if (element.hasParticipant()) {
38623        openArray("participant");
38624        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
38625          composeInvoiceInvoiceParticipantComponent(null, e);
38626        closeArray();
38627      };
38628      if (element.hasIssuer()) {
38629        composeReference("issuer", element.getIssuer());
38630      }
38631      if (element.hasAccount()) {
38632        composeReference("account", element.getAccount());
38633      }
38634      if (element.hasLineItem()) {
38635        openArray("lineItem");
38636        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
38637          composeInvoiceInvoiceLineItemComponent(null, e);
38638        closeArray();
38639      };
38640      if (element.hasTotalPriceComponent()) {
38641        openArray("totalPriceComponent");
38642        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent()) 
38643          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
38644        closeArray();
38645      };
38646      if (element.hasTotalNet()) {
38647        composeMoney("totalNet", element.getTotalNet());
38648      }
38649      if (element.hasTotalGross()) {
38650        composeMoney("totalGross", element.getTotalGross());
38651      }
38652      if (element.hasPaymentTermsElement()) {
38653        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
38654        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
38655      }
38656      if (element.hasNote()) {
38657        openArray("note");
38658        for (Annotation e : element.getNote()) 
38659          composeAnnotation(null, e);
38660        closeArray();
38661      };
38662  }
38663
38664  protected void composeInvoiceInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
38665    if (element != null) {
38666      open(name);
38667      composeInvoiceInvoiceParticipantComponentInner(element);
38668      close();
38669    }
38670  }
38671
38672  protected void composeInvoiceInvoiceParticipantComponentInner(Invoice.InvoiceParticipantComponent element) throws IOException {
38673      composeBackbone(element);
38674      if (element.hasRole()) {
38675        composeCodeableConcept("role", element.getRole());
38676      }
38677      if (element.hasActor()) {
38678        composeReference("actor", element.getActor());
38679      }
38680  }
38681
38682  protected void composeInvoiceInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
38683    if (element != null) {
38684      open(name);
38685      composeInvoiceInvoiceLineItemComponentInner(element);
38686      close();
38687    }
38688  }
38689
38690  protected void composeInvoiceInvoiceLineItemComponentInner(Invoice.InvoiceLineItemComponent element) throws IOException {
38691      composeBackbone(element);
38692      if (element.hasSequenceElement()) {
38693        composePositiveIntCore("sequence", element.getSequenceElement(), false);
38694        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
38695      }
38696      if (element.hasChargeItem()) {
38697        composeReference("chargeItem", element.getChargeItem());
38698      }
38699      if (element.hasPriceComponent()) {
38700        openArray("priceComponent");
38701        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent()) 
38702          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
38703        closeArray();
38704      };
38705  }
38706
38707  protected void composeInvoiceInvoiceLineItemPriceComponentComponent(String name, Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
38708    if (element != null) {
38709      open(name);
38710      composeInvoiceInvoiceLineItemPriceComponentComponentInner(element);
38711      close();
38712    }
38713  }
38714
38715  protected void composeInvoiceInvoiceLineItemPriceComponentComponentInner(Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
38716      composeBackbone(element);
38717      if (element.hasTypeElement()) {
38718        composeEnumerationCore("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
38719        composeEnumerationExtras("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
38720      }
38721      if (element.hasCode()) {
38722        composeCodeableConcept("code", element.getCode());
38723      }
38724      if (element.hasFactor()) {
38725        composeMoney("factor", element.getFactor());
38726      }
38727      if (element.hasAmountElement()) {
38728        composeDecimalCore("amount", element.getAmountElement(), false);
38729        composeDecimalExtras("amount", element.getAmountElement(), false);
38730      }
38731  }
38732
38733  protected void composeItemInstance(String name, ItemInstance element) throws IOException {
38734    if (element != null) {
38735      prop("resourceType", name);
38736      composeItemInstanceInner(element);
38737    }
38738  }
38739
38740  protected void composeItemInstanceInner(ItemInstance element) throws IOException {
38741      composeDomainResourceElements(element);
38742      if (element.hasCountElement()) {
38743        composeIntegerCore("count", element.getCountElement(), false);
38744        composeIntegerExtras("count", element.getCountElement(), false);
38745      }
38746      if (element.hasLocation()) {
38747        composeReference("location", element.getLocation());
38748      }
38749      if (element.hasSubject()) {
38750        composeReference("subject", element.getSubject());
38751      }
38752      if (element.hasManufactureDateElement()) {
38753        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
38754        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
38755      }
38756      if (element.hasExpiryDateElement()) {
38757        composeDateTimeCore("expiryDate", element.getExpiryDateElement(), false);
38758        composeDateTimeExtras("expiryDate", element.getExpiryDateElement(), false);
38759      }
38760      if (element.hasCurrentSWVersionElement()) {
38761        composeStringCore("currentSWVersion", element.getCurrentSWVersionElement(), false);
38762        composeStringExtras("currentSWVersion", element.getCurrentSWVersionElement(), false);
38763      }
38764      if (element.hasLotNumberElement()) {
38765        composeStringCore("lotNumber", element.getLotNumberElement(), false);
38766        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
38767      }
38768      if (element.hasSerialNumberElement()) {
38769        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
38770        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
38771      }
38772      if (element.hasCarrierAIDCElement()) {
38773        composeStringCore("carrierAIDC", element.getCarrierAIDCElement(), false);
38774        composeStringExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
38775      }
38776      if (element.hasCarrierHRFElement()) {
38777        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
38778        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
38779      }
38780  }
38781
38782  protected void composeLibrary(String name, Library element) throws IOException {
38783    if (element != null) {
38784      prop("resourceType", name);
38785      composeLibraryInner(element);
38786    }
38787  }
38788
38789  protected void composeLibraryInner(Library element) throws IOException {
38790      composeDomainResourceElements(element);
38791      if (element.hasUrlElement()) {
38792        composeUriCore("url", element.getUrlElement(), false);
38793        composeUriExtras("url", element.getUrlElement(), false);
38794      }
38795      if (element.hasIdentifier()) {
38796        openArray("identifier");
38797        for (Identifier e : element.getIdentifier()) 
38798          composeIdentifier(null, e);
38799        closeArray();
38800      };
38801      if (element.hasVersionElement()) {
38802        composeStringCore("version", element.getVersionElement(), false);
38803        composeStringExtras("version", element.getVersionElement(), false);
38804      }
38805      if (element.hasNameElement()) {
38806        composeStringCore("name", element.getNameElement(), false);
38807        composeStringExtras("name", element.getNameElement(), false);
38808      }
38809      if (element.hasTitleElement()) {
38810        composeStringCore("title", element.getTitleElement(), false);
38811        composeStringExtras("title", element.getTitleElement(), false);
38812      }
38813      if (element.hasSubtitleElement()) {
38814        composeStringCore("subtitle", element.getSubtitleElement(), false);
38815        composeStringExtras("subtitle", element.getSubtitleElement(), false);
38816      }
38817      if (element.hasStatusElement()) {
38818        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38819        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38820      }
38821      if (element.hasExperimentalElement()) {
38822        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38823        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38824      }
38825      if (element.hasType()) {
38826        composeCodeableConcept("type", element.getType());
38827      }
38828      if (element.hasSubject()) {
38829        composeType("subject", element.getSubject());
38830      }
38831      if (element.hasDateElement()) {
38832        composeDateTimeCore("date", element.getDateElement(), false);
38833        composeDateTimeExtras("date", element.getDateElement(), false);
38834      }
38835      if (element.hasPublisherElement()) {
38836        composeStringCore("publisher", element.getPublisherElement(), false);
38837        composeStringExtras("publisher", element.getPublisherElement(), false);
38838      }
38839      if (element.hasContact()) {
38840        openArray("contact");
38841        for (ContactDetail e : element.getContact()) 
38842          composeContactDetail(null, e);
38843        closeArray();
38844      };
38845      if (element.hasDescriptionElement()) {
38846        composeMarkdownCore("description", element.getDescriptionElement(), false);
38847        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38848      }
38849      if (element.hasUseContext()) {
38850        openArray("useContext");
38851        for (UsageContext e : element.getUseContext()) 
38852          composeUsageContext(null, e);
38853        closeArray();
38854      };
38855      if (element.hasJurisdiction()) {
38856        openArray("jurisdiction");
38857        for (CodeableConcept e : element.getJurisdiction()) 
38858          composeCodeableConcept(null, e);
38859        closeArray();
38860      };
38861      if (element.hasPurposeElement()) {
38862        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38863        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38864      }
38865      if (element.hasUsageElement()) {
38866        composeStringCore("usage", element.getUsageElement(), false);
38867        composeStringExtras("usage", element.getUsageElement(), false);
38868      }
38869      if (element.hasCopyrightElement()) {
38870        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
38871        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
38872      }
38873      if (element.hasApprovalDateElement()) {
38874        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
38875        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
38876      }
38877      if (element.hasLastReviewDateElement()) {
38878        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
38879        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
38880      }
38881      if (element.hasEffectivePeriod()) {
38882        composePeriod("effectivePeriod", element.getEffectivePeriod());
38883      }
38884      if (element.hasTopic()) {
38885        openArray("topic");
38886        for (CodeableConcept e : element.getTopic()) 
38887          composeCodeableConcept(null, e);
38888        closeArray();
38889      };
38890      if (element.hasContributor()) {
38891        openArray("contributor");
38892        for (Contributor e : element.getContributor()) 
38893          composeContributor(null, e);
38894        closeArray();
38895      };
38896      if (element.hasRelatedArtifact()) {
38897        openArray("relatedArtifact");
38898        for (RelatedArtifact e : element.getRelatedArtifact()) 
38899          composeRelatedArtifact(null, e);
38900        closeArray();
38901      };
38902      if (element.hasParameter()) {
38903        openArray("parameter");
38904        for (ParameterDefinition e : element.getParameter()) 
38905          composeParameterDefinition(null, e);
38906        closeArray();
38907      };
38908      if (element.hasDataRequirement()) {
38909        openArray("dataRequirement");
38910        for (DataRequirement e : element.getDataRequirement()) 
38911          composeDataRequirement(null, e);
38912        closeArray();
38913      };
38914      if (element.hasContent()) {
38915        openArray("content");
38916        for (Attachment e : element.getContent()) 
38917          composeAttachment(null, e);
38918        closeArray();
38919      };
38920  }
38921
38922  protected void composeLinkage(String name, Linkage element) throws IOException {
38923    if (element != null) {
38924      prop("resourceType", name);
38925      composeLinkageInner(element);
38926    }
38927  }
38928
38929  protected void composeLinkageInner(Linkage element) throws IOException {
38930      composeDomainResourceElements(element);
38931      if (element.hasActiveElement()) {
38932        composeBooleanCore("active", element.getActiveElement(), false);
38933        composeBooleanExtras("active", element.getActiveElement(), false);
38934      }
38935      if (element.hasAuthor()) {
38936        composeReference("author", element.getAuthor());
38937      }
38938      if (element.hasItem()) {
38939        openArray("item");
38940        for (Linkage.LinkageItemComponent e : element.getItem()) 
38941          composeLinkageLinkageItemComponent(null, e);
38942        closeArray();
38943      };
38944  }
38945
38946  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
38947    if (element != null) {
38948      open(name);
38949      composeLinkageLinkageItemComponentInner(element);
38950      close();
38951    }
38952  }
38953
38954  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
38955      composeBackbone(element);
38956      if (element.hasTypeElement()) {
38957        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
38958        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
38959      }
38960      if (element.hasResource()) {
38961        composeReference("resource", element.getResource());
38962      }
38963  }
38964
38965  protected void composeListResource(String name, ListResource element) throws IOException {
38966    if (element != null) {
38967      prop("resourceType", name);
38968      composeListResourceInner(element);
38969    }
38970  }
38971
38972  protected void composeListResourceInner(ListResource element) throws IOException {
38973      composeDomainResourceElements(element);
38974      if (element.hasIdentifier()) {
38975        openArray("identifier");
38976        for (Identifier e : element.getIdentifier()) 
38977          composeIdentifier(null, e);
38978        closeArray();
38979      };
38980      if (element.hasStatusElement()) {
38981        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
38982        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
38983      }
38984      if (element.hasModeElement()) {
38985        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
38986        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
38987      }
38988      if (element.hasTitleElement()) {
38989        composeStringCore("title", element.getTitleElement(), false);
38990        composeStringExtras("title", element.getTitleElement(), false);
38991      }
38992      if (element.hasCode()) {
38993        composeCodeableConcept("code", element.getCode());
38994      }
38995      if (element.hasSubject()) {
38996        composeReference("subject", element.getSubject());
38997      }
38998      if (element.hasEncounter()) {
38999        composeReference("encounter", element.getEncounter());
39000      }
39001      if (element.hasDateElement()) {
39002        composeDateTimeCore("date", element.getDateElement(), false);
39003        composeDateTimeExtras("date", element.getDateElement(), false);
39004      }
39005      if (element.hasSource()) {
39006        composeReference("source", element.getSource());
39007      }
39008      if (element.hasOrderedBy()) {
39009        composeCodeableConcept("orderedBy", element.getOrderedBy());
39010      }
39011      if (element.hasNote()) {
39012        openArray("note");
39013        for (Annotation e : element.getNote()) 
39014          composeAnnotation(null, e);
39015        closeArray();
39016      };
39017      if (element.hasEntry()) {
39018        openArray("entry");
39019        for (ListResource.ListEntryComponent e : element.getEntry()) 
39020          composeListResourceListEntryComponent(null, e);
39021        closeArray();
39022      };
39023      if (element.hasEmptyReason()) {
39024        composeCodeableConcept("emptyReason", element.getEmptyReason());
39025      }
39026  }
39027
39028  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
39029    if (element != null) {
39030      open(name);
39031      composeListResourceListEntryComponentInner(element);
39032      close();
39033    }
39034  }
39035
39036  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
39037      composeBackbone(element);
39038      if (element.hasFlag()) {
39039        composeCodeableConcept("flag", element.getFlag());
39040      }
39041      if (element.hasDeletedElement()) {
39042        composeBooleanCore("deleted", element.getDeletedElement(), false);
39043        composeBooleanExtras("deleted", element.getDeletedElement(), false);
39044      }
39045      if (element.hasDateElement()) {
39046        composeDateTimeCore("date", element.getDateElement(), false);
39047        composeDateTimeExtras("date", element.getDateElement(), false);
39048      }
39049      if (element.hasItem()) {
39050        composeReference("item", element.getItem());
39051      }
39052  }
39053
39054  protected void composeLocation(String name, Location element) throws IOException {
39055    if (element != null) {
39056      prop("resourceType", name);
39057      composeLocationInner(element);
39058    }
39059  }
39060
39061  protected void composeLocationInner(Location element) throws IOException {
39062      composeDomainResourceElements(element);
39063      if (element.hasIdentifier()) {
39064        openArray("identifier");
39065        for (Identifier e : element.getIdentifier()) 
39066          composeIdentifier(null, e);
39067        closeArray();
39068      };
39069      if (element.hasStatusElement()) {
39070        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
39071        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
39072      }
39073      if (element.hasOperationalStatus()) {
39074        composeCoding("operationalStatus", element.getOperationalStatus());
39075      }
39076      if (element.hasNameElement()) {
39077        composeStringCore("name", element.getNameElement(), false);
39078        composeStringExtras("name", element.getNameElement(), false);
39079      }
39080      if (element.hasAlias()) {
39081        openArray("alias");
39082        for (StringType e : element.getAlias()) 
39083          composeStringCore(null, e, true);
39084        closeArray();
39085        if (anyHasExtras(element.getAlias())) {
39086          openArray("_alias");
39087          for (StringType e : element.getAlias()) 
39088            composeStringExtras(null, e, true);
39089          closeArray();
39090        }
39091      };
39092      if (element.hasDescriptionElement()) {
39093        composeStringCore("description", element.getDescriptionElement(), false);
39094        composeStringExtras("description", element.getDescriptionElement(), false);
39095      }
39096      if (element.hasModeElement()) {
39097        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
39098        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
39099      }
39100      if (element.hasType()) {
39101        openArray("type");
39102        for (CodeableConcept e : element.getType()) 
39103          composeCodeableConcept(null, e);
39104        closeArray();
39105      };
39106      if (element.hasTelecom()) {
39107        openArray("telecom");
39108        for (ContactPoint e : element.getTelecom()) 
39109          composeContactPoint(null, e);
39110        closeArray();
39111      };
39112      if (element.hasAddress()) {
39113        composeAddress("address", element.getAddress());
39114      }
39115      if (element.hasPhysicalType()) {
39116        composeCodeableConcept("physicalType", element.getPhysicalType());
39117      }
39118      if (element.hasPosition()) {
39119        composeLocationLocationPositionComponent("position", element.getPosition());
39120      }
39121      if (element.hasManagingOrganization()) {
39122        composeReference("managingOrganization", element.getManagingOrganization());
39123      }
39124      if (element.hasPartOf()) {
39125        composeReference("partOf", element.getPartOf());
39126      }
39127      if (element.hasHoursOfOperation()) {
39128        openArray("hoursOfOperation");
39129        for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation()) 
39130          composeLocationLocationHoursOfOperationComponent(null, e);
39131        closeArray();
39132      };
39133      if (element.hasAvailabilityExceptionsElement()) {
39134        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
39135        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
39136      }
39137      if (element.hasEndpoint()) {
39138        openArray("endpoint");
39139        for (Reference e : element.getEndpoint()) 
39140          composeReference(null, e);
39141        closeArray();
39142      };
39143  }
39144
39145  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
39146    if (element != null) {
39147      open(name);
39148      composeLocationLocationPositionComponentInner(element);
39149      close();
39150    }
39151  }
39152
39153  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
39154      composeBackbone(element);
39155      if (element.hasLongitudeElement()) {
39156        composeDecimalCore("longitude", element.getLongitudeElement(), false);
39157        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
39158      }
39159      if (element.hasLatitudeElement()) {
39160        composeDecimalCore("latitude", element.getLatitudeElement(), false);
39161        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
39162      }
39163      if (element.hasAltitudeElement()) {
39164        composeDecimalCore("altitude", element.getAltitudeElement(), false);
39165        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
39166      }
39167  }
39168
39169  protected void composeLocationLocationHoursOfOperationComponent(String name, Location.LocationHoursOfOperationComponent element) throws IOException {
39170    if (element != null) {
39171      open(name);
39172      composeLocationLocationHoursOfOperationComponentInner(element);
39173      close();
39174    }
39175  }
39176
39177  protected void composeLocationLocationHoursOfOperationComponentInner(Location.LocationHoursOfOperationComponent element) throws IOException {
39178      composeBackbone(element);
39179      if (element.hasDaysOfWeek()) {
39180        openArray("daysOfWeek");
39181        for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
39182          composeEnumerationCore(null, e, new Location.DaysOfWeekEnumFactory(), true);
39183        closeArray();
39184        if (anyHasExtras(element.getDaysOfWeek())) {
39185          openArray("_daysOfWeek");
39186          for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
39187            composeEnumerationExtras(null, e, new Location.DaysOfWeekEnumFactory(), true);
39188          closeArray();
39189        }
39190      };
39191      if (element.hasAllDayElement()) {
39192        composeBooleanCore("allDay", element.getAllDayElement(), false);
39193        composeBooleanExtras("allDay", element.getAllDayElement(), false);
39194      }
39195      if (element.hasOpeningTimeElement()) {
39196        composeTimeCore("openingTime", element.getOpeningTimeElement(), false);
39197        composeTimeExtras("openingTime", element.getOpeningTimeElement(), false);
39198      }
39199      if (element.hasClosingTimeElement()) {
39200        composeTimeCore("closingTime", element.getClosingTimeElement(), false);
39201        composeTimeExtras("closingTime", element.getClosingTimeElement(), false);
39202      }
39203  }
39204
39205  protected void composeMeasure(String name, Measure element) throws IOException {
39206    if (element != null) {
39207      prop("resourceType", name);
39208      composeMeasureInner(element);
39209    }
39210  }
39211
39212  protected void composeMeasureInner(Measure element) throws IOException {
39213      composeDomainResourceElements(element);
39214      if (element.hasUrlElement()) {
39215        composeUriCore("url", element.getUrlElement(), false);
39216        composeUriExtras("url", element.getUrlElement(), false);
39217      }
39218      if (element.hasIdentifier()) {
39219        openArray("identifier");
39220        for (Identifier e : element.getIdentifier()) 
39221          composeIdentifier(null, e);
39222        closeArray();
39223      };
39224      if (element.hasVersionElement()) {
39225        composeStringCore("version", element.getVersionElement(), false);
39226        composeStringExtras("version", element.getVersionElement(), false);
39227      }
39228      if (element.hasNameElement()) {
39229        composeStringCore("name", element.getNameElement(), false);
39230        composeStringExtras("name", element.getNameElement(), false);
39231      }
39232      if (element.hasTitleElement()) {
39233        composeStringCore("title", element.getTitleElement(), false);
39234        composeStringExtras("title", element.getTitleElement(), false);
39235      }
39236      if (element.hasSubtitleElement()) {
39237        composeStringCore("subtitle", element.getSubtitleElement(), false);
39238        composeStringExtras("subtitle", element.getSubtitleElement(), false);
39239      }
39240      if (element.hasStatusElement()) {
39241        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39242        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39243      }
39244      if (element.hasExperimentalElement()) {
39245        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39246        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39247      }
39248      if (element.hasSubject()) {
39249        composeType("subject", element.getSubject());
39250      }
39251      if (element.hasDateElement()) {
39252        composeDateTimeCore("date", element.getDateElement(), false);
39253        composeDateTimeExtras("date", element.getDateElement(), false);
39254      }
39255      if (element.hasPublisherElement()) {
39256        composeStringCore("publisher", element.getPublisherElement(), false);
39257        composeStringExtras("publisher", element.getPublisherElement(), false);
39258      }
39259      if (element.hasContact()) {
39260        openArray("contact");
39261        for (ContactDetail e : element.getContact()) 
39262          composeContactDetail(null, e);
39263        closeArray();
39264      };
39265      if (element.hasDescriptionElement()) {
39266        composeMarkdownCore("description", element.getDescriptionElement(), false);
39267        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39268      }
39269      if (element.hasUseContext()) {
39270        openArray("useContext");
39271        for (UsageContext e : element.getUseContext()) 
39272          composeUsageContext(null, e);
39273        closeArray();
39274      };
39275      if (element.hasJurisdiction()) {
39276        openArray("jurisdiction");
39277        for (CodeableConcept e : element.getJurisdiction()) 
39278          composeCodeableConcept(null, e);
39279        closeArray();
39280      };
39281      if (element.hasPurposeElement()) {
39282        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39283        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39284      }
39285      if (element.hasUsageElement()) {
39286        composeStringCore("usage", element.getUsageElement(), false);
39287        composeStringExtras("usage", element.getUsageElement(), false);
39288      }
39289      if (element.hasCopyrightElement()) {
39290        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39291        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39292      }
39293      if (element.hasApprovalDateElement()) {
39294        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
39295        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
39296      }
39297      if (element.hasLastReviewDateElement()) {
39298        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
39299        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
39300      }
39301      if (element.hasEffectivePeriod()) {
39302        composePeriod("effectivePeriod", element.getEffectivePeriod());
39303      }
39304      if (element.hasTopic()) {
39305        openArray("topic");
39306        for (CodeableConcept e : element.getTopic()) 
39307          composeCodeableConcept(null, e);
39308        closeArray();
39309      };
39310      if (element.hasContributor()) {
39311        openArray("contributor");
39312        for (Contributor e : element.getContributor()) 
39313          composeContributor(null, e);
39314        closeArray();
39315      };
39316      if (element.hasRelatedArtifact()) {
39317        openArray("relatedArtifact");
39318        for (RelatedArtifact e : element.getRelatedArtifact()) 
39319          composeRelatedArtifact(null, e);
39320        closeArray();
39321      };
39322      if (element.hasLibrary()) {
39323        openArray("library");
39324        for (CanonicalType e : element.getLibrary()) 
39325          composeCanonicalCore(null, e, true);
39326        closeArray();
39327        if (anyHasExtras(element.getLibrary())) {
39328          openArray("_library");
39329          for (CanonicalType e : element.getLibrary()) 
39330            composeCanonicalExtras(null, e, true);
39331          closeArray();
39332        }
39333      };
39334      if (element.hasDisclaimerElement()) {
39335        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
39336        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
39337      }
39338      if (element.hasScoring()) {
39339        composeCodeableConcept("scoring", element.getScoring());
39340      }
39341      if (element.hasCompositeScoring()) {
39342        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
39343      }
39344      if (element.hasType()) {
39345        openArray("type");
39346        for (CodeableConcept e : element.getType()) 
39347          composeCodeableConcept(null, e);
39348        closeArray();
39349      };
39350      if (element.hasRiskAdjustmentElement()) {
39351        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
39352        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
39353      }
39354      if (element.hasRateAggregationElement()) {
39355        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
39356        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
39357      }
39358      if (element.hasRationaleElement()) {
39359        composeMarkdownCore("rationale", element.getRationaleElement(), false);
39360        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
39361      }
39362      if (element.hasClinicalRecommendationStatementElement()) {
39363        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
39364        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
39365      }
39366      if (element.hasImprovementNotationElement()) {
39367        composeStringCore("improvementNotation", element.getImprovementNotationElement(), false);
39368        composeStringExtras("improvementNotation", element.getImprovementNotationElement(), false);
39369      }
39370      if (element.hasDefinition()) {
39371        openArray("definition");
39372        for (MarkdownType e : element.getDefinition()) 
39373          composeMarkdownCore(null, e, true);
39374        closeArray();
39375        if (anyHasExtras(element.getDefinition())) {
39376          openArray("_definition");
39377          for (MarkdownType e : element.getDefinition()) 
39378            composeMarkdownExtras(null, e, true);
39379          closeArray();
39380        }
39381      };
39382      if (element.hasGuidanceElement()) {
39383        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
39384        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
39385      }
39386      if (element.hasSetElement()) {
39387        composeStringCore("set", element.getSetElement(), false);
39388        composeStringExtras("set", element.getSetElement(), false);
39389      }
39390      if (element.hasGroup()) {
39391        openArray("group");
39392        for (Measure.MeasureGroupComponent e : element.getGroup()) 
39393          composeMeasureMeasureGroupComponent(null, e);
39394        closeArray();
39395      };
39396      if (element.hasSupplementalData()) {
39397        openArray("supplementalData");
39398        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
39399          composeMeasureMeasureSupplementalDataComponent(null, e);
39400        closeArray();
39401      };
39402  }
39403
39404  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
39405    if (element != null) {
39406      open(name);
39407      composeMeasureMeasureGroupComponentInner(element);
39408      close();
39409    }
39410  }
39411
39412  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
39413      composeBackbone(element);
39414      if (element.hasCode()) {
39415        composeCodeableConcept("code", element.getCode());
39416      }
39417      if (element.hasDescriptionElement()) {
39418        composeStringCore("description", element.getDescriptionElement(), false);
39419        composeStringExtras("description", element.getDescriptionElement(), false);
39420      }
39421      if (element.hasPopulation()) {
39422        openArray("population");
39423        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
39424          composeMeasureMeasureGroupPopulationComponent(null, e);
39425        closeArray();
39426      };
39427      if (element.hasStratifier()) {
39428        openArray("stratifier");
39429        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
39430          composeMeasureMeasureGroupStratifierComponent(null, e);
39431        closeArray();
39432      };
39433  }
39434
39435  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
39436    if (element != null) {
39437      open(name);
39438      composeMeasureMeasureGroupPopulationComponentInner(element);
39439      close();
39440    }
39441  }
39442
39443  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
39444      composeBackbone(element);
39445      if (element.hasCode()) {
39446        composeCodeableConcept("code", element.getCode());
39447      }
39448      if (element.hasDescriptionElement()) {
39449        composeStringCore("description", element.getDescriptionElement(), false);
39450        composeStringExtras("description", element.getDescriptionElement(), false);
39451      }
39452      if (element.hasCriteriaElement()) {
39453        composeStringCore("criteria", element.getCriteriaElement(), false);
39454        composeStringExtras("criteria", element.getCriteriaElement(), false);
39455      }
39456  }
39457
39458  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
39459    if (element != null) {
39460      open(name);
39461      composeMeasureMeasureGroupStratifierComponentInner(element);
39462      close();
39463    }
39464  }
39465
39466  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
39467      composeBackbone(element);
39468      if (element.hasCode()) {
39469        composeCodeableConcept("code", element.getCode());
39470      }
39471      if (element.hasDescriptionElement()) {
39472        composeStringCore("description", element.getDescriptionElement(), false);
39473        composeStringExtras("description", element.getDescriptionElement(), false);
39474      }
39475      if (element.hasCriteriaElement()) {
39476        composeStringCore("criteria", element.getCriteriaElement(), false);
39477        composeStringExtras("criteria", element.getCriteriaElement(), false);
39478      }
39479      if (element.hasPathElement()) {
39480        composeStringCore("path", element.getPathElement(), false);
39481        composeStringExtras("path", element.getPathElement(), false);
39482      }
39483  }
39484
39485  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
39486    if (element != null) {
39487      open(name);
39488      composeMeasureMeasureSupplementalDataComponentInner(element);
39489      close();
39490    }
39491  }
39492
39493  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
39494      composeBackbone(element);
39495      if (element.hasCode()) {
39496        composeCodeableConcept("code", element.getCode());
39497      }
39498      if (element.hasUsage()) {
39499        openArray("usage");
39500        for (CodeableConcept e : element.getUsage()) 
39501          composeCodeableConcept(null, e);
39502        closeArray();
39503      };
39504      if (element.hasDescriptionElement()) {
39505        composeStringCore("description", element.getDescriptionElement(), false);
39506        composeStringExtras("description", element.getDescriptionElement(), false);
39507      }
39508      if (element.hasCriteriaElement()) {
39509        composeStringCore("criteria", element.getCriteriaElement(), false);
39510        composeStringExtras("criteria", element.getCriteriaElement(), false);
39511      }
39512      if (element.hasPathElement()) {
39513        composeStringCore("path", element.getPathElement(), false);
39514        composeStringExtras("path", element.getPathElement(), false);
39515      }
39516  }
39517
39518  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
39519    if (element != null) {
39520      prop("resourceType", name);
39521      composeMeasureReportInner(element);
39522    }
39523  }
39524
39525  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
39526      composeDomainResourceElements(element);
39527      if (element.hasIdentifier()) {
39528        openArray("identifier");
39529        for (Identifier e : element.getIdentifier()) 
39530          composeIdentifier(null, e);
39531        closeArray();
39532      };
39533      if (element.hasStatusElement()) {
39534        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
39535        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
39536      }
39537      if (element.hasTypeElement()) {
39538        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
39539        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
39540      }
39541      if (element.hasMeasureElement()) {
39542        composeCanonicalCore("measure", element.getMeasureElement(), false);
39543        composeCanonicalExtras("measure", element.getMeasureElement(), false);
39544      }
39545      if (element.hasSubject()) {
39546        composeReference("subject", element.getSubject());
39547      }
39548      if (element.hasDateElement()) {
39549        composeDateTimeCore("date", element.getDateElement(), false);
39550        composeDateTimeExtras("date", element.getDateElement(), false);
39551      }
39552      if (element.hasReporter()) {
39553        composeReference("reporter", element.getReporter());
39554      }
39555      if (element.hasPeriod()) {
39556        composePeriod("period", element.getPeriod());
39557      }
39558      if (element.hasGroup()) {
39559        openArray("group");
39560        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
39561          composeMeasureReportMeasureReportGroupComponent(null, e);
39562        closeArray();
39563      };
39564      if (element.hasEvaluatedResources()) {
39565        composeReference("evaluatedResources", element.getEvaluatedResources());
39566      }
39567  }
39568
39569  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
39570    if (element != null) {
39571      open(name);
39572      composeMeasureReportMeasureReportGroupComponentInner(element);
39573      close();
39574    }
39575  }
39576
39577  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
39578      composeBackbone(element);
39579      if (element.hasCode()) {
39580        composeCodeableConcept("code", element.getCode());
39581      }
39582      if (element.hasPopulation()) {
39583        openArray("population");
39584        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
39585          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
39586        closeArray();
39587      };
39588      if (element.hasMeasureScore()) {
39589        composeQuantity("measureScore", element.getMeasureScore());
39590      }
39591      if (element.hasStratifier()) {
39592        openArray("stratifier");
39593        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
39594          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
39595        closeArray();
39596      };
39597  }
39598
39599  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
39600    if (element != null) {
39601      open(name);
39602      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
39603      close();
39604    }
39605  }
39606
39607  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
39608      composeBackbone(element);
39609      if (element.hasCode()) {
39610        composeCodeableConcept("code", element.getCode());
39611      }
39612      if (element.hasCountElement()) {
39613        composeIntegerCore("count", element.getCountElement(), false);
39614        composeIntegerExtras("count", element.getCountElement(), false);
39615      }
39616      if (element.hasSubjects()) {
39617        composeReference("subjects", element.getSubjects());
39618      }
39619  }
39620
39621  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
39622    if (element != null) {
39623      open(name);
39624      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
39625      close();
39626    }
39627  }
39628
39629  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
39630      composeBackbone(element);
39631      if (element.hasCode()) {
39632        composeCodeableConcept("code", element.getCode());
39633      }
39634      if (element.hasStratum()) {
39635        openArray("stratum");
39636        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
39637          composeMeasureReportStratifierGroupComponent(null, e);
39638        closeArray();
39639      };
39640  }
39641
39642  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
39643    if (element != null) {
39644      open(name);
39645      composeMeasureReportStratifierGroupComponentInner(element);
39646      close();
39647    }
39648  }
39649
39650  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element) throws IOException {
39651      composeBackbone(element);
39652      if (element.hasValue()) {
39653        composeCodeableConcept("value", element.getValue());
39654      }
39655      if (element.hasPopulation()) {
39656        openArray("population");
39657        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
39658          composeMeasureReportStratifierGroupPopulationComponent(null, e);
39659        closeArray();
39660      };
39661      if (element.hasMeasureScore()) {
39662        composeQuantity("measureScore", element.getMeasureScore());
39663      }
39664  }
39665
39666  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
39667    if (element != null) {
39668      open(name);
39669      composeMeasureReportStratifierGroupPopulationComponentInner(element);
39670      close();
39671    }
39672  }
39673
39674  protected void composeMeasureReportStratifierGroupPopulationComponentInner(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
39675      composeBackbone(element);
39676      if (element.hasCode()) {
39677        composeCodeableConcept("code", element.getCode());
39678      }
39679      if (element.hasCountElement()) {
39680        composeIntegerCore("count", element.getCountElement(), false);
39681        composeIntegerExtras("count", element.getCountElement(), false);
39682      }
39683      if (element.hasSubjects()) {
39684        composeReference("subjects", element.getSubjects());
39685      }
39686  }
39687
39688  protected void composeMedia(String name, Media element) throws IOException {
39689    if (element != null) {
39690      prop("resourceType", name);
39691      composeMediaInner(element);
39692    }
39693  }
39694
39695  protected void composeMediaInner(Media element) throws IOException {
39696      composeDomainResourceElements(element);
39697      if (element.hasIdentifier()) {
39698        openArray("identifier");
39699        for (Identifier e : element.getIdentifier()) 
39700          composeIdentifier(null, e);
39701        closeArray();
39702      };
39703      if (element.hasBasedOn()) {
39704        openArray("basedOn");
39705        for (Reference e : element.getBasedOn()) 
39706          composeReference(null, e);
39707        closeArray();
39708      };
39709      if (element.hasPartOf()) {
39710        openArray("partOf");
39711        for (Reference e : element.getPartOf()) 
39712          composeReference(null, e);
39713        closeArray();
39714      };
39715      if (element.hasStatusElement()) {
39716        composeEnumerationCore("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
39717        composeEnumerationExtras("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
39718      }
39719      if (element.hasType()) {
39720        composeCodeableConcept("type", element.getType());
39721      }
39722      if (element.hasModality()) {
39723        composeCodeableConcept("modality", element.getModality());
39724      }
39725      if (element.hasView()) {
39726        composeCodeableConcept("view", element.getView());
39727      }
39728      if (element.hasSubject()) {
39729        composeReference("subject", element.getSubject());
39730      }
39731      if (element.hasContext()) {
39732        composeReference("context", element.getContext());
39733      }
39734      if (element.hasCreated()) {
39735        composeType("created", element.getCreated());
39736      }
39737      if (element.hasIssuedElement()) {
39738        composeInstantCore("issued", element.getIssuedElement(), false);
39739        composeInstantExtras("issued", element.getIssuedElement(), false);
39740      }
39741      if (element.hasOperator()) {
39742        composeReference("operator", element.getOperator());
39743      }
39744      if (element.hasReasonCode()) {
39745        openArray("reasonCode");
39746        for (CodeableConcept e : element.getReasonCode()) 
39747          composeCodeableConcept(null, e);
39748        closeArray();
39749      };
39750      if (element.hasBodySite()) {
39751        composeCodeableConcept("bodySite", element.getBodySite());
39752      }
39753      if (element.hasDeviceNameElement()) {
39754        composeStringCore("deviceName", element.getDeviceNameElement(), false);
39755        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
39756      }
39757      if (element.hasDevice()) {
39758        composeReference("device", element.getDevice());
39759      }
39760      if (element.hasHeightElement()) {
39761        composePositiveIntCore("height", element.getHeightElement(), false);
39762        composePositiveIntExtras("height", element.getHeightElement(), false);
39763      }
39764      if (element.hasWidthElement()) {
39765        composePositiveIntCore("width", element.getWidthElement(), false);
39766        composePositiveIntExtras("width", element.getWidthElement(), false);
39767      }
39768      if (element.hasFramesElement()) {
39769        composePositiveIntCore("frames", element.getFramesElement(), false);
39770        composePositiveIntExtras("frames", element.getFramesElement(), false);
39771      }
39772      if (element.hasDurationElement()) {
39773        composeDecimalCore("duration", element.getDurationElement(), false);
39774        composeDecimalExtras("duration", element.getDurationElement(), false);
39775      }
39776      if (element.hasContent()) {
39777        composeAttachment("content", element.getContent());
39778      }
39779      if (element.hasNote()) {
39780        openArray("note");
39781        for (Annotation e : element.getNote()) 
39782          composeAnnotation(null, e);
39783        closeArray();
39784      };
39785  }
39786
39787  protected void composeMedication(String name, Medication element) throws IOException {
39788    if (element != null) {
39789      prop("resourceType", name);
39790      composeMedicationInner(element);
39791    }
39792  }
39793
39794  protected void composeMedicationInner(Medication element) throws IOException {
39795      composeDomainResourceElements(element);
39796      if (element.hasCode()) {
39797        composeCodeableConcept("code", element.getCode());
39798      }
39799      if (element.hasStatusElement()) {
39800        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
39801        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
39802      }
39803      if (element.hasManufacturer()) {
39804        composeReference("manufacturer", element.getManufacturer());
39805      }
39806      if (element.hasForm()) {
39807        composeCodeableConcept("form", element.getForm());
39808      }
39809      if (element.hasAmount()) {
39810        composeSimpleQuantity("amount", element.getAmount());
39811      }
39812      if (element.hasIngredient()) {
39813        openArray("ingredient");
39814        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
39815          composeMedicationMedicationIngredientComponent(null, e);
39816        closeArray();
39817      };
39818      if (element.hasBatch()) {
39819        composeMedicationMedicationBatchComponent("batch", element.getBatch());
39820      }
39821  }
39822
39823  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
39824    if (element != null) {
39825      open(name);
39826      composeMedicationMedicationIngredientComponentInner(element);
39827      close();
39828    }
39829  }
39830
39831  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element) throws IOException {
39832      composeBackbone(element);
39833      if (element.hasItem()) {
39834        composeType("item", element.getItem());
39835      }
39836      if (element.hasIsActiveElement()) {
39837        composeBooleanCore("isActive", element.getIsActiveElement(), false);
39838        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
39839      }
39840      if (element.hasAmount()) {
39841        composeRatio("amount", element.getAmount());
39842      }
39843  }
39844
39845  protected void composeMedicationMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
39846    if (element != null) {
39847      open(name);
39848      composeMedicationMedicationBatchComponentInner(element);
39849      close();
39850    }
39851  }
39852
39853  protected void composeMedicationMedicationBatchComponentInner(Medication.MedicationBatchComponent element) throws IOException {
39854      composeBackbone(element);
39855      if (element.hasLotNumberElement()) {
39856        composeStringCore("lotNumber", element.getLotNumberElement(), false);
39857        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
39858      }
39859      if (element.hasExpirationDateElement()) {
39860        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
39861        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
39862      }
39863      if (element.hasSerialNumberElement()) {
39864        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
39865        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
39866      }
39867  }
39868
39869  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
39870    if (element != null) {
39871      prop("resourceType", name);
39872      composeMedicationAdministrationInner(element);
39873    }
39874  }
39875
39876  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
39877      composeDomainResourceElements(element);
39878      if (element.hasIdentifier()) {
39879        openArray("identifier");
39880        for (Identifier e : element.getIdentifier()) 
39881          composeIdentifier(null, e);
39882        closeArray();
39883      };
39884      if (element.hasInstantiates()) {
39885        openArray("instantiates");
39886        for (UriType e : element.getInstantiates()) 
39887          composeUriCore(null, e, true);
39888        closeArray();
39889        if (anyHasExtras(element.getInstantiates())) {
39890          openArray("_instantiates");
39891          for (UriType e : element.getInstantiates()) 
39892            composeUriExtras(null, e, true);
39893          closeArray();
39894        }
39895      };
39896      if (element.hasPartOf()) {
39897        openArray("partOf");
39898        for (Reference e : element.getPartOf()) 
39899          composeReference(null, e);
39900        closeArray();
39901      };
39902      if (element.hasStatusElement()) {
39903        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
39904        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
39905      }
39906      if (element.hasCategory()) {
39907        composeCodeableConcept("category", element.getCategory());
39908      }
39909      if (element.hasMedication()) {
39910        composeType("medication", element.getMedication());
39911      }
39912      if (element.hasSubject()) {
39913        composeReference("subject", element.getSubject());
39914      }
39915      if (element.hasContext()) {
39916        composeReference("context", element.getContext());
39917      }
39918      if (element.hasSupportingInformation()) {
39919        openArray("supportingInformation");
39920        for (Reference e : element.getSupportingInformation()) 
39921          composeReference(null, e);
39922        closeArray();
39923      };
39924      if (element.hasEffective()) {
39925        composeType("effective", element.getEffective());
39926      }
39927      if (element.hasPerformer()) {
39928        openArray("performer");
39929        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
39930          composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
39931        closeArray();
39932      };
39933      if (element.hasStatusReason()) {
39934        openArray("statusReason");
39935        for (CodeableConcept e : element.getStatusReason()) 
39936          composeCodeableConcept(null, e);
39937        closeArray();
39938      };
39939      if (element.hasReasonCode()) {
39940        openArray("reasonCode");
39941        for (CodeableConcept e : element.getReasonCode()) 
39942          composeCodeableConcept(null, e);
39943        closeArray();
39944      };
39945      if (element.hasReasonReference()) {
39946        openArray("reasonReference");
39947        for (Reference e : element.getReasonReference()) 
39948          composeReference(null, e);
39949        closeArray();
39950      };
39951      if (element.hasRequest()) {
39952        composeReference("request", element.getRequest());
39953      }
39954      if (element.hasDevice()) {
39955        openArray("device");
39956        for (Reference e : element.getDevice()) 
39957          composeReference(null, e);
39958        closeArray();
39959      };
39960      if (element.hasNote()) {
39961        openArray("note");
39962        for (Annotation e : element.getNote()) 
39963          composeAnnotation(null, e);
39964        closeArray();
39965      };
39966      if (element.hasDosage()) {
39967        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
39968      }
39969      if (element.hasEventHistory()) {
39970        openArray("eventHistory");
39971        for (Reference e : element.getEventHistory()) 
39972          composeReference(null, e);
39973        closeArray();
39974      };
39975  }
39976
39977  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
39978    if (element != null) {
39979      open(name);
39980      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
39981      close();
39982    }
39983  }
39984
39985  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
39986      composeBackbone(element);
39987      if (element.hasFunction()) {
39988        composeCodeableConcept("function", element.getFunction());
39989      }
39990      if (element.hasActor()) {
39991        composeReference("actor", element.getActor());
39992      }
39993  }
39994
39995  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
39996    if (element != null) {
39997      open(name);
39998      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
39999      close();
40000    }
40001  }
40002
40003  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
40004      composeBackbone(element);
40005      if (element.hasTextElement()) {
40006        composeStringCore("text", element.getTextElement(), false);
40007        composeStringExtras("text", element.getTextElement(), false);
40008      }
40009      if (element.hasSite()) {
40010        composeCodeableConcept("site", element.getSite());
40011      }
40012      if (element.hasRoute()) {
40013        composeCodeableConcept("route", element.getRoute());
40014      }
40015      if (element.hasMethod()) {
40016        composeCodeableConcept("method", element.getMethod());
40017      }
40018      if (element.hasDose()) {
40019        composeSimpleQuantity("dose", element.getDose());
40020      }
40021      if (element.hasRate()) {
40022        composeType("rate", element.getRate());
40023      }
40024  }
40025
40026  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
40027    if (element != null) {
40028      prop("resourceType", name);
40029      composeMedicationDispenseInner(element);
40030    }
40031  }
40032
40033  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
40034      composeDomainResourceElements(element);
40035      if (element.hasIdentifier()) {
40036        openArray("identifier");
40037        for (Identifier e : element.getIdentifier()) 
40038          composeIdentifier(null, e);
40039        closeArray();
40040      };
40041      if (element.hasPartOf()) {
40042        openArray("partOf");
40043        for (Reference e : element.getPartOf()) 
40044          composeReference(null, e);
40045        closeArray();
40046      };
40047      if (element.hasStatusElement()) {
40048        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
40049        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
40050      }
40051      if (element.hasCategory()) {
40052        composeCodeableConcept("category", element.getCategory());
40053      }
40054      if (element.hasMedication()) {
40055        composeType("medication", element.getMedication());
40056      }
40057      if (element.hasSubject()) {
40058        composeReference("subject", element.getSubject());
40059      }
40060      if (element.hasContext()) {
40061        composeReference("context", element.getContext());
40062      }
40063      if (element.hasSupportingInformation()) {
40064        openArray("supportingInformation");
40065        for (Reference e : element.getSupportingInformation()) 
40066          composeReference(null, e);
40067        closeArray();
40068      };
40069      if (element.hasPerformer()) {
40070        openArray("performer");
40071        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
40072          composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
40073        closeArray();
40074      };
40075      if (element.hasLocation()) {
40076        composeReference("location", element.getLocation());
40077      }
40078      if (element.hasAuthorizingPrescription()) {
40079        openArray("authorizingPrescription");
40080        for (Reference e : element.getAuthorizingPrescription()) 
40081          composeReference(null, e);
40082        closeArray();
40083      };
40084      if (element.hasType()) {
40085        composeCodeableConcept("type", element.getType());
40086      }
40087      if (element.hasQuantity()) {
40088        composeSimpleQuantity("quantity", element.getQuantity());
40089      }
40090      if (element.hasDaysSupply()) {
40091        composeSimpleQuantity("daysSupply", element.getDaysSupply());
40092      }
40093      if (element.hasWhenPreparedElement()) {
40094        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
40095        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
40096      }
40097      if (element.hasWhenHandedOverElement()) {
40098        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
40099        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
40100      }
40101      if (element.hasDestination()) {
40102        composeReference("destination", element.getDestination());
40103      }
40104      if (element.hasReceiver()) {
40105        openArray("receiver");
40106        for (Reference e : element.getReceiver()) 
40107          composeReference(null, e);
40108        closeArray();
40109      };
40110      if (element.hasNote()) {
40111        openArray("note");
40112        for (Annotation e : element.getNote()) 
40113          composeAnnotation(null, e);
40114        closeArray();
40115      };
40116      if (element.hasDosageInstruction()) {
40117        openArray("dosageInstruction");
40118        for (Dosage e : element.getDosageInstruction()) 
40119          composeDosage(null, e);
40120        closeArray();
40121      };
40122      if (element.hasSubstitution()) {
40123        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
40124      }
40125      if (element.hasDetectedIssue()) {
40126        openArray("detectedIssue");
40127        for (Reference e : element.getDetectedIssue()) 
40128          composeReference(null, e);
40129        closeArray();
40130      };
40131      if (element.hasStatusReason()) {
40132        composeType("statusReason", element.getStatusReason());
40133      }
40134      if (element.hasEventHistory()) {
40135        openArray("eventHistory");
40136        for (Reference e : element.getEventHistory()) 
40137          composeReference(null, e);
40138        closeArray();
40139      };
40140  }
40141
40142  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
40143    if (element != null) {
40144      open(name);
40145      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
40146      close();
40147    }
40148  }
40149
40150  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
40151      composeBackbone(element);
40152      if (element.hasFunction()) {
40153        composeCodeableConcept("function", element.getFunction());
40154      }
40155      if (element.hasActor()) {
40156        composeReference("actor", element.getActor());
40157      }
40158  }
40159
40160  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
40161    if (element != null) {
40162      open(name);
40163      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
40164      close();
40165    }
40166  }
40167
40168  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
40169      composeBackbone(element);
40170      if (element.hasWasSubstitutedElement()) {
40171        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
40172        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
40173      }
40174      if (element.hasType()) {
40175        composeCodeableConcept("type", element.getType());
40176      }
40177      if (element.hasReason()) {
40178        openArray("reason");
40179        for (CodeableConcept e : element.getReason()) 
40180          composeCodeableConcept(null, e);
40181        closeArray();
40182      };
40183      if (element.hasResponsibleParty()) {
40184        openArray("responsibleParty");
40185        for (Reference e : element.getResponsibleParty()) 
40186          composeReference(null, e);
40187        closeArray();
40188      };
40189  }
40190
40191  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
40192    if (element != null) {
40193      prop("resourceType", name);
40194      composeMedicationKnowledgeInner(element);
40195    }
40196  }
40197
40198  protected void composeMedicationKnowledgeInner(MedicationKnowledge element) throws IOException {
40199      composeDomainResourceElements(element);
40200      if (element.hasCode()) {
40201        composeCodeableConcept("code", element.getCode());
40202      }
40203      if (element.hasStatusElement()) {
40204        composeEnumerationCore("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
40205        composeEnumerationExtras("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
40206      }
40207      if (element.hasManufacturer()) {
40208        composeReference("manufacturer", element.getManufacturer());
40209      }
40210      if (element.hasForm()) {
40211        composeCodeableConcept("form", element.getForm());
40212      }
40213      if (element.hasAmount()) {
40214        composeSimpleQuantity("amount", element.getAmount());
40215      }
40216      if (element.hasSynonym()) {
40217        openArray("synonym");
40218        for (StringType e : element.getSynonym()) 
40219          composeStringCore(null, e, true);
40220        closeArray();
40221        if (anyHasExtras(element.getSynonym())) {
40222          openArray("_synonym");
40223          for (StringType e : element.getSynonym()) 
40224            composeStringExtras(null, e, true);
40225          closeArray();
40226        }
40227      };
40228      if (element.hasRelatedMedicationKnowledge()) {
40229        openArray("relatedMedicationKnowledge");
40230        for (Reference e : element.getRelatedMedicationKnowledge()) 
40231          composeReference(null, e);
40232        closeArray();
40233      };
40234      if (element.hasAssociatedMedication()) {
40235        composeReference("associatedMedication", element.getAssociatedMedication());
40236      }
40237      if (element.hasProductType()) {
40238        openArray("productType");
40239        for (CodeableConcept e : element.getProductType()) 
40240          composeCodeableConcept(null, e);
40241        closeArray();
40242      };
40243      if (element.hasMonograph()) {
40244        openArray("monograph");
40245        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
40246          composeMedicationKnowledgeMedicationKnowledgeMonographComponent(null, e);
40247        closeArray();
40248      };
40249      if (element.hasHalfLifePeriod()) {
40250        composeDuration("halfLifePeriod", element.getHalfLifePeriod());
40251      }
40252      if (element.hasIngredient()) {
40253        openArray("ingredient");
40254        for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient()) 
40255          composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(null, e);
40256        closeArray();
40257      };
40258      if (element.hasPreparationInstructionElement()) {
40259        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
40260        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
40261      }
40262      if (element.hasIntendedRoute()) {
40263        openArray("intendedRoute");
40264        for (CodeableConcept e : element.getIntendedRoute()) 
40265          composeCodeableConcept(null, e);
40266        closeArray();
40267      };
40268      if (element.hasCost()) {
40269        openArray("cost");
40270        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
40271          composeMedicationKnowledgeMedicationKnowledgeCostComponent(null, e);
40272        closeArray();
40273      };
40274      if (element.hasMonitoringProgram()) {
40275        openArray("monitoringProgram");
40276        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
40277          composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(null, e);
40278        closeArray();
40279      };
40280      if (element.hasAdministrationGuidelines()) {
40281        openArray("administrationGuidelines");
40282        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent e : element.getAdministrationGuidelines()) 
40283          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(null, e);
40284        closeArray();
40285      };
40286      if (element.hasMedicineClassification()) {
40287        openArray("medicineClassification");
40288        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
40289          composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(null, e);
40290        closeArray();
40291      };
40292      if (element.hasPackaging()) {
40293        composeMedicationKnowledgeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
40294      }
40295      if (element.hasDrugCharacteristic()) {
40296        openArray("drugCharacteristic");
40297        for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
40298          composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(null, e);
40299        closeArray();
40300      };
40301      if (element.hasContraindication()) {
40302        openArray("contraindication");
40303        for (Reference e : element.getContraindication()) 
40304          composeReference(null, e);
40305        closeArray();
40306      };
40307  }
40308
40309  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
40310    if (element != null) {
40311      open(name);
40312      composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(element);
40313      close();
40314    }
40315  }
40316
40317  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
40318      composeBackbone(element);
40319      if (element.hasType()) {
40320        composeCodeableConcept("type", element.getType());
40321      }
40322      if (element.hasDocument()) {
40323        composeReference("document", element.getDocument());
40324      }
40325  }
40326
40327  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
40328    if (element != null) {
40329      open(name);
40330      composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(element);
40331      close();
40332    }
40333  }
40334
40335  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
40336      composeBackbone(element);
40337      if (element.hasItem()) {
40338        composeType("item", element.getItem());
40339      }
40340      if (element.hasIsActiveElement()) {
40341        composeBooleanCore("isActive", element.getIsActiveElement(), false);
40342        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
40343      }
40344      if (element.hasStrength()) {
40345        composeRatio("strength", element.getStrength());
40346      }
40347  }
40348
40349  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
40350    if (element != null) {
40351      open(name);
40352      composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(element);
40353      close();
40354    }
40355  }
40356
40357  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
40358      composeBackbone(element);
40359      if (element.hasTypeElement()) {
40360        composeStringCore("type", element.getTypeElement(), false);
40361        composeStringExtras("type", element.getTypeElement(), false);
40362      }
40363      if (element.hasSourceElement()) {
40364        composeStringCore("source", element.getSourceElement(), false);
40365        composeStringExtras("source", element.getSourceElement(), false);
40366      }
40367      if (element.hasCost()) {
40368        composeMoney("cost", element.getCost());
40369      }
40370  }
40371
40372  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
40373    if (element != null) {
40374      open(name);
40375      composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(element);
40376      close();
40377    }
40378  }
40379
40380  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
40381      composeBackbone(element);
40382      if (element.hasType()) {
40383        composeCodeableConcept("type", element.getType());
40384      }
40385      if (element.hasNameElement()) {
40386        composeStringCore("name", element.getNameElement(), false);
40387        composeStringExtras("name", element.getNameElement(), false);
40388      }
40389  }
40390
40391  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
40392    if (element != null) {
40393      open(name);
40394      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(element);
40395      close();
40396    }
40397  }
40398
40399  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
40400      composeBackbone(element);
40401      if (element.hasDosage()) {
40402        openArray("dosage");
40403        for (Dosage e : element.getDosage()) 
40404          composeDosage(null, e);
40405        closeArray();
40406      };
40407      if (element.hasIndication()) {
40408        composeType("indication", element.getIndication());
40409      }
40410      if (element.hasPatientCharacteristics()) {
40411        openArray("patientCharacteristics");
40412        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent e : element.getPatientCharacteristics()) 
40413          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(null, e);
40414        closeArray();
40415      };
40416  }
40417
40418  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
40419    if (element != null) {
40420      open(name);
40421      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(element);
40422      close();
40423    }
40424  }
40425
40426  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
40427      composeBackbone(element);
40428      if (element.hasCharacteristic()) {
40429        composeType("characteristic", element.getCharacteristic());
40430      }
40431      if (element.hasValue()) {
40432        openArray("value");
40433        for (StringType e : element.getValue()) 
40434          composeStringCore(null, e, true);
40435        closeArray();
40436        if (anyHasExtras(element.getValue())) {
40437          openArray("_value");
40438          for (StringType e : element.getValue()) 
40439            composeStringExtras(null, e, true);
40440          closeArray();
40441        }
40442      };
40443  }
40444
40445  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
40446    if (element != null) {
40447      open(name);
40448      composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(element);
40449      close();
40450    }
40451  }
40452
40453  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
40454      composeBackbone(element);
40455      if (element.hasType()) {
40456        composeCodeableConcept("type", element.getType());
40457      }
40458      if (element.hasClassification()) {
40459        openArray("classification");
40460        for (CodeableConcept e : element.getClassification()) 
40461          composeCodeableConcept(null, e);
40462        closeArray();
40463      };
40464  }
40465
40466  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
40467    if (element != null) {
40468      open(name);
40469      composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(element);
40470      close();
40471    }
40472  }
40473
40474  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
40475      composeBackbone(element);
40476      if (element.hasType()) {
40477        composeCodeableConcept("type", element.getType());
40478      }
40479      if (element.hasQuantity()) {
40480        composeSimpleQuantity("quantity", element.getQuantity());
40481      }
40482  }
40483
40484  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
40485    if (element != null) {
40486      open(name);
40487      composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(element);
40488      close();
40489    }
40490  }
40491
40492  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
40493      composeBackbone(element);
40494      if (element.hasType()) {
40495        composeCodeableConcept("type", element.getType());
40496      }
40497      if (element.hasValue()) {
40498        composeType("value", element.getValue());
40499      }
40500  }
40501
40502  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
40503    if (element != null) {
40504      prop("resourceType", name);
40505      composeMedicationRequestInner(element);
40506    }
40507  }
40508
40509  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
40510      composeDomainResourceElements(element);
40511      if (element.hasIdentifier()) {
40512        openArray("identifier");
40513        for (Identifier e : element.getIdentifier()) 
40514          composeIdentifier(null, e);
40515        closeArray();
40516      };
40517      if (element.hasStatusElement()) {
40518        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
40519        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
40520      }
40521      if (element.hasIntentElement()) {
40522        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
40523        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
40524      }
40525      if (element.hasCategory()) {
40526        openArray("category");
40527        for (CodeableConcept e : element.getCategory()) 
40528          composeCodeableConcept(null, e);
40529        closeArray();
40530      };
40531      if (element.hasPriorityElement()) {
40532        composeEnumerationCore("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
40533        composeEnumerationExtras("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
40534      }
40535      if (element.hasMedication()) {
40536        composeType("medication", element.getMedication());
40537      }
40538      if (element.hasSubject()) {
40539        composeReference("subject", element.getSubject());
40540      }
40541      if (element.hasContext()) {
40542        composeReference("context", element.getContext());
40543      }
40544      if (element.hasSupportingInformation()) {
40545        openArray("supportingInformation");
40546        for (Reference e : element.getSupportingInformation()) 
40547          composeReference(null, e);
40548        closeArray();
40549      };
40550      if (element.hasAuthoredOnElement()) {
40551        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
40552        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
40553      }
40554      if (element.hasRequester()) {
40555        composeReference("requester", element.getRequester());
40556      }
40557      if (element.hasPerformer()) {
40558        composeReference("performer", element.getPerformer());
40559      }
40560      if (element.hasPerformerType()) {
40561        composeCodeableConcept("performerType", element.getPerformerType());
40562      }
40563      if (element.hasRecorder()) {
40564        composeReference("recorder", element.getRecorder());
40565      }
40566      if (element.hasReasonCode()) {
40567        openArray("reasonCode");
40568        for (CodeableConcept e : element.getReasonCode()) 
40569          composeCodeableConcept(null, e);
40570        closeArray();
40571      };
40572      if (element.hasReasonReference()) {
40573        openArray("reasonReference");
40574        for (Reference e : element.getReasonReference()) 
40575          composeReference(null, e);
40576        closeArray();
40577      };
40578      if (element.hasInstantiates()) {
40579        openArray("instantiates");
40580        for (UriType e : element.getInstantiates()) 
40581          composeUriCore(null, e, true);
40582        closeArray();
40583        if (anyHasExtras(element.getInstantiates())) {
40584          openArray("_instantiates");
40585          for (UriType e : element.getInstantiates()) 
40586            composeUriExtras(null, e, true);
40587          closeArray();
40588        }
40589      };
40590      if (element.hasBasedOn()) {
40591        openArray("basedOn");
40592        for (Reference e : element.getBasedOn()) 
40593          composeReference(null, e);
40594        closeArray();
40595      };
40596      if (element.hasGroupIdentifier()) {
40597        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
40598      }
40599      if (element.hasStatusReason()) {
40600        composeCodeableConcept("statusReason", element.getStatusReason());
40601      }
40602      if (element.hasInsurance()) {
40603        openArray("insurance");
40604        for (Reference e : element.getInsurance()) 
40605          composeReference(null, e);
40606        closeArray();
40607      };
40608      if (element.hasNote()) {
40609        openArray("note");
40610        for (Annotation e : element.getNote()) 
40611          composeAnnotation(null, e);
40612        closeArray();
40613      };
40614      if (element.hasDosageInstruction()) {
40615        openArray("dosageInstruction");
40616        for (Dosage e : element.getDosageInstruction()) 
40617          composeDosage(null, e);
40618        closeArray();
40619      };
40620      if (element.hasDispenseRequest()) {
40621        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
40622      }
40623      if (element.hasSubstitution()) {
40624        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
40625      }
40626      if (element.hasPriorPrescription()) {
40627        composeReference("priorPrescription", element.getPriorPrescription());
40628      }
40629      if (element.hasDetectedIssue()) {
40630        openArray("detectedIssue");
40631        for (Reference e : element.getDetectedIssue()) 
40632          composeReference(null, e);
40633        closeArray();
40634      };
40635      if (element.hasEventHistory()) {
40636        openArray("eventHistory");
40637        for (Reference e : element.getEventHistory()) 
40638          composeReference(null, e);
40639        closeArray();
40640      };
40641  }
40642
40643  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
40644    if (element != null) {
40645      open(name);
40646      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
40647      close();
40648    }
40649  }
40650
40651  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
40652      composeBackbone(element);
40653      if (element.hasValidityPeriod()) {
40654        composePeriod("validityPeriod", element.getValidityPeriod());
40655      }
40656      if (element.hasNumberOfRepeatsAllowedElement()) {
40657        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
40658        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
40659      }
40660      if (element.hasQuantity()) {
40661        composeSimpleQuantity("quantity", element.getQuantity());
40662      }
40663      if (element.hasExpectedSupplyDuration()) {
40664        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
40665      }
40666      if (element.hasPerformer()) {
40667        composeReference("performer", element.getPerformer());
40668      }
40669  }
40670
40671  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
40672    if (element != null) {
40673      open(name);
40674      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
40675      close();
40676    }
40677  }
40678
40679  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
40680      composeBackbone(element);
40681      if (element.hasAllowedElement()) {
40682        composeBooleanCore("allowed", element.getAllowedElement(), false);
40683        composeBooleanExtras("allowed", element.getAllowedElement(), false);
40684      }
40685      if (element.hasReason()) {
40686        composeCodeableConcept("reason", element.getReason());
40687      }
40688  }
40689
40690  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
40691    if (element != null) {
40692      prop("resourceType", name);
40693      composeMedicationStatementInner(element);
40694    }
40695  }
40696
40697  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
40698      composeDomainResourceElements(element);
40699      if (element.hasIdentifier()) {
40700        openArray("identifier");
40701        for (Identifier e : element.getIdentifier()) 
40702          composeIdentifier(null, e);
40703        closeArray();
40704      };
40705      if (element.hasBasedOn()) {
40706        openArray("basedOn");
40707        for (Reference e : element.getBasedOn()) 
40708          composeReference(null, e);
40709        closeArray();
40710      };
40711      if (element.hasPartOf()) {
40712        openArray("partOf");
40713        for (Reference e : element.getPartOf()) 
40714          composeReference(null, e);
40715        closeArray();
40716      };
40717      if (element.hasStatusElement()) {
40718        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
40719        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
40720      }
40721      if (element.hasStatusReason()) {
40722        openArray("statusReason");
40723        for (CodeableConcept e : element.getStatusReason()) 
40724          composeCodeableConcept(null, e);
40725        closeArray();
40726      };
40727      if (element.hasCategory()) {
40728        composeCodeableConcept("category", element.getCategory());
40729      }
40730      if (element.hasMedication()) {
40731        composeType("medication", element.getMedication());
40732      }
40733      if (element.hasSubject()) {
40734        composeReference("subject", element.getSubject());
40735      }
40736      if (element.hasContext()) {
40737        composeReference("context", element.getContext());
40738      }
40739      if (element.hasEffective()) {
40740        composeType("effective", element.getEffective());
40741      }
40742      if (element.hasDateAssertedElement()) {
40743        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
40744        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
40745      }
40746      if (element.hasInformationSource()) {
40747        composeReference("informationSource", element.getInformationSource());
40748      }
40749      if (element.hasDerivedFrom()) {
40750        openArray("derivedFrom");
40751        for (Reference e : element.getDerivedFrom()) 
40752          composeReference(null, e);
40753        closeArray();
40754      };
40755      if (element.hasReasonCode()) {
40756        openArray("reasonCode");
40757        for (CodeableConcept e : element.getReasonCode()) 
40758          composeCodeableConcept(null, e);
40759        closeArray();
40760      };
40761      if (element.hasReasonReference()) {
40762        openArray("reasonReference");
40763        for (Reference e : element.getReasonReference()) 
40764          composeReference(null, e);
40765        closeArray();
40766      };
40767      if (element.hasNote()) {
40768        openArray("note");
40769        for (Annotation e : element.getNote()) 
40770          composeAnnotation(null, e);
40771        closeArray();
40772      };
40773      if (element.hasDosage()) {
40774        openArray("dosage");
40775        for (Dosage e : element.getDosage()) 
40776          composeDosage(null, e);
40777        closeArray();
40778      };
40779  }
40780
40781  protected void composeMedicinalProduct(String name, MedicinalProduct element) throws IOException {
40782    if (element != null) {
40783      prop("resourceType", name);
40784      composeMedicinalProductInner(element);
40785    }
40786  }
40787
40788  protected void composeMedicinalProductInner(MedicinalProduct element) throws IOException {
40789      composeDomainResourceElements(element);
40790      if (element.hasIdentifier()) {
40791        composeIdentifier("identifier", element.getIdentifier());
40792      }
40793      if (element.hasType()) {
40794        composeCodeableConcept("type", element.getType());
40795      }
40796      if (element.hasCombinedPharmaceuticalDoseForm()) {
40797        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
40798      }
40799      if (element.hasAdditionalMonitoringIndicator()) {
40800        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
40801      }
40802      if (element.hasSpecialMeasures()) {
40803        openArray("specialMeasures");
40804        for (StringType e : element.getSpecialMeasures()) 
40805          composeStringCore(null, e, true);
40806        closeArray();
40807        if (anyHasExtras(element.getSpecialMeasures())) {
40808          openArray("_specialMeasures");
40809          for (StringType e : element.getSpecialMeasures()) 
40810            composeStringExtras(null, e, true);
40811          closeArray();
40812        }
40813      };
40814      if (element.hasPaediatricUseIndicator()) {
40815        composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
40816      }
40817      if (element.hasOrphanDesignationStatus()) {
40818        composeCodeableConcept("orphanDesignationStatus", element.getOrphanDesignationStatus());
40819      }
40820      if (element.hasProductClassification()) {
40821        openArray("productClassification");
40822        for (CodeableConcept e : element.getProductClassification()) 
40823          composeCodeableConcept(null, e);
40824        closeArray();
40825      };
40826      if (element.hasMarketingAuthorization()) {
40827        composeReference("marketingAuthorization", element.getMarketingAuthorization());
40828      }
40829      if (element.hasPackagedMedicinalProduct()) {
40830        openArray("packagedMedicinalProduct");
40831        for (Reference e : element.getPackagedMedicinalProduct()) 
40832          composeReference(null, e);
40833        closeArray();
40834      };
40835      if (element.hasPharmaceuticalProduct()) {
40836        openArray("pharmaceuticalProduct");
40837        for (Reference e : element.getPharmaceuticalProduct()) 
40838          composeReference(null, e);
40839        closeArray();
40840      };
40841      if (element.hasClinicalParticulars()) {
40842        openArray("clinicalParticulars");
40843        for (Reference e : element.getClinicalParticulars()) 
40844          composeReference(null, e);
40845        closeArray();
40846      };
40847      if (element.hasAttachedDocument()) {
40848        openArray("attachedDocument");
40849        for (Reference e : element.getAttachedDocument()) 
40850          composeReference(null, e);
40851        closeArray();
40852      };
40853      if (element.hasMasterFile()) {
40854        openArray("masterFile");
40855        for (Reference e : element.getMasterFile()) 
40856          composeReference(null, e);
40857        closeArray();
40858      };
40859      if (element.hasName()) {
40860        openArray("name");
40861        for (MedicinalProduct.MedicinalProductNameComponent e : element.getName()) 
40862          composeMedicinalProductMedicinalProductNameComponent(null, e);
40863        closeArray();
40864      };
40865      if (element.hasCrossReference()) {
40866        openArray("crossReference");
40867        for (Identifier e : element.getCrossReference()) 
40868          composeIdentifier(null, e);
40869        closeArray();
40870      };
40871      if (element.hasManufacturingBusinessOperation()) {
40872        openArray("manufacturingBusinessOperation");
40873        for (MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent e : element.getManufacturingBusinessOperation()) 
40874          composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(null, e);
40875        closeArray();
40876      };
40877  }
40878
40879  protected void composeMedicinalProductMedicinalProductNameComponent(String name, MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
40880    if (element != null) {
40881      open(name);
40882      composeMedicinalProductMedicinalProductNameComponentInner(element);
40883      close();
40884    }
40885  }
40886
40887  protected void composeMedicinalProductMedicinalProductNameComponentInner(MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
40888      composeBackbone(element);
40889      if (element.hasFullNameElement()) {
40890        composeStringCore("fullName", element.getFullNameElement(), false);
40891        composeStringExtras("fullName", element.getFullNameElement(), false);
40892      }
40893      if (element.hasNamePart()) {
40894        openArray("namePart");
40895        for (MedicinalProduct.MedicinalProductNameNamePartComponent e : element.getNamePart()) 
40896          composeMedicinalProductMedicinalProductNameNamePartComponent(null, e);
40897        closeArray();
40898      };
40899      if (element.hasCountryLanguage()) {
40900        openArray("countryLanguage");
40901        for (MedicinalProduct.MedicinalProductNameCountryLanguageComponent e : element.getCountryLanguage()) 
40902          composeMedicinalProductMedicinalProductNameCountryLanguageComponent(null, e);
40903        closeArray();
40904      };
40905  }
40906
40907  protected void composeMedicinalProductMedicinalProductNameNamePartComponent(String name, MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
40908    if (element != null) {
40909      open(name);
40910      composeMedicinalProductMedicinalProductNameNamePartComponentInner(element);
40911      close();
40912    }
40913  }
40914
40915  protected void composeMedicinalProductMedicinalProductNameNamePartComponentInner(MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
40916      composeBackbone(element);
40917      if (element.hasPartElement()) {
40918        composeStringCore("part", element.getPartElement(), false);
40919        composeStringExtras("part", element.getPartElement(), false);
40920      }
40921      if (element.hasType()) {
40922        composeCoding("type", element.getType());
40923      }
40924  }
40925
40926  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponent(String name, MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
40927    if (element != null) {
40928      open(name);
40929      composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(element);
40930      close();
40931    }
40932  }
40933
40934  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
40935      composeBackbone(element);
40936      if (element.hasCountry()) {
40937        composeCodeableConcept("country", element.getCountry());
40938      }
40939      if (element.hasJurisdiction()) {
40940        composeCodeableConcept("jurisdiction", element.getJurisdiction());
40941      }
40942      if (element.hasLanguage()) {
40943        composeCodeableConcept("language", element.getLanguage());
40944      }
40945  }
40946
40947  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(String name, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
40948    if (element != null) {
40949      open(name);
40950      composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(element);
40951      close();
40952    }
40953  }
40954
40955  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
40956      composeBackbone(element);
40957      if (element.hasOperationType()) {
40958        composeCodeableConcept("operationType", element.getOperationType());
40959      }
40960      if (element.hasAuthorisationReferenceNumber()) {
40961        composeIdentifier("authorisationReferenceNumber", element.getAuthorisationReferenceNumber());
40962      }
40963      if (element.hasEffectiveDateElement()) {
40964        composeDateTimeCore("effectiveDate", element.getEffectiveDateElement(), false);
40965        composeDateTimeExtras("effectiveDate", element.getEffectiveDateElement(), false);
40966      }
40967      if (element.hasConfidentialityIndicator()) {
40968        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
40969      }
40970      if (element.hasManufacturer()) {
40971        openArray("manufacturer");
40972        for (Reference e : element.getManufacturer()) 
40973          composeReference(null, e);
40974        closeArray();
40975      };
40976      if (element.hasRegulator()) {
40977        composeReference("regulator", element.getRegulator());
40978      }
40979  }
40980
40981  protected void composeMedicinalProductAuthorization(String name, MedicinalProductAuthorization element) throws IOException {
40982    if (element != null) {
40983      prop("resourceType", name);
40984      composeMedicinalProductAuthorizationInner(element);
40985    }
40986  }
40987
40988  protected void composeMedicinalProductAuthorizationInner(MedicinalProductAuthorization element) throws IOException {
40989      composeDomainResourceElements(element);
40990      if (element.hasIdentifier()) {
40991        composeIdentifier("identifier", element.getIdentifier());
40992      }
40993      if (element.hasCountry()) {
40994        openArray("country");
40995        for (CodeableConcept e : element.getCountry()) 
40996          composeCodeableConcept(null, e);
40997        closeArray();
40998      };
40999      if (element.hasLegalStatusOfSupply()) {
41000        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
41001      }
41002      if (element.hasStatus()) {
41003        composeCodeableConcept("status", element.getStatus());
41004      }
41005      if (element.hasStatusDateElement()) {
41006        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
41007        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
41008      }
41009      if (element.hasRestoreDateElement()) {
41010        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
41011        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
41012      }
41013      if (element.hasValidityPeriod()) {
41014        composePeriod("validityPeriod", element.getValidityPeriod());
41015      }
41016      if (element.hasDataExclusivityPeriod()) {
41017        composePeriod("dataExclusivityPeriod", element.getDataExclusivityPeriod());
41018      }
41019      if (element.hasDateOfFirstAuthorizationElement()) {
41020        composeDateTimeCore("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
41021        composeDateTimeExtras("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
41022      }
41023      if (element.hasInternationalBirthDateElement()) {
41024        composeDateTimeCore("internationalBirthDate", element.getInternationalBirthDateElement(), false);
41025        composeDateTimeExtras("internationalBirthDate", element.getInternationalBirthDateElement(), false);
41026      }
41027      if (element.hasJurisdictionalAuthorization()) {
41028        openArray("jurisdictionalAuthorization");
41029        for (MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent e : element.getJurisdictionalAuthorization()) 
41030          composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(null, e);
41031        closeArray();
41032      };
41033      if (element.hasHolder()) {
41034        composeReference("holder", element.getHolder());
41035      }
41036      if (element.hasRegulator()) {
41037        composeReference("regulator", element.getRegulator());
41038      }
41039      if (element.hasProcedure()) {
41040        composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent("procedure", element.getProcedure());
41041      }
41042      if (element.hasMarketingStatus()) {
41043        openArray("marketingStatus");
41044        for (MarketingStatus e : element.getMarketingStatus()) 
41045          composeMarketingStatus(null, e);
41046        closeArray();
41047      };
41048  }
41049
41050  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
41051    if (element != null) {
41052      open(name);
41053      composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(element);
41054      close();
41055    }
41056  }
41057
41058  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
41059      composeBackbone(element);
41060      if (element.hasCountry()) {
41061        composeCodeableConcept("country", element.getCountry());
41062      }
41063      if (element.hasJurisdiction()) {
41064        composeCodeableConcept("jurisdiction", element.getJurisdiction());
41065      }
41066      if (element.hasNumber()) {
41067        composeIdentifier("number", element.getNumber());
41068      }
41069      if (element.hasLegalStatusOfSupply()) {
41070        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
41071      }
41072  }
41073
41074  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
41075    if (element != null) {
41076      open(name);
41077      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(element);
41078      close();
41079    }
41080  }
41081
41082  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
41083      composeBackbone(element);
41084      if (element.hasNumber()) {
41085        composeIdentifier("number", element.getNumber());
41086      }
41087      if (element.hasType()) {
41088        composeCodeableConcept("type", element.getType());
41089      }
41090      if (element.hasDate()) {
41091        composePeriod("date", element.getDate());
41092      }
41093      if (element.hasApplication()) {
41094        openArray("application");
41095        for (MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureApplicationComponent e : element.getApplication()) 
41096          composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureApplicationComponent(null, e);
41097        closeArray();
41098      };
41099  }
41100
41101  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureApplicationComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureApplicationComponent element) throws IOException {
41102    if (element != null) {
41103      open(name);
41104      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureApplicationComponentInner(element);
41105      close();
41106    }
41107  }
41108
41109  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureApplicationComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureApplicationComponent element) throws IOException {
41110      composeBackbone(element);
41111      if (element.hasNumber()) {
41112        composeIdentifier("number", element.getNumber());
41113      }
41114      if (element.hasType()) {
41115        composeCodeableConcept("type", element.getType());
41116      }
41117      if (element.hasDateElement()) {
41118        composeDateTimeCore("date", element.getDateElement(), false);
41119        composeDateTimeExtras("date", element.getDateElement(), false);
41120      }
41121  }
41122
41123  protected void composeMedicinalProductClinicals(String name, MedicinalProductClinicals element) throws IOException {
41124    if (element != null) {
41125      prop("resourceType", name);
41126      composeMedicinalProductClinicalsInner(element);
41127    }
41128  }
41129
41130  protected void composeMedicinalProductClinicalsInner(MedicinalProductClinicals element) throws IOException {
41131      composeDomainResourceElements(element);
41132      if (element.hasUndesirableEffects()) {
41133        openArray("undesirableEffects");
41134        for (MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent e : element.getUndesirableEffects()) 
41135          composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(null, e);
41136        closeArray();
41137      };
41138      if (element.hasTherapeuticIndication()) {
41139        openArray("therapeuticIndication");
41140        for (MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent e : element.getTherapeuticIndication()) 
41141          composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(null, e);
41142        closeArray();
41143      };
41144      if (element.hasContraindication()) {
41145        openArray("contraindication");
41146        for (MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent e : element.getContraindication()) 
41147          composeMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponent(null, e);
41148        closeArray();
41149      };
41150      if (element.hasInteractions()) {
41151        openArray("interactions");
41152        for (MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent e : element.getInteractions()) 
41153          composeMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponent(null, e);
41154        closeArray();
41155      };
41156  }
41157
41158  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent element) throws IOException {
41159    if (element != null) {
41160      open(name);
41161      composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponentInner(element);
41162      close();
41163    }
41164  }
41165
41166  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent element) throws IOException {
41167      composeBackbone(element);
41168      if (element.hasSymptomConditionEffect()) {
41169        composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
41170      }
41171      if (element.hasClassification()) {
41172        composeCodeableConcept("classification", element.getClassification());
41173      }
41174      if (element.hasFrequencyOfOccurrence()) {
41175        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
41176      }
41177      if (element.hasPopulation()) {
41178        openArray("population");
41179        for (MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent e : element.getPopulation()) 
41180          composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(null, e);
41181        closeArray();
41182      };
41183  }
41184
41185  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent element) throws IOException {
41186    if (element != null) {
41187      open(name);
41188      composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponentInner(element);
41189      close();
41190    }
41191  }
41192
41193  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent element) throws IOException {
41194      composeBackbone(element);
41195      if (element.hasAge()) {
41196        composeType("age", element.getAge());
41197      }
41198      if (element.hasGender()) {
41199        composeCodeableConcept("gender", element.getGender());
41200      }
41201      if (element.hasRace()) {
41202        composeCodeableConcept("race", element.getRace());
41203      }
41204      if (element.hasPhysiologicalCondition()) {
41205        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
41206      }
41207  }
41208
41209  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent element) throws IOException {
41210    if (element != null) {
41211      open(name);
41212      composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponentInner(element);
41213      close();
41214    }
41215  }
41216
41217  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent element) throws IOException {
41218      composeBackbone(element);
41219      if (element.hasDiseaseSymptomProcedure()) {
41220        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
41221      }
41222      if (element.hasDiseaseStatus()) {
41223        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
41224      }
41225      if (element.hasComorbidity()) {
41226        openArray("comorbidity");
41227        for (CodeableConcept e : element.getComorbidity()) 
41228          composeCodeableConcept(null, e);
41229        closeArray();
41230      };
41231      if (element.hasIntendedEffect()) {
41232        composeCodeableConcept("intendedEffect", element.getIntendedEffect());
41233      }
41234      if (element.hasDuration()) {
41235        composeQuantity("duration", element.getDuration());
41236      }
41237      if (element.hasUndesirableEffects()) {
41238        openArray("undesirableEffects");
41239        for (MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent e : element.getUndesirableEffects()) 
41240          composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(null, e);
41241        closeArray();
41242      };
41243      if (element.hasOtherTherapy()) {
41244        openArray("otherTherapy");
41245        for (MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent e : element.getOtherTherapy()) 
41246          composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(null, e);
41247        closeArray();
41248      };
41249      if (element.hasPopulation()) {
41250        openArray("population");
41251        for (MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent e : element.getPopulation()) 
41252          composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(null, e);
41253        closeArray();
41254      };
41255  }
41256
41257  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent element) throws IOException {
41258    if (element != null) {
41259      open(name);
41260      composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponentInner(element);
41261      close();
41262    }
41263  }
41264
41265  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent element) throws IOException {
41266      composeBackbone(element);
41267      if (element.hasTherapyRelationshipType()) {
41268        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
41269      }
41270      if (element.hasMedication()) {
41271        composeType("medication", element.getMedication());
41272      }
41273  }
41274
41275  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent element) throws IOException {
41276    if (element != null) {
41277      open(name);
41278      composeMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponentInner(element);
41279      close();
41280    }
41281  }
41282
41283  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent element) throws IOException {
41284      composeBackbone(element);
41285      if (element.hasDisease()) {
41286        composeCodeableConcept("disease", element.getDisease());
41287      }
41288      if (element.hasDiseaseStatus()) {
41289        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
41290      }
41291      if (element.hasComorbidity()) {
41292        openArray("comorbidity");
41293        for (CodeableConcept e : element.getComorbidity()) 
41294          composeCodeableConcept(null, e);
41295        closeArray();
41296      };
41297      if (element.hasTherapeuticIndication()) {
41298        openArray("therapeuticIndication");
41299        for (MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent e : element.getTherapeuticIndication()) 
41300          composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(null, e);
41301        closeArray();
41302      };
41303      if (element.hasOtherTherapy()) {
41304        openArray("otherTherapy");
41305        for (MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent e : element.getOtherTherapy()) 
41306          composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(null, e);
41307        closeArray();
41308      };
41309      if (element.hasPopulation()) {
41310        openArray("population");
41311        for (MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent e : element.getPopulation()) 
41312          composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(null, e);
41313        closeArray();
41314      };
41315  }
41316
41317  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent element) throws IOException {
41318    if (element != null) {
41319      open(name);
41320      composeMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponentInner(element);
41321      close();
41322    }
41323  }
41324
41325  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent element) throws IOException {
41326      composeBackbone(element);
41327      if (element.hasInteractant()) {
41328        openArray("interactant");
41329        for (CodeableConcept e : element.getInteractant()) 
41330          composeCodeableConcept(null, e);
41331        closeArray();
41332      };
41333      if (element.hasType()) {
41334        composeCodeableConcept("type", element.getType());
41335      }
41336      if (element.hasEffect()) {
41337        composeCodeableConcept("effect", element.getEffect());
41338      }
41339      if (element.hasIncidence()) {
41340        composeCodeableConcept("incidence", element.getIncidence());
41341      }
41342      if (element.hasManagement()) {
41343        composeCodeableConcept("management", element.getManagement());
41344      }
41345  }
41346
41347  protected void composeMedicinalProductDeviceSpec(String name, MedicinalProductDeviceSpec element) throws IOException {
41348    if (element != null) {
41349      prop("resourceType", name);
41350      composeMedicinalProductDeviceSpecInner(element);
41351    }
41352  }
41353
41354  protected void composeMedicinalProductDeviceSpecInner(MedicinalProductDeviceSpec element) throws IOException {
41355      composeDomainResourceElements(element);
41356      if (element.hasIdentifier()) {
41357        composeIdentifier("identifier", element.getIdentifier());
41358      }
41359      if (element.hasType()) {
41360        composeCodeableConcept("type", element.getType());
41361      }
41362      if (element.hasTradeNameElement()) {
41363        composeStringCore("tradeName", element.getTradeNameElement(), false);
41364        composeStringExtras("tradeName", element.getTradeNameElement(), false);
41365      }
41366      if (element.hasQuantity()) {
41367        composeQuantity("quantity", element.getQuantity());
41368      }
41369      if (element.hasListingNumberElement()) {
41370        composeStringCore("listingNumber", element.getListingNumberElement(), false);
41371        composeStringExtras("listingNumber", element.getListingNumberElement(), false);
41372      }
41373      if (element.hasModelNumberElement()) {
41374        composeStringCore("modelNumber", element.getModelNumberElement(), false);
41375        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
41376      }
41377      if (element.hasSterilityIndicator()) {
41378        composeCodeableConcept("sterilityIndicator", element.getSterilityIndicator());
41379      }
41380      if (element.hasSterilisationRequirement()) {
41381        composeCodeableConcept("sterilisationRequirement", element.getSterilisationRequirement());
41382      }
41383      if (element.hasUsage()) {
41384        composeCodeableConcept("usage", element.getUsage());
41385      }
41386      if (element.hasNomenclature()) {
41387        openArray("nomenclature");
41388        for (CodeableConcept e : element.getNomenclature()) 
41389          composeCodeableConcept(null, e);
41390        closeArray();
41391      };
41392      if (element.hasShelfLife()) {
41393        openArray("shelfLife");
41394        for (ProductShelfLife e : element.getShelfLife()) 
41395          composeProductShelfLife(null, e);
41396        closeArray();
41397      };
41398      if (element.hasPhysicalCharacteristics()) {
41399        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
41400      }
41401      if (element.hasOtherCharacteristics()) {
41402        openArray("otherCharacteristics");
41403        for (CodeableConcept e : element.getOtherCharacteristics()) 
41404          composeCodeableConcept(null, e);
41405        closeArray();
41406      };
41407      if (element.hasBatchIdentifier()) {
41408        openArray("batchIdentifier");
41409        for (Identifier e : element.getBatchIdentifier()) 
41410          composeIdentifier(null, e);
41411        closeArray();
41412      };
41413      if (element.hasManufacturer()) {
41414        openArray("manufacturer");
41415        for (Reference e : element.getManufacturer()) 
41416          composeReference(null, e);
41417        closeArray();
41418      };
41419      if (element.hasMaterial()) {
41420        openArray("material");
41421        for (MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent e : element.getMaterial()) 
41422          composeMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponent(null, e);
41423        closeArray();
41424      };
41425  }
41426
41427  protected void composeMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponent(String name, MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent element) throws IOException {
41428    if (element != null) {
41429      open(name);
41430      composeMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponentInner(element);
41431      close();
41432    }
41433  }
41434
41435  protected void composeMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponentInner(MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent element) throws IOException {
41436      composeBackbone(element);
41437      if (element.hasSubstance()) {
41438        composeCodeableConcept("substance", element.getSubstance());
41439      }
41440      if (element.hasAlternateElement()) {
41441        composeBooleanCore("alternate", element.getAlternateElement(), false);
41442        composeBooleanExtras("alternate", element.getAlternateElement(), false);
41443      }
41444      if (element.hasAllergenicIndicatorElement()) {
41445        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
41446        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
41447      }
41448  }
41449
41450  protected void composeMedicinalProductIngredient(String name, MedicinalProductIngredient element) throws IOException {
41451    if (element != null) {
41452      prop("resourceType", name);
41453      composeMedicinalProductIngredientInner(element);
41454    }
41455  }
41456
41457  protected void composeMedicinalProductIngredientInner(MedicinalProductIngredient element) throws IOException {
41458      composeDomainResourceElements(element);
41459      if (element.hasIdentifier()) {
41460        composeIdentifier("identifier", element.getIdentifier());
41461      }
41462      if (element.hasRole()) {
41463        composeCodeableConcept("role", element.getRole());
41464      }
41465      if (element.hasAllergenicIndicatorElement()) {
41466        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
41467        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
41468      }
41469      if (element.hasManufacturer()) {
41470        openArray("manufacturer");
41471        for (Reference e : element.getManufacturer()) 
41472          composeReference(null, e);
41473        closeArray();
41474      };
41475      if (element.hasSpecifiedSubstance()) {
41476        openArray("specifiedSubstance");
41477        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent e : element.getSpecifiedSubstance()) 
41478          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(null, e);
41479        closeArray();
41480      };
41481      if (element.hasSubstance()) {
41482        composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent("substance", element.getSubstance());
41483      }
41484  }
41485
41486  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
41487    if (element != null) {
41488      open(name);
41489      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(element);
41490      close();
41491    }
41492  }
41493
41494  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
41495      composeBackbone(element);
41496      if (element.hasCode()) {
41497        composeCodeableConcept("code", element.getCode());
41498      }
41499      if (element.hasGroup()) {
41500        composeCodeableConcept("group", element.getGroup());
41501      }
41502      if (element.hasConfidentiality()) {
41503        composeCodeableConcept("confidentiality", element.getConfidentiality());
41504      }
41505      if (element.hasStrength()) {
41506        openArray("strength");
41507        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
41508          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
41509        closeArray();
41510      };
41511  }
41512
41513  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
41514    if (element != null) {
41515      open(name);
41516      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(element);
41517      close();
41518    }
41519  }
41520
41521  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
41522      composeBackbone(element);
41523      if (element.hasPresentation()) {
41524        composeRatio("presentation", element.getPresentation());
41525      }
41526      if (element.hasConcentration()) {
41527        composeRatio("concentration", element.getConcentration());
41528      }
41529      if (element.hasMeasurementPointElement()) {
41530        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
41531        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
41532      }
41533      if (element.hasCountry()) {
41534        openArray("country");
41535        for (CodeableConcept e : element.getCountry()) 
41536          composeCodeableConcept(null, e);
41537        closeArray();
41538      };
41539      if (element.hasReferenceStrength()) {
41540        openArray("referenceStrength");
41541        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
41542          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(null, e);
41543        closeArray();
41544      };
41545  }
41546
41547  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
41548    if (element != null) {
41549      open(name);
41550      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(element);
41551      close();
41552    }
41553  }
41554
41555  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
41556      composeBackbone(element);
41557      if (element.hasSubstance()) {
41558        composeCodeableConcept("substance", element.getSubstance());
41559      }
41560  }
41561
41562  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
41563    if (element != null) {
41564      open(name);
41565      composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(element);
41566      close();
41567    }
41568  }
41569
41570  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
41571      composeBackbone(element);
41572      if (element.hasCode()) {
41573        composeCodeableConcept("code", element.getCode());
41574      }
41575      if (element.hasStrength()) {
41576        openArray("strength");
41577        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
41578          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
41579        closeArray();
41580      };
41581  }
41582
41583  protected void composeMedicinalProductPackaged(String name, MedicinalProductPackaged element) throws IOException {
41584    if (element != null) {
41585      prop("resourceType", name);
41586      composeMedicinalProductPackagedInner(element);
41587    }
41588  }
41589
41590  protected void composeMedicinalProductPackagedInner(MedicinalProductPackaged element) throws IOException {
41591      composeDomainResourceElements(element);
41592      if (element.hasIdentifier()) {
41593        composeIdentifier("identifier", element.getIdentifier());
41594      }
41595      if (element.hasDescriptionElement()) {
41596        composeStringCore("description", element.getDescriptionElement(), false);
41597        composeStringExtras("description", element.getDescriptionElement(), false);
41598      }
41599      if (element.hasMarketingStatus()) {
41600        openArray("marketingStatus");
41601        for (MarketingStatus e : element.getMarketingStatus()) 
41602          composeMarketingStatus(null, e);
41603        closeArray();
41604      };
41605      if (element.hasBatchIdentifier()) {
41606        openArray("batchIdentifier");
41607        for (MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent e : element.getBatchIdentifier()) 
41608          composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(null, e);
41609        closeArray();
41610      };
41611      if (element.hasPackageItem()) {
41612        openArray("packageItem");
41613        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
41614          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
41615        closeArray();
41616      };
41617  }
41618
41619  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
41620    if (element != null) {
41621      open(name);
41622      composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(element);
41623      close();
41624    }
41625  }
41626
41627  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
41628      composeBackbone(element);
41629      if (element.hasOuterPackaging()) {
41630        composeIdentifier("outerPackaging", element.getOuterPackaging());
41631      }
41632      if (element.hasImmediatePackaging()) {
41633        composeIdentifier("immediatePackaging", element.getImmediatePackaging());
41634      }
41635  }
41636
41637  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
41638    if (element != null) {
41639      open(name);
41640      composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(element);
41641      close();
41642    }
41643  }
41644
41645  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
41646      composeBackbone(element);
41647      if (element.hasIdentifier()) {
41648        openArray("identifier");
41649        for (Identifier e : element.getIdentifier()) 
41650          composeIdentifier(null, e);
41651        closeArray();
41652      };
41653      if (element.hasType()) {
41654        composeCodeableConcept("type", element.getType());
41655      }
41656      if (element.hasQuantity()) {
41657        composeQuantity("quantity", element.getQuantity());
41658      }
41659      if (element.hasMaterial()) {
41660        openArray("material");
41661        for (CodeableConcept e : element.getMaterial()) 
41662          composeCodeableConcept(null, e);
41663        closeArray();
41664      };
41665      if (element.hasAlternateMaterial()) {
41666        openArray("alternateMaterial");
41667        for (CodeableConcept e : element.getAlternateMaterial()) 
41668          composeCodeableConcept(null, e);
41669        closeArray();
41670      };
41671      if (element.hasManufacturer()) {
41672        openArray("manufacturer");
41673        for (Reference e : element.getManufacturer()) 
41674          composeReference(null, e);
41675        closeArray();
41676      };
41677      if (element.hasDevice()) {
41678        openArray("device");
41679        for (Reference e : element.getDevice()) 
41680          composeReference(null, e);
41681        closeArray();
41682      };
41683      if (element.hasManufacturedItem()) {
41684        openArray("manufacturedItem");
41685        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemManufacturedItemComponent e : element.getManufacturedItem()) 
41686          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemManufacturedItemComponent(null, e);
41687        closeArray();
41688      };
41689      if (element.hasOtherCharacteristics()) {
41690        openArray("otherCharacteristics");
41691        for (CodeableConcept e : element.getOtherCharacteristics()) 
41692          composeCodeableConcept(null, e);
41693        closeArray();
41694      };
41695      if (element.hasPackageItem()) {
41696        openArray("packageItem");
41697        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
41698          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
41699        closeArray();
41700      };
41701      if (element.hasPhysicalCharacteristics()) {
41702        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
41703      }
41704      if (element.hasShelfLifeStorage()) {
41705        openArray("shelfLifeStorage");
41706        for (ProductShelfLife e : element.getShelfLifeStorage()) 
41707          composeProductShelfLife(null, e);
41708        closeArray();
41709      };
41710  }
41711
41712  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemManufacturedItemComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedPackageItemManufacturedItemComponent element) throws IOException {
41713    if (element != null) {
41714      open(name);
41715      composeMedicinalProductPackagedMedicinalProductPackagedPackageItemManufacturedItemComponentInner(element);
41716      close();
41717    }
41718  }
41719
41720  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemManufacturedItemComponentInner(MedicinalProductPackaged.MedicinalProductPackagedPackageItemManufacturedItemComponent element) throws IOException {
41721      composeBackbone(element);
41722      if (element.hasManufacturedDoseForm()) {
41723        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
41724      }
41725      if (element.hasUnitOfPresentation()) {
41726        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
41727      }
41728      if (element.hasQuantity()) {
41729        composeQuantity("quantity", element.getQuantity());
41730      }
41731      if (element.hasXManufacturer()) {
41732        openArray("xManufacturer");
41733        for (Reference e : element.getXManufacturer()) 
41734          composeReference(null, e);
41735        closeArray();
41736      };
41737      if (element.hasIngredient()) {
41738        openArray("ingredient");
41739        for (Reference e : element.getIngredient()) 
41740          composeReference(null, e);
41741        closeArray();
41742      };
41743      if (element.hasPhysicalCharacteristics()) {
41744        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
41745      }
41746  }
41747
41748  protected void composeMedicinalProductPharmaceutical(String name, MedicinalProductPharmaceutical element) throws IOException {
41749    if (element != null) {
41750      prop("resourceType", name);
41751      composeMedicinalProductPharmaceuticalInner(element);
41752    }
41753  }
41754
41755  protected void composeMedicinalProductPharmaceuticalInner(MedicinalProductPharmaceutical element) throws IOException {
41756      composeDomainResourceElements(element);
41757      if (element.hasIdentifier()) {
41758        openArray("identifier");
41759        for (Identifier e : element.getIdentifier()) 
41760          composeIdentifier(null, e);
41761        closeArray();
41762      };
41763      if (element.hasAdministrableDoseForm()) {
41764        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
41765      }
41766      if (element.hasUnitOfPresentation()) {
41767        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
41768      }
41769      if (element.hasRouteOfAdministration()) {
41770        openArray("routeOfAdministration");
41771        for (CodeableConcept e : element.getRouteOfAdministration()) 
41772          composeCodeableConcept(null, e);
41773        closeArray();
41774      };
41775      if (element.hasIngredient()) {
41776        openArray("ingredient");
41777        for (Reference e : element.getIngredient()) 
41778          composeReference(null, e);
41779        closeArray();
41780      };
41781      if (element.hasDevice()) {
41782        openArray("device");
41783        for (StringType e : element.getDevice()) 
41784          composeStringCore(null, e, true);
41785        closeArray();
41786        if (anyHasExtras(element.getDevice())) {
41787          openArray("_device");
41788          for (StringType e : element.getDevice()) 
41789            composeStringExtras(null, e, true);
41790          closeArray();
41791        }
41792      };
41793      if (element.hasCharacteristics()) {
41794        openArray("characteristics");
41795        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent e : element.getCharacteristics()) 
41796          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(null, e);
41797        closeArray();
41798      };
41799  }
41800
41801  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
41802    if (element != null) {
41803      open(name);
41804      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(element);
41805      close();
41806    }
41807  }
41808
41809  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
41810      composeBackbone(element);
41811      if (element.hasCode()) {
41812        composeCodeableConcept("code", element.getCode());
41813      }
41814      if (element.hasStatus()) {
41815        composeCodeableConcept("status", element.getStatus());
41816      }
41817  }
41818
41819  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
41820    if (element != null) {
41821      prop("resourceType", name);
41822      composeMessageDefinitionInner(element);
41823    }
41824  }
41825
41826  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
41827      composeDomainResourceElements(element);
41828      if (element.hasUrlElement()) {
41829        composeUriCore("url", element.getUrlElement(), false);
41830        composeUriExtras("url", element.getUrlElement(), false);
41831      }
41832      if (element.hasIdentifier()) {
41833        composeIdentifier("identifier", element.getIdentifier());
41834      }
41835      if (element.hasVersionElement()) {
41836        composeStringCore("version", element.getVersionElement(), false);
41837        composeStringExtras("version", element.getVersionElement(), false);
41838      }
41839      if (element.hasNameElement()) {
41840        composeStringCore("name", element.getNameElement(), false);
41841        composeStringExtras("name", element.getNameElement(), false);
41842      }
41843      if (element.hasTitleElement()) {
41844        composeStringCore("title", element.getTitleElement(), false);
41845        composeStringExtras("title", element.getTitleElement(), false);
41846      }
41847      if (element.hasReplaces()) {
41848        openArray("replaces");
41849        for (CanonicalType e : element.getReplaces()) 
41850          composeCanonicalCore(null, e, true);
41851        closeArray();
41852        if (anyHasExtras(element.getReplaces())) {
41853          openArray("_replaces");
41854          for (CanonicalType e : element.getReplaces()) 
41855            composeCanonicalExtras(null, e, true);
41856          closeArray();
41857        }
41858      };
41859      if (element.hasStatusElement()) {
41860        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41861        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41862      }
41863      if (element.hasExperimentalElement()) {
41864        composeBooleanCore("experimental", element.getExperimentalElement(), false);
41865        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
41866      }
41867      if (element.hasDateElement()) {
41868        composeDateTimeCore("date", element.getDateElement(), false);
41869        composeDateTimeExtras("date", element.getDateElement(), false);
41870      }
41871      if (element.hasPublisherElement()) {
41872        composeStringCore("publisher", element.getPublisherElement(), false);
41873        composeStringExtras("publisher", element.getPublisherElement(), false);
41874      }
41875      if (element.hasContact()) {
41876        openArray("contact");
41877        for (ContactDetail e : element.getContact()) 
41878          composeContactDetail(null, e);
41879        closeArray();
41880      };
41881      if (element.hasDescriptionElement()) {
41882        composeMarkdownCore("description", element.getDescriptionElement(), false);
41883        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41884      }
41885      if (element.hasUseContext()) {
41886        openArray("useContext");
41887        for (UsageContext e : element.getUseContext()) 
41888          composeUsageContext(null, e);
41889        closeArray();
41890      };
41891      if (element.hasJurisdiction()) {
41892        openArray("jurisdiction");
41893        for (CodeableConcept e : element.getJurisdiction()) 
41894          composeCodeableConcept(null, e);
41895        closeArray();
41896      };
41897      if (element.hasPurposeElement()) {
41898        composeMarkdownCore("purpose", element.getPurposeElement(), false);
41899        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
41900      }
41901      if (element.hasCopyrightElement()) {
41902        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41903        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41904      }
41905      if (element.hasBaseElement()) {
41906        composeCanonicalCore("base", element.getBaseElement(), false);
41907        composeCanonicalExtras("base", element.getBaseElement(), false);
41908      }
41909      if (element.hasParent()) {
41910        openArray("parent");
41911        for (CanonicalType e : element.getParent()) 
41912          composeCanonicalCore(null, e, true);
41913        closeArray();
41914        if (anyHasExtras(element.getParent())) {
41915          openArray("_parent");
41916          for (CanonicalType e : element.getParent()) 
41917            composeCanonicalExtras(null, e, true);
41918          closeArray();
41919        }
41920      };
41921      if (element.hasEvent()) {
41922        composeType("event", element.getEvent());
41923      }
41924      if (element.hasCategoryElement()) {
41925        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
41926        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
41927      }
41928      if (element.hasFocus()) {
41929        openArray("focus");
41930        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
41931          composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
41932        closeArray();
41933      };
41934      if (element.hasResponseRequiredElement()) {
41935        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
41936        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
41937      }
41938      if (element.hasAllowedResponse()) {
41939        openArray("allowedResponse");
41940        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
41941          composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
41942        closeArray();
41943      };
41944  }
41945
41946  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
41947    if (element != null) {
41948      open(name);
41949      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
41950      close();
41951    }
41952  }
41953
41954  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
41955      composeBackbone(element);
41956      if (element.hasCodeElement()) {
41957        composeCodeCore("code", element.getCodeElement(), false);
41958        composeCodeExtras("code", element.getCodeElement(), false);
41959      }
41960      if (element.hasProfileElement()) {
41961        composeCanonicalCore("profile", element.getProfileElement(), false);
41962        composeCanonicalExtras("profile", element.getProfileElement(), false);
41963      }
41964      if (element.hasMinElement()) {
41965        composeUnsignedIntCore("min", element.getMinElement(), false);
41966        composeUnsignedIntExtras("min", element.getMinElement(), false);
41967      }
41968      if (element.hasMaxElement()) {
41969        composeStringCore("max", element.getMaxElement(), false);
41970        composeStringExtras("max", element.getMaxElement(), false);
41971      }
41972  }
41973
41974  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
41975    if (element != null) {
41976      open(name);
41977      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
41978      close();
41979    }
41980  }
41981
41982  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
41983      composeBackbone(element);
41984      if (element.hasMessageElement()) {
41985        composeCanonicalCore("message", element.getMessageElement(), false);
41986        composeCanonicalExtras("message", element.getMessageElement(), false);
41987      }
41988      if (element.hasSituationElement()) {
41989        composeMarkdownCore("situation", element.getSituationElement(), false);
41990        composeMarkdownExtras("situation", element.getSituationElement(), false);
41991      }
41992  }
41993
41994  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
41995    if (element != null) {
41996      prop("resourceType", name);
41997      composeMessageHeaderInner(element);
41998    }
41999  }
42000
42001  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
42002      composeDomainResourceElements(element);
42003      if (element.hasEvent()) {
42004        composeType("event", element.getEvent());
42005      }
42006      if (element.hasDestination()) {
42007        openArray("destination");
42008        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
42009          composeMessageHeaderMessageDestinationComponent(null, e);
42010        closeArray();
42011      };
42012      if (element.hasSender()) {
42013        composeReference("sender", element.getSender());
42014      }
42015      if (element.hasEnterer()) {
42016        composeReference("enterer", element.getEnterer());
42017      }
42018      if (element.hasAuthor()) {
42019        composeReference("author", element.getAuthor());
42020      }
42021      if (element.hasSource()) {
42022        composeMessageHeaderMessageSourceComponent("source", element.getSource());
42023      }
42024      if (element.hasResponsible()) {
42025        composeReference("responsible", element.getResponsible());
42026      }
42027      if (element.hasReason()) {
42028        composeCodeableConcept("reason", element.getReason());
42029      }
42030      if (element.hasResponse()) {
42031        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
42032      }
42033      if (element.hasFocus()) {
42034        openArray("focus");
42035        for (Reference e : element.getFocus()) 
42036          composeReference(null, e);
42037        closeArray();
42038      };
42039      if (element.hasDefinitionElement()) {
42040        composeCanonicalCore("definition", element.getDefinitionElement(), false);
42041        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
42042      }
42043  }
42044
42045  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
42046    if (element != null) {
42047      open(name);
42048      composeMessageHeaderMessageDestinationComponentInner(element);
42049      close();
42050    }
42051  }
42052
42053  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
42054      composeBackbone(element);
42055      if (element.hasNameElement()) {
42056        composeStringCore("name", element.getNameElement(), false);
42057        composeStringExtras("name", element.getNameElement(), false);
42058      }
42059      if (element.hasTarget()) {
42060        composeReference("target", element.getTarget());
42061      }
42062      if (element.hasEndpointElement()) {
42063        composeUrlCore("endpoint", element.getEndpointElement(), false);
42064        composeUrlExtras("endpoint", element.getEndpointElement(), false);
42065      }
42066      if (element.hasReceiver()) {
42067        composeReference("receiver", element.getReceiver());
42068      }
42069  }
42070
42071  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
42072    if (element != null) {
42073      open(name);
42074      composeMessageHeaderMessageSourceComponentInner(element);
42075      close();
42076    }
42077  }
42078
42079  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
42080      composeBackbone(element);
42081      if (element.hasNameElement()) {
42082        composeStringCore("name", element.getNameElement(), false);
42083        composeStringExtras("name", element.getNameElement(), false);
42084      }
42085      if (element.hasSoftwareElement()) {
42086        composeStringCore("software", element.getSoftwareElement(), false);
42087        composeStringExtras("software", element.getSoftwareElement(), false);
42088      }
42089      if (element.hasVersionElement()) {
42090        composeStringCore("version", element.getVersionElement(), false);
42091        composeStringExtras("version", element.getVersionElement(), false);
42092      }
42093      if (element.hasContact()) {
42094        composeContactPoint("contact", element.getContact());
42095      }
42096      if (element.hasEndpointElement()) {
42097        composeUrlCore("endpoint", element.getEndpointElement(), false);
42098        composeUrlExtras("endpoint", element.getEndpointElement(), false);
42099      }
42100  }
42101
42102  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
42103    if (element != null) {
42104      open(name);
42105      composeMessageHeaderMessageHeaderResponseComponentInner(element);
42106      close();
42107    }
42108  }
42109
42110  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
42111      composeBackbone(element);
42112      if (element.hasIdentifierElement()) {
42113        composeIdCore("identifier", element.getIdentifierElement(), false);
42114        composeIdExtras("identifier", element.getIdentifierElement(), false);
42115      }
42116      if (element.hasCodeElement()) {
42117        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
42118        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
42119      }
42120      if (element.hasDetails()) {
42121        composeReference("details", element.getDetails());
42122      }
42123  }
42124
42125  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
42126    if (element != null) {
42127      prop("resourceType", name);
42128      composeNamingSystemInner(element);
42129    }
42130  }
42131
42132  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
42133      composeDomainResourceElements(element);
42134      if (element.hasNameElement()) {
42135        composeStringCore("name", element.getNameElement(), false);
42136        composeStringExtras("name", element.getNameElement(), false);
42137      }
42138      if (element.hasStatusElement()) {
42139        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42140        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42141      }
42142      if (element.hasKindElement()) {
42143        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
42144        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
42145      }
42146      if (element.hasDateElement()) {
42147        composeDateTimeCore("date", element.getDateElement(), false);
42148        composeDateTimeExtras("date", element.getDateElement(), false);
42149      }
42150      if (element.hasPublisherElement()) {
42151        composeStringCore("publisher", element.getPublisherElement(), false);
42152        composeStringExtras("publisher", element.getPublisherElement(), false);
42153      }
42154      if (element.hasContact()) {
42155        openArray("contact");
42156        for (ContactDetail e : element.getContact()) 
42157          composeContactDetail(null, e);
42158        closeArray();
42159      };
42160      if (element.hasResponsibleElement()) {
42161        composeStringCore("responsible", element.getResponsibleElement(), false);
42162        composeStringExtras("responsible", element.getResponsibleElement(), false);
42163      }
42164      if (element.hasType()) {
42165        composeCodeableConcept("type", element.getType());
42166      }
42167      if (element.hasDescriptionElement()) {
42168        composeMarkdownCore("description", element.getDescriptionElement(), false);
42169        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42170      }
42171      if (element.hasUseContext()) {
42172        openArray("useContext");
42173        for (UsageContext e : element.getUseContext()) 
42174          composeUsageContext(null, e);
42175        closeArray();
42176      };
42177      if (element.hasJurisdiction()) {
42178        openArray("jurisdiction");
42179        for (CodeableConcept e : element.getJurisdiction()) 
42180          composeCodeableConcept(null, e);
42181        closeArray();
42182      };
42183      if (element.hasUsageElement()) {
42184        composeStringCore("usage", element.getUsageElement(), false);
42185        composeStringExtras("usage", element.getUsageElement(), false);
42186      }
42187      if (element.hasUniqueId()) {
42188        openArray("uniqueId");
42189        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
42190          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
42191        closeArray();
42192      };
42193  }
42194
42195  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
42196    if (element != null) {
42197      open(name);
42198      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
42199      close();
42200    }
42201  }
42202
42203  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
42204      composeBackbone(element);
42205      if (element.hasTypeElement()) {
42206        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
42207        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
42208      }
42209      if (element.hasValueElement()) {
42210        composeStringCore("value", element.getValueElement(), false);
42211        composeStringExtras("value", element.getValueElement(), false);
42212      }
42213      if (element.hasPreferredElement()) {
42214        composeBooleanCore("preferred", element.getPreferredElement(), false);
42215        composeBooleanExtras("preferred", element.getPreferredElement(), false);
42216      }
42217      if (element.hasCommentElement()) {
42218        composeStringCore("comment", element.getCommentElement(), false);
42219        composeStringExtras("comment", element.getCommentElement(), false);
42220      }
42221      if (element.hasPeriod()) {
42222        composePeriod("period", element.getPeriod());
42223      }
42224  }
42225
42226  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
42227    if (element != null) {
42228      prop("resourceType", name);
42229      composeNutritionOrderInner(element);
42230    }
42231  }
42232
42233  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
42234      composeDomainResourceElements(element);
42235      if (element.hasIdentifier()) {
42236        openArray("identifier");
42237        for (Identifier e : element.getIdentifier()) 
42238          composeIdentifier(null, e);
42239        closeArray();
42240      };
42241      if (element.hasInstantiates()) {
42242        openArray("instantiates");
42243        for (UriType e : element.getInstantiates()) 
42244          composeUriCore(null, e, true);
42245        closeArray();
42246        if (anyHasExtras(element.getInstantiates())) {
42247          openArray("_instantiates");
42248          for (UriType e : element.getInstantiates()) 
42249            composeUriExtras(null, e, true);
42250          closeArray();
42251        }
42252      };
42253      if (element.hasStatusElement()) {
42254        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
42255        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
42256      }
42257      if (element.hasIntentElement()) {
42258        composeEnumerationCore("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
42259        composeEnumerationExtras("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
42260      }
42261      if (element.hasPatient()) {
42262        composeReference("patient", element.getPatient());
42263      }
42264      if (element.hasContext()) {
42265        composeReference("context", element.getContext());
42266      }
42267      if (element.hasDateTimeElement()) {
42268        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
42269        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
42270      }
42271      if (element.hasOrderer()) {
42272        composeReference("orderer", element.getOrderer());
42273      }
42274      if (element.hasAllergyIntolerance()) {
42275        openArray("allergyIntolerance");
42276        for (Reference e : element.getAllergyIntolerance()) 
42277          composeReference(null, e);
42278        closeArray();
42279      };
42280      if (element.hasFoodPreferenceModifier()) {
42281        openArray("foodPreferenceModifier");
42282        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
42283          composeCodeableConcept(null, e);
42284        closeArray();
42285      };
42286      if (element.hasExcludeFoodModifier()) {
42287        openArray("excludeFoodModifier");
42288        for (CodeableConcept e : element.getExcludeFoodModifier()) 
42289          composeCodeableConcept(null, e);
42290        closeArray();
42291      };
42292      if (element.hasOralDiet()) {
42293        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
42294      }
42295      if (element.hasSupplement()) {
42296        openArray("supplement");
42297        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
42298          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
42299        closeArray();
42300      };
42301      if (element.hasEnteralFormula()) {
42302        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
42303      }
42304      if (element.hasNote()) {
42305        openArray("note");
42306        for (Annotation e : element.getNote()) 
42307          composeAnnotation(null, e);
42308        closeArray();
42309      };
42310  }
42311
42312  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
42313    if (element != null) {
42314      open(name);
42315      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
42316      close();
42317    }
42318  }
42319
42320  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
42321      composeBackbone(element);
42322      if (element.hasType()) {
42323        openArray("type");
42324        for (CodeableConcept e : element.getType()) 
42325          composeCodeableConcept(null, e);
42326        closeArray();
42327      };
42328      if (element.hasSchedule()) {
42329        openArray("schedule");
42330        for (Timing e : element.getSchedule()) 
42331          composeTiming(null, e);
42332        closeArray();
42333      };
42334      if (element.hasNutrient()) {
42335        openArray("nutrient");
42336        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
42337          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
42338        closeArray();
42339      };
42340      if (element.hasTexture()) {
42341        openArray("texture");
42342        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
42343          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
42344        closeArray();
42345      };
42346      if (element.hasFluidConsistencyType()) {
42347        openArray("fluidConsistencyType");
42348        for (CodeableConcept e : element.getFluidConsistencyType()) 
42349          composeCodeableConcept(null, e);
42350        closeArray();
42351      };
42352      if (element.hasInstructionElement()) {
42353        composeStringCore("instruction", element.getInstructionElement(), false);
42354        composeStringExtras("instruction", element.getInstructionElement(), false);
42355      }
42356  }
42357
42358  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
42359    if (element != null) {
42360      open(name);
42361      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
42362      close();
42363    }
42364  }
42365
42366  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
42367      composeBackbone(element);
42368      if (element.hasModifier()) {
42369        composeCodeableConcept("modifier", element.getModifier());
42370      }
42371      if (element.hasAmount()) {
42372        composeSimpleQuantity("amount", element.getAmount());
42373      }
42374  }
42375
42376  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
42377    if (element != null) {
42378      open(name);
42379      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
42380      close();
42381    }
42382  }
42383
42384  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
42385      composeBackbone(element);
42386      if (element.hasModifier()) {
42387        composeCodeableConcept("modifier", element.getModifier());
42388      }
42389      if (element.hasFoodType()) {
42390        composeCodeableConcept("foodType", element.getFoodType());
42391      }
42392  }
42393
42394  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
42395    if (element != null) {
42396      open(name);
42397      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
42398      close();
42399    }
42400  }
42401
42402  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
42403      composeBackbone(element);
42404      if (element.hasType()) {
42405        composeCodeableConcept("type", element.getType());
42406      }
42407      if (element.hasProductNameElement()) {
42408        composeStringCore("productName", element.getProductNameElement(), false);
42409        composeStringExtras("productName", element.getProductNameElement(), false);
42410      }
42411      if (element.hasSchedule()) {
42412        openArray("schedule");
42413        for (Timing e : element.getSchedule()) 
42414          composeTiming(null, e);
42415        closeArray();
42416      };
42417      if (element.hasQuantity()) {
42418        composeSimpleQuantity("quantity", element.getQuantity());
42419      }
42420      if (element.hasInstructionElement()) {
42421        composeStringCore("instruction", element.getInstructionElement(), false);
42422        composeStringExtras("instruction", element.getInstructionElement(), false);
42423      }
42424  }
42425
42426  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
42427    if (element != null) {
42428      open(name);
42429      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
42430      close();
42431    }
42432  }
42433
42434  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
42435      composeBackbone(element);
42436      if (element.hasBaseFormulaType()) {
42437        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
42438      }
42439      if (element.hasBaseFormulaProductNameElement()) {
42440        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
42441        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
42442      }
42443      if (element.hasAdditiveType()) {
42444        composeCodeableConcept("additiveType", element.getAdditiveType());
42445      }
42446      if (element.hasAdditiveProductNameElement()) {
42447        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
42448        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
42449      }
42450      if (element.hasCaloricDensity()) {
42451        composeSimpleQuantity("caloricDensity", element.getCaloricDensity());
42452      }
42453      if (element.hasRouteofAdministration()) {
42454        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
42455      }
42456      if (element.hasAdministration()) {
42457        openArray("administration");
42458        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
42459          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
42460        closeArray();
42461      };
42462      if (element.hasMaxVolumeToDeliver()) {
42463        composeSimpleQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
42464      }
42465      if (element.hasAdministrationInstructionElement()) {
42466        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
42467        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
42468      }
42469  }
42470
42471  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
42472    if (element != null) {
42473      open(name);
42474      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
42475      close();
42476    }
42477  }
42478
42479  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
42480      composeBackbone(element);
42481      if (element.hasSchedule()) {
42482        composeTiming("schedule", element.getSchedule());
42483      }
42484      if (element.hasQuantity()) {
42485        composeSimpleQuantity("quantity", element.getQuantity());
42486      }
42487      if (element.hasRate()) {
42488        composeType("rate", element.getRate());
42489      }
42490  }
42491
42492  protected void composeObservation(String name, Observation element) throws IOException {
42493    if (element != null) {
42494      prop("resourceType", name);
42495      composeObservationInner(element);
42496    }
42497  }
42498
42499  protected void composeObservationInner(Observation element) throws IOException {
42500      composeDomainResourceElements(element);
42501      if (element.hasIdentifier()) {
42502        openArray("identifier");
42503        for (Identifier e : element.getIdentifier()) 
42504          composeIdentifier(null, e);
42505        closeArray();
42506      };
42507      if (element.hasBasedOn()) {
42508        openArray("basedOn");
42509        for (Reference e : element.getBasedOn()) 
42510          composeReference(null, e);
42511        closeArray();
42512      };
42513      if (element.hasPartOf()) {
42514        openArray("partOf");
42515        for (Reference e : element.getPartOf()) 
42516          composeReference(null, e);
42517        closeArray();
42518      };
42519      if (element.hasStatusElement()) {
42520        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
42521        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
42522      }
42523      if (element.hasCategory()) {
42524        openArray("category");
42525        for (CodeableConcept e : element.getCategory()) 
42526          composeCodeableConcept(null, e);
42527        closeArray();
42528      };
42529      if (element.hasCode()) {
42530        composeCodeableConcept("code", element.getCode());
42531      }
42532      if (element.hasSubject()) {
42533        composeReference("subject", element.getSubject());
42534      }
42535      if (element.hasFocus()) {
42536        composeReference("focus", element.getFocus());
42537      }
42538      if (element.hasContext()) {
42539        composeReference("context", element.getContext());
42540      }
42541      if (element.hasEffective()) {
42542        composeType("effective", element.getEffective());
42543      }
42544      if (element.hasIssuedElement()) {
42545        composeInstantCore("issued", element.getIssuedElement(), false);
42546        composeInstantExtras("issued", element.getIssuedElement(), false);
42547      }
42548      if (element.hasPerformer()) {
42549        openArray("performer");
42550        for (Reference e : element.getPerformer()) 
42551          composeReference(null, e);
42552        closeArray();
42553      };
42554      if (element.hasValue()) {
42555        composeType("value", element.getValue());
42556      }
42557      if (element.hasDataAbsentReason()) {
42558        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
42559      }
42560      if (element.hasInterpretation()) {
42561        composeCodeableConcept("interpretation", element.getInterpretation());
42562      }
42563      if (element.hasCommentElement()) {
42564        composeStringCore("comment", element.getCommentElement(), false);
42565        composeStringExtras("comment", element.getCommentElement(), false);
42566      }
42567      if (element.hasBodySite()) {
42568        composeCodeableConcept("bodySite", element.getBodySite());
42569      }
42570      if (element.hasMethod()) {
42571        composeCodeableConcept("method", element.getMethod());
42572      }
42573      if (element.hasSpecimen()) {
42574        composeReference("specimen", element.getSpecimen());
42575      }
42576      if (element.hasDevice()) {
42577        composeReference("device", element.getDevice());
42578      }
42579      if (element.hasReferenceRange()) {
42580        openArray("referenceRange");
42581        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
42582          composeObservationObservationReferenceRangeComponent(null, e);
42583        closeArray();
42584      };
42585      if (element.hasHasMember()) {
42586        openArray("hasMember");
42587        for (Reference e : element.getHasMember()) 
42588          composeReference(null, e);
42589        closeArray();
42590      };
42591      if (element.hasDerivedFrom()) {
42592        openArray("derivedFrom");
42593        for (Reference e : element.getDerivedFrom()) 
42594          composeReference(null, e);
42595        closeArray();
42596      };
42597      if (element.hasComponent()) {
42598        openArray("component");
42599        for (Observation.ObservationComponentComponent e : element.getComponent()) 
42600          composeObservationObservationComponentComponent(null, e);
42601        closeArray();
42602      };
42603  }
42604
42605  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
42606    if (element != null) {
42607      open(name);
42608      composeObservationObservationReferenceRangeComponentInner(element);
42609      close();
42610    }
42611  }
42612
42613  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
42614      composeBackbone(element);
42615      if (element.hasLow()) {
42616        composeSimpleQuantity("low", element.getLow());
42617      }
42618      if (element.hasHigh()) {
42619        composeSimpleQuantity("high", element.getHigh());
42620      }
42621      if (element.hasType()) {
42622        composeCodeableConcept("type", element.getType());
42623      }
42624      if (element.hasAppliesTo()) {
42625        openArray("appliesTo");
42626        for (CodeableConcept e : element.getAppliesTo()) 
42627          composeCodeableConcept(null, e);
42628        closeArray();
42629      };
42630      if (element.hasAge()) {
42631        composeRange("age", element.getAge());
42632      }
42633      if (element.hasTextElement()) {
42634        composeStringCore("text", element.getTextElement(), false);
42635        composeStringExtras("text", element.getTextElement(), false);
42636      }
42637  }
42638
42639  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
42640    if (element != null) {
42641      open(name);
42642      composeObservationObservationComponentComponentInner(element);
42643      close();
42644    }
42645  }
42646
42647  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
42648      composeBackbone(element);
42649      if (element.hasCode()) {
42650        composeCodeableConcept("code", element.getCode());
42651      }
42652      if (element.hasValue()) {
42653        composeType("value", element.getValue());
42654      }
42655      if (element.hasDataAbsentReason()) {
42656        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
42657      }
42658      if (element.hasInterpretation()) {
42659        composeCodeableConcept("interpretation", element.getInterpretation());
42660      }
42661      if (element.hasReferenceRange()) {
42662        openArray("referenceRange");
42663        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
42664          composeObservationObservationReferenceRangeComponent(null, e);
42665        closeArray();
42666      };
42667  }
42668
42669  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
42670    if (element != null) {
42671      prop("resourceType", name);
42672      composeObservationDefinitionInner(element);
42673    }
42674  }
42675
42676  protected void composeObservationDefinitionInner(ObservationDefinition element) throws IOException {
42677      composeDomainResourceElements(element);
42678      if (element.hasCategory()) {
42679        composeCoding("category", element.getCategory());
42680      }
42681      if (element.hasCode()) {
42682        composeCoding("code", element.getCode());
42683      }
42684      if (element.hasPermittedDataType()) {
42685        openArray("permittedDataType");
42686        for (Coding e : element.getPermittedDataType()) 
42687          composeCoding(null, e);
42688        closeArray();
42689      };
42690      if (element.hasMultipleResultsAllowedElement()) {
42691        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
42692        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
42693      }
42694      if (element.hasMethod()) {
42695        composeCodeableConcept("method", element.getMethod());
42696      }
42697      if (element.hasPreferredReportNameElement()) {
42698        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
42699        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
42700      }
42701      if (element.hasQuantitativeDetails()) {
42702        composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
42703      }
42704      if (element.hasQualifiedInterval()) {
42705        openArray("qualifiedInterval");
42706        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
42707          composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(null, e);
42708        closeArray();
42709      };
42710      if (element.hasValidCodedValueSetElement()) {
42711        composeUriCore("validCodedValueSet", element.getValidCodedValueSetElement(), false);
42712        composeUriExtras("validCodedValueSet", element.getValidCodedValueSetElement(), false);
42713      }
42714      if (element.hasNormalCodedValueSetElement()) {
42715        composeUriCore("normalCodedValueSet", element.getNormalCodedValueSetElement(), false);
42716        composeUriExtras("normalCodedValueSet", element.getNormalCodedValueSetElement(), false);
42717      }
42718      if (element.hasAbnormalCodedValueSetElement()) {
42719        composeUriCore("abnormalCodedValueSet", element.getAbnormalCodedValueSetElement(), false);
42720        composeUriExtras("abnormalCodedValueSet", element.getAbnormalCodedValueSetElement(), false);
42721      }
42722      if (element.hasCriticalCodedValueSetElement()) {
42723        composeUriCore("criticalCodedValueSet", element.getCriticalCodedValueSetElement(), false);
42724        composeUriExtras("criticalCodedValueSet", element.getCriticalCodedValueSetElement(), false);
42725      }
42726  }
42727
42728  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(String name, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
42729    if (element != null) {
42730      open(name);
42731      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(element);
42732      close();
42733    }
42734  }
42735
42736  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
42737      composeBackbone(element);
42738      if (element.hasCustomaryUnit()) {
42739        composeCoding("customaryUnit", element.getCustomaryUnit());
42740      }
42741      if (element.hasUnit()) {
42742        composeCoding("unit", element.getUnit());
42743      }
42744      if (element.hasConversionFactorElement()) {
42745        composeDecimalCore("conversionFactor", element.getConversionFactorElement(), false);
42746        composeDecimalExtras("conversionFactor", element.getConversionFactorElement(), false);
42747      }
42748      if (element.hasDecimalPrecisionElement()) {
42749        composeIntegerCore("decimalPrecision", element.getDecimalPrecisionElement(), false);
42750        composeIntegerExtras("decimalPrecision", element.getDecimalPrecisionElement(), false);
42751      }
42752  }
42753
42754  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
42755    if (element != null) {
42756      open(name);
42757      composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(element);
42758      close();
42759    }
42760  }
42761
42762  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
42763      composeBackbone(element);
42764      if (element.hasCategory()) {
42765        composeCodeableConcept("category", element.getCategory());
42766      }
42767      if (element.hasRange()) {
42768        composeRange("range", element.getRange());
42769      }
42770      if (element.hasType()) {
42771        composeCodeableConcept("type", element.getType());
42772      }
42773      if (element.hasAppliesTo()) {
42774        openArray("appliesTo");
42775        for (CodeableConcept e : element.getAppliesTo()) 
42776          composeCodeableConcept(null, e);
42777        closeArray();
42778      };
42779      if (element.hasAge()) {
42780        composeRange("age", element.getAge());
42781      }
42782      if (element.hasGestationalAge()) {
42783        composeRange("gestationalAge", element.getGestationalAge());
42784      }
42785      if (element.hasConditionElement()) {
42786        composeStringCore("condition", element.getConditionElement(), false);
42787        composeStringExtras("condition", element.getConditionElement(), false);
42788      }
42789  }
42790
42791  protected void composeOccupationalData(String name, OccupationalData element) throws IOException {
42792    if (element != null) {
42793      prop("resourceType", name);
42794      composeOccupationalDataInner(element);
42795    }
42796  }
42797
42798  protected void composeOccupationalDataInner(OccupationalData element) throws IOException {
42799      composeDomainResourceElements(element);
42800      if (element.hasIdentifier()) {
42801        composeIdentifier("identifier", element.getIdentifier());
42802      }
42803      if (element.hasStatusElement()) {
42804        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42805        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42806      }
42807      if (element.hasSubject()) {
42808        composeReference("subject", element.getSubject());
42809      }
42810      if (element.hasDateElement()) {
42811        composeDateTimeCore("date", element.getDateElement(), false);
42812        composeDateTimeExtras("date", element.getDateElement(), false);
42813      }
42814      if (element.hasRecorder()) {
42815        openArray("recorder");
42816        for (Reference e : element.getRecorder()) 
42817          composeReference(null, e);
42818        closeArray();
42819      };
42820      if (element.hasInformant()) {
42821        openArray("informant");
42822        for (Reference e : element.getInformant()) 
42823          composeReference(null, e);
42824        closeArray();
42825      };
42826      if (element.hasEmploymentStatus()) {
42827        openArray("employmentStatus");
42828        for (OccupationalData.OccupationalDataEmploymentStatusComponent e : element.getEmploymentStatus()) 
42829          composeOccupationalDataOccupationalDataEmploymentStatusComponent(null, e);
42830        closeArray();
42831      };
42832      if (element.hasRetirementDate()) {
42833        openArray("retirementDate");
42834        for (DateTimeType e : element.getRetirementDate()) 
42835          composeDateTimeCore(null, e, true);
42836        closeArray();
42837        if (anyHasExtras(element.getRetirementDate())) {
42838          openArray("_retirementDate");
42839          for (DateTimeType e : element.getRetirementDate()) 
42840            composeDateTimeExtras(null, e, true);
42841          closeArray();
42842        }
42843      };
42844      if (element.hasCombatZonePeriod()) {
42845        openArray("combatZonePeriod");
42846        for (Period e : element.getCombatZonePeriod()) 
42847          composePeriod(null, e);
42848        closeArray();
42849      };
42850      if (element.hasUsualWork()) {
42851        composeOccupationalDataOccupationalDataUsualWorkComponent("usualWork", element.getUsualWork());
42852      }
42853      if (element.hasPastOrPresentJob()) {
42854        openArray("pastOrPresentJob");
42855        for (OccupationalData.OccupationalDataPastOrPresentJobComponent e : element.getPastOrPresentJob()) 
42856          composeOccupationalDataOccupationalDataPastOrPresentJobComponent(null, e);
42857        closeArray();
42858      };
42859  }
42860
42861  protected void composeOccupationalDataOccupationalDataEmploymentStatusComponent(String name, OccupationalData.OccupationalDataEmploymentStatusComponent element) throws IOException {
42862    if (element != null) {
42863      open(name);
42864      composeOccupationalDataOccupationalDataEmploymentStatusComponentInner(element);
42865      close();
42866    }
42867  }
42868
42869  protected void composeOccupationalDataOccupationalDataEmploymentStatusComponentInner(OccupationalData.OccupationalDataEmploymentStatusComponent element) throws IOException {
42870      composeBackbone(element);
42871      if (element.hasCode()) {
42872        composeCodeableConcept("code", element.getCode());
42873      }
42874      if (element.hasEffective()) {
42875        composePeriod("effective", element.getEffective());
42876      }
42877  }
42878
42879  protected void composeOccupationalDataOccupationalDataUsualWorkComponent(String name, OccupationalData.OccupationalDataUsualWorkComponent element) throws IOException {
42880    if (element != null) {
42881      open(name);
42882      composeOccupationalDataOccupationalDataUsualWorkComponentInner(element);
42883      close();
42884    }
42885  }
42886
42887  protected void composeOccupationalDataOccupationalDataUsualWorkComponentInner(OccupationalData.OccupationalDataUsualWorkComponent element) throws IOException {
42888      composeBackbone(element);
42889      if (element.hasOccupation()) {
42890        composeCodeableConcept("occupation", element.getOccupation());
42891      }
42892      if (element.hasIndustry()) {
42893        composeCodeableConcept("industry", element.getIndustry());
42894      }
42895      if (element.hasStartElement()) {
42896        composeDateTimeCore("start", element.getStartElement(), false);
42897        composeDateTimeExtras("start", element.getStartElement(), false);
42898      }
42899      if (element.hasDuration()) {
42900        composeDuration("duration", element.getDuration());
42901      }
42902  }
42903
42904  protected void composeOccupationalDataOccupationalDataPastOrPresentJobComponent(String name, OccupationalData.OccupationalDataPastOrPresentJobComponent element) throws IOException {
42905    if (element != null) {
42906      open(name);
42907      composeOccupationalDataOccupationalDataPastOrPresentJobComponentInner(element);
42908      close();
42909    }
42910  }
42911
42912  protected void composeOccupationalDataOccupationalDataPastOrPresentJobComponentInner(OccupationalData.OccupationalDataPastOrPresentJobComponent element) throws IOException {
42913      composeBackbone(element);
42914      if (element.hasOccupation()) {
42915        composeCodeableConcept("occupation", element.getOccupation());
42916      }
42917      if (element.hasIndustry()) {
42918        composeCodeableConcept("industry", element.getIndustry());
42919      }
42920      if (element.hasEffective()) {
42921        composePeriod("effective", element.getEffective());
42922      }
42923      if (element.hasEmployer()) {
42924        composeReference("employer", element.getEmployer());
42925      }
42926      if (element.hasWorkClassification()) {
42927        composeCodeableConcept("workClassification", element.getWorkClassification());
42928      }
42929      if (element.hasSupervisoryLevel()) {
42930        composeCodeableConcept("supervisoryLevel", element.getSupervisoryLevel());
42931      }
42932      if (element.hasJobDuty()) {
42933        openArray("jobDuty");
42934        for (StringType e : element.getJobDuty()) 
42935          composeStringCore(null, e, true);
42936        closeArray();
42937        if (anyHasExtras(element.getJobDuty())) {
42938          openArray("_jobDuty");
42939          for (StringType e : element.getJobDuty()) 
42940            composeStringExtras(null, e, true);
42941          closeArray();
42942        }
42943      };
42944      if (element.hasOccupationalHazard()) {
42945        openArray("occupationalHazard");
42946        for (StringType e : element.getOccupationalHazard()) 
42947          composeStringCore(null, e, true);
42948        closeArray();
42949        if (anyHasExtras(element.getOccupationalHazard())) {
42950          openArray("_occupationalHazard");
42951          for (StringType e : element.getOccupationalHazard()) 
42952            composeStringExtras(null, e, true);
42953          closeArray();
42954        }
42955      };
42956      if (element.hasWorkSchedule()) {
42957        composeOccupationalDataOccupationalDataPastOrPresentJobWorkScheduleComponent("workSchedule", element.getWorkSchedule());
42958      }
42959  }
42960
42961  protected void composeOccupationalDataOccupationalDataPastOrPresentJobWorkScheduleComponent(String name, OccupationalData.OccupationalDataPastOrPresentJobWorkScheduleComponent element) throws IOException {
42962    if (element != null) {
42963      open(name);
42964      composeOccupationalDataOccupationalDataPastOrPresentJobWorkScheduleComponentInner(element);
42965      close();
42966    }
42967  }
42968
42969  protected void composeOccupationalDataOccupationalDataPastOrPresentJobWorkScheduleComponentInner(OccupationalData.OccupationalDataPastOrPresentJobWorkScheduleComponent element) throws IOException {
42970      composeBackbone(element);
42971      if (element.hasCode()) {
42972        composeCodeableConcept("code", element.getCode());
42973      }
42974      if (element.hasWeeklyWorkDaysElement()) {
42975        composeDecimalCore("weeklyWorkDays", element.getWeeklyWorkDaysElement(), false);
42976        composeDecimalExtras("weeklyWorkDays", element.getWeeklyWorkDaysElement(), false);
42977      }
42978      if (element.hasDailyWorkHoursElement()) {
42979        composeDecimalCore("dailyWorkHours", element.getDailyWorkHoursElement(), false);
42980        composeDecimalExtras("dailyWorkHours", element.getDailyWorkHoursElement(), false);
42981      }
42982  }
42983
42984  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
42985    if (element != null) {
42986      prop("resourceType", name);
42987      composeOperationDefinitionInner(element);
42988    }
42989  }
42990
42991  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
42992      composeDomainResourceElements(element);
42993      if (element.hasUrlElement()) {
42994        composeUriCore("url", element.getUrlElement(), false);
42995        composeUriExtras("url", element.getUrlElement(), false);
42996      }
42997      if (element.hasVersionElement()) {
42998        composeStringCore("version", element.getVersionElement(), false);
42999        composeStringExtras("version", element.getVersionElement(), false);
43000      }
43001      if (element.hasNameElement()) {
43002        composeStringCore("name", element.getNameElement(), false);
43003        composeStringExtras("name", element.getNameElement(), false);
43004      }
43005      if (element.hasStatusElement()) {
43006        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43007        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43008      }
43009      if (element.hasKindElement()) {
43010        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
43011        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
43012      }
43013      if (element.hasExperimentalElement()) {
43014        composeBooleanCore("experimental", element.getExperimentalElement(), false);
43015        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
43016      }
43017      if (element.hasDateElement()) {
43018        composeDateTimeCore("date", element.getDateElement(), false);
43019        composeDateTimeExtras("date", element.getDateElement(), false);
43020      }
43021      if (element.hasPublisherElement()) {
43022        composeStringCore("publisher", element.getPublisherElement(), false);
43023        composeStringExtras("publisher", element.getPublisherElement(), false);
43024      }
43025      if (element.hasContact()) {
43026        openArray("contact");
43027        for (ContactDetail e : element.getContact()) 
43028          composeContactDetail(null, e);
43029        closeArray();
43030      };
43031      if (element.hasDescriptionElement()) {
43032        composeMarkdownCore("description", element.getDescriptionElement(), false);
43033        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43034      }
43035      if (element.hasUseContext()) {
43036        openArray("useContext");
43037        for (UsageContext e : element.getUseContext()) 
43038          composeUsageContext(null, e);
43039        closeArray();
43040      };
43041      if (element.hasJurisdiction()) {
43042        openArray("jurisdiction");
43043        for (CodeableConcept e : element.getJurisdiction()) 
43044          composeCodeableConcept(null, e);
43045        closeArray();
43046      };
43047      if (element.hasPurposeElement()) {
43048        composeMarkdownCore("purpose", element.getPurposeElement(), false);
43049        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
43050      }
43051      if (element.hasAffectsStateElement()) {
43052        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
43053        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
43054      }
43055      if (element.hasCodeElement()) {
43056        composeCodeCore("code", element.getCodeElement(), false);
43057        composeCodeExtras("code", element.getCodeElement(), false);
43058      }
43059      if (element.hasCommentElement()) {
43060        composeMarkdownCore("comment", element.getCommentElement(), false);
43061        composeMarkdownExtras("comment", element.getCommentElement(), false);
43062      }
43063      if (element.hasBaseElement()) {
43064        composeCanonicalCore("base", element.getBaseElement(), false);
43065        composeCanonicalExtras("base", element.getBaseElement(), false);
43066      }
43067      if (element.hasResource()) {
43068        openArray("resource");
43069        for (CodeType e : element.getResource()) 
43070          composeCodeCore(null, e, true);
43071        closeArray();
43072        if (anyHasExtras(element.getResource())) {
43073          openArray("_resource");
43074          for (CodeType e : element.getResource()) 
43075            composeCodeExtras(null, e, true);
43076          closeArray();
43077        }
43078      };
43079      if (element.hasSystemElement()) {
43080        composeBooleanCore("system", element.getSystemElement(), false);
43081        composeBooleanExtras("system", element.getSystemElement(), false);
43082      }
43083      if (element.hasTypeElement()) {
43084        composeBooleanCore("type", element.getTypeElement(), false);
43085        composeBooleanExtras("type", element.getTypeElement(), false);
43086      }
43087      if (element.hasInstanceElement()) {
43088        composeBooleanCore("instance", element.getInstanceElement(), false);
43089        composeBooleanExtras("instance", element.getInstanceElement(), false);
43090      }
43091      if (element.hasInputProfileElement()) {
43092        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
43093        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
43094      }
43095      if (element.hasOutputProfileElement()) {
43096        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
43097        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
43098      }
43099      if (element.hasParameter()) {
43100        openArray("parameter");
43101        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
43102          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
43103        closeArray();
43104      };
43105      if (element.hasOverload()) {
43106        openArray("overload");
43107        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
43108          composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
43109        closeArray();
43110      };
43111  }
43112
43113  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
43114    if (element != null) {
43115      open(name);
43116      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
43117      close();
43118    }
43119  }
43120
43121  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
43122      composeBackbone(element);
43123      if (element.hasNameElement()) {
43124        composeCodeCore("name", element.getNameElement(), false);
43125        composeCodeExtras("name", element.getNameElement(), false);
43126      }
43127      if (element.hasUseElement()) {
43128        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
43129        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
43130      }
43131      if (element.hasMinElement()) {
43132        composeIntegerCore("min", element.getMinElement(), false);
43133        composeIntegerExtras("min", element.getMinElement(), false);
43134      }
43135      if (element.hasMaxElement()) {
43136        composeStringCore("max", element.getMaxElement(), false);
43137        composeStringExtras("max", element.getMaxElement(), false);
43138      }
43139      if (element.hasDocumentationElement()) {
43140        composeStringCore("documentation", element.getDocumentationElement(), false);
43141        composeStringExtras("documentation", element.getDocumentationElement(), false);
43142      }
43143      if (element.hasTypeElement()) {
43144        composeCodeCore("type", element.getTypeElement(), false);
43145        composeCodeExtras("type", element.getTypeElement(), false);
43146      }
43147      if (element.hasTargetProfile()) {
43148        openArray("targetProfile");
43149        for (CanonicalType e : element.getTargetProfile()) 
43150          composeCanonicalCore(null, e, true);
43151        closeArray();
43152        if (anyHasExtras(element.getTargetProfile())) {
43153          openArray("_targetProfile");
43154          for (CanonicalType e : element.getTargetProfile()) 
43155            composeCanonicalExtras(null, e, true);
43156          closeArray();
43157        }
43158      };
43159      if (element.hasSearchTypeElement()) {
43160        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
43161        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
43162      }
43163      if (element.hasBinding()) {
43164        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
43165      }
43166      if (element.hasPart()) {
43167        openArray("part");
43168        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
43169          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
43170        closeArray();
43171      };
43172  }
43173
43174  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
43175    if (element != null) {
43176      open(name);
43177      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
43178      close();
43179    }
43180  }
43181
43182  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
43183      composeBackbone(element);
43184      if (element.hasStrengthElement()) {
43185        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
43186        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
43187      }
43188      if (element.hasValueSet()) {
43189        composeType("valueSet", element.getValueSet());
43190      }
43191  }
43192
43193  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
43194    if (element != null) {
43195      open(name);
43196      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
43197      close();
43198    }
43199  }
43200
43201  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
43202      composeBackbone(element);
43203      if (element.hasParameterName()) {
43204        openArray("parameterName");
43205        for (StringType e : element.getParameterName()) 
43206          composeStringCore(null, e, true);
43207        closeArray();
43208        if (anyHasExtras(element.getParameterName())) {
43209          openArray("_parameterName");
43210          for (StringType e : element.getParameterName()) 
43211            composeStringExtras(null, e, true);
43212          closeArray();
43213        }
43214      };
43215      if (element.hasCommentElement()) {
43216        composeStringCore("comment", element.getCommentElement(), false);
43217        composeStringExtras("comment", element.getCommentElement(), false);
43218      }
43219  }
43220
43221  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
43222    if (element != null) {
43223      prop("resourceType", name);
43224      composeOperationOutcomeInner(element);
43225    }
43226  }
43227
43228  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
43229      composeDomainResourceElements(element);
43230      if (element.hasIssue()) {
43231        openArray("issue");
43232        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
43233          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
43234        closeArray();
43235      };
43236  }
43237
43238  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
43239    if (element != null) {
43240      open(name);
43241      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
43242      close();
43243    }
43244  }
43245
43246  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
43247      composeBackbone(element);
43248      if (element.hasSeverityElement()) {
43249        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
43250        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
43251      }
43252      if (element.hasCodeElement()) {
43253        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
43254        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
43255      }
43256      if (element.hasDetails()) {
43257        composeCodeableConcept("details", element.getDetails());
43258      }
43259      if (element.hasDiagnosticsElement()) {
43260        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
43261        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
43262      }
43263      if (element.hasLocation()) {
43264        openArray("location");
43265        for (StringType e : element.getLocation()) 
43266          composeStringCore(null, e, true);
43267        closeArray();
43268        if (anyHasExtras(element.getLocation())) {
43269          openArray("_location");
43270          for (StringType e : element.getLocation()) 
43271            composeStringExtras(null, e, true);
43272          closeArray();
43273        }
43274      };
43275      if (element.hasExpression()) {
43276        openArray("expression");
43277        for (StringType e : element.getExpression()) 
43278          composeStringCore(null, e, true);
43279        closeArray();
43280        if (anyHasExtras(element.getExpression())) {
43281          openArray("_expression");
43282          for (StringType e : element.getExpression()) 
43283            composeStringExtras(null, e, true);
43284          closeArray();
43285        }
43286      };
43287  }
43288
43289  protected void composeOrganization(String name, Organization element) throws IOException {
43290    if (element != null) {
43291      prop("resourceType", name);
43292      composeOrganizationInner(element);
43293    }
43294  }
43295
43296  protected void composeOrganizationInner(Organization element) throws IOException {
43297      composeDomainResourceElements(element);
43298      if (element.hasIdentifier()) {
43299        openArray("identifier");
43300        for (Identifier e : element.getIdentifier()) 
43301          composeIdentifier(null, e);
43302        closeArray();
43303      };
43304      if (element.hasActiveElement()) {
43305        composeBooleanCore("active", element.getActiveElement(), false);
43306        composeBooleanExtras("active", element.getActiveElement(), false);
43307      }
43308      if (element.hasType()) {
43309        openArray("type");
43310        for (CodeableConcept e : element.getType()) 
43311          composeCodeableConcept(null, e);
43312        closeArray();
43313      };
43314      if (element.hasNameElement()) {
43315        composeStringCore("name", element.getNameElement(), false);
43316        composeStringExtras("name", element.getNameElement(), false);
43317      }
43318      if (element.hasAlias()) {
43319        openArray("alias");
43320        for (StringType e : element.getAlias()) 
43321          composeStringCore(null, e, true);
43322        closeArray();
43323        if (anyHasExtras(element.getAlias())) {
43324          openArray("_alias");
43325          for (StringType e : element.getAlias()) 
43326            composeStringExtras(null, e, true);
43327          closeArray();
43328        }
43329      };
43330      if (element.hasTelecom()) {
43331        openArray("telecom");
43332        for (ContactPoint e : element.getTelecom()) 
43333          composeContactPoint(null, e);
43334        closeArray();
43335      };
43336      if (element.hasAddress()) {
43337        openArray("address");
43338        for (Address e : element.getAddress()) 
43339          composeAddress(null, e);
43340        closeArray();
43341      };
43342      if (element.hasPartOf()) {
43343        composeReference("partOf", element.getPartOf());
43344      }
43345      if (element.hasContact()) {
43346        openArray("contact");
43347        for (Organization.OrganizationContactComponent e : element.getContact()) 
43348          composeOrganizationOrganizationContactComponent(null, e);
43349        closeArray();
43350      };
43351      if (element.hasEndpoint()) {
43352        openArray("endpoint");
43353        for (Reference e : element.getEndpoint()) 
43354          composeReference(null, e);
43355        closeArray();
43356      };
43357  }
43358
43359  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
43360    if (element != null) {
43361      open(name);
43362      composeOrganizationOrganizationContactComponentInner(element);
43363      close();
43364    }
43365  }
43366
43367  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
43368      composeBackbone(element);
43369      if (element.hasPurpose()) {
43370        composeCodeableConcept("purpose", element.getPurpose());
43371      }
43372      if (element.hasName()) {
43373        composeHumanName("name", element.getName());
43374      }
43375      if (element.hasTelecom()) {
43376        openArray("telecom");
43377        for (ContactPoint e : element.getTelecom()) 
43378          composeContactPoint(null, e);
43379        closeArray();
43380      };
43381      if (element.hasAddress()) {
43382        composeAddress("address", element.getAddress());
43383      }
43384  }
43385
43386  protected void composeOrganizationRole(String name, OrganizationRole element) throws IOException {
43387    if (element != null) {
43388      prop("resourceType", name);
43389      composeOrganizationRoleInner(element);
43390    }
43391  }
43392
43393  protected void composeOrganizationRoleInner(OrganizationRole element) throws IOException {
43394      composeDomainResourceElements(element);
43395      if (element.hasIdentifier()) {
43396        openArray("identifier");
43397        for (Identifier e : element.getIdentifier()) 
43398          composeIdentifier(null, e);
43399        closeArray();
43400      };
43401      if (element.hasActiveElement()) {
43402        composeBooleanCore("active", element.getActiveElement(), false);
43403        composeBooleanExtras("active", element.getActiveElement(), false);
43404      }
43405      if (element.hasPeriod()) {
43406        composePeriod("period", element.getPeriod());
43407      }
43408      if (element.hasOrganization()) {
43409        composeReference("organization", element.getOrganization());
43410      }
43411      if (element.hasParticipatingOrganization()) {
43412        composeReference("participatingOrganization", element.getParticipatingOrganization());
43413      }
43414      if (element.hasNetwork()) {
43415        openArray("network");
43416        for (Reference e : element.getNetwork()) 
43417          composeReference(null, e);
43418        closeArray();
43419      };
43420      if (element.hasCode()) {
43421        openArray("code");
43422        for (CodeableConcept e : element.getCode()) 
43423          composeCodeableConcept(null, e);
43424        closeArray();
43425      };
43426      if (element.hasSpecialty()) {
43427        openArray("specialty");
43428        for (CodeableConcept e : element.getSpecialty()) 
43429          composeCodeableConcept(null, e);
43430        closeArray();
43431      };
43432      if (element.hasLocation()) {
43433        openArray("location");
43434        for (Reference e : element.getLocation()) 
43435          composeReference(null, e);
43436        closeArray();
43437      };
43438      if (element.hasHealthcareService()) {
43439        openArray("healthcareService");
43440        for (Reference e : element.getHealthcareService()) 
43441          composeReference(null, e);
43442        closeArray();
43443      };
43444      if (element.hasTelecom()) {
43445        openArray("telecom");
43446        for (ContactPoint e : element.getTelecom()) 
43447          composeContactPoint(null, e);
43448        closeArray();
43449      };
43450      if (element.hasAvailableTime()) {
43451        openArray("availableTime");
43452        for (OrganizationRole.OrganizationRoleAvailableTimeComponent e : element.getAvailableTime()) 
43453          composeOrganizationRoleOrganizationRoleAvailableTimeComponent(null, e);
43454        closeArray();
43455      };
43456      if (element.hasNotAvailable()) {
43457        openArray("notAvailable");
43458        for (OrganizationRole.OrganizationRoleNotAvailableComponent e : element.getNotAvailable()) 
43459          composeOrganizationRoleOrganizationRoleNotAvailableComponent(null, e);
43460        closeArray();
43461      };
43462      if (element.hasAvailabilityExceptionsElement()) {
43463        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
43464        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
43465      }
43466      if (element.hasEndpoint()) {
43467        openArray("endpoint");
43468        for (Reference e : element.getEndpoint()) 
43469          composeReference(null, e);
43470        closeArray();
43471      };
43472  }
43473
43474  protected void composeOrganizationRoleOrganizationRoleAvailableTimeComponent(String name, OrganizationRole.OrganizationRoleAvailableTimeComponent element) throws IOException {
43475    if (element != null) {
43476      open(name);
43477      composeOrganizationRoleOrganizationRoleAvailableTimeComponentInner(element);
43478      close();
43479    }
43480  }
43481
43482  protected void composeOrganizationRoleOrganizationRoleAvailableTimeComponentInner(OrganizationRole.OrganizationRoleAvailableTimeComponent element) throws IOException {
43483      composeBackbone(element);
43484      if (element.hasDaysOfWeek()) {
43485        openArray("daysOfWeek");
43486        for (Enumeration<OrganizationRole.DaysOfWeek> e : element.getDaysOfWeek()) 
43487          composeEnumerationCore(null, e, new OrganizationRole.DaysOfWeekEnumFactory(), true);
43488        closeArray();
43489        if (anyHasExtras(element.getDaysOfWeek())) {
43490          openArray("_daysOfWeek");
43491          for (Enumeration<OrganizationRole.DaysOfWeek> e : element.getDaysOfWeek()) 
43492            composeEnumerationExtras(null, e, new OrganizationRole.DaysOfWeekEnumFactory(), true);
43493          closeArray();
43494        }
43495      };
43496      if (element.hasAllDayElement()) {
43497        composeBooleanCore("allDay", element.getAllDayElement(), false);
43498        composeBooleanExtras("allDay", element.getAllDayElement(), false);
43499      }
43500      if (element.hasAvailableStartTimeElement()) {
43501        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
43502        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
43503      }
43504      if (element.hasAvailableEndTimeElement()) {
43505        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
43506        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
43507      }
43508  }
43509
43510  protected void composeOrganizationRoleOrganizationRoleNotAvailableComponent(String name, OrganizationRole.OrganizationRoleNotAvailableComponent element) throws IOException {
43511    if (element != null) {
43512      open(name);
43513      composeOrganizationRoleOrganizationRoleNotAvailableComponentInner(element);
43514      close();
43515    }
43516  }
43517
43518  protected void composeOrganizationRoleOrganizationRoleNotAvailableComponentInner(OrganizationRole.OrganizationRoleNotAvailableComponent element) throws IOException {
43519      composeBackbone(element);
43520      if (element.hasDescriptionElement()) {
43521        composeStringCore("description", element.getDescriptionElement(), false);
43522        composeStringExtras("description", element.getDescriptionElement(), false);
43523      }
43524      if (element.hasDuring()) {
43525        composePeriod("during", element.getDuring());
43526      }
43527  }
43528
43529  protected void composePatient(String name, Patient element) throws IOException {
43530    if (element != null) {
43531      prop("resourceType", name);
43532      composePatientInner(element);
43533    }
43534  }
43535
43536  protected void composePatientInner(Patient element) throws IOException {
43537      composeDomainResourceElements(element);
43538      if (element.hasIdentifier()) {
43539        openArray("identifier");
43540        for (Identifier e : element.getIdentifier()) 
43541          composeIdentifier(null, e);
43542        closeArray();
43543      };
43544      if (element.hasActiveElement()) {
43545        composeBooleanCore("active", element.getActiveElement(), false);
43546        composeBooleanExtras("active", element.getActiveElement(), false);
43547      }
43548      if (element.hasName()) {
43549        openArray("name");
43550        for (HumanName e : element.getName()) 
43551          composeHumanName(null, e);
43552        closeArray();
43553      };
43554      if (element.hasTelecom()) {
43555        openArray("telecom");
43556        for (ContactPoint e : element.getTelecom()) 
43557          composeContactPoint(null, e);
43558        closeArray();
43559      };
43560      if (element.hasGenderElement()) {
43561        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
43562        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
43563      }
43564      if (element.hasBirthDateElement()) {
43565        composeDateCore("birthDate", element.getBirthDateElement(), false);
43566        composeDateExtras("birthDate", element.getBirthDateElement(), false);
43567      }
43568      if (element.hasDeceased()) {
43569        composeType("deceased", element.getDeceased());
43570      }
43571      if (element.hasAddress()) {
43572        openArray("address");
43573        for (Address e : element.getAddress()) 
43574          composeAddress(null, e);
43575        closeArray();
43576      };
43577      if (element.hasMaritalStatus()) {
43578        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
43579      }
43580      if (element.hasMultipleBirth()) {
43581        composeType("multipleBirth", element.getMultipleBirth());
43582      }
43583      if (element.hasPhoto()) {
43584        openArray("photo");
43585        for (Attachment e : element.getPhoto()) 
43586          composeAttachment(null, e);
43587        closeArray();
43588      };
43589      if (element.hasContact()) {
43590        openArray("contact");
43591        for (Patient.ContactComponent e : element.getContact()) 
43592          composePatientContactComponent(null, e);
43593        closeArray();
43594      };
43595      if (element.hasCommunication()) {
43596        openArray("communication");
43597        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
43598          composePatientPatientCommunicationComponent(null, e);
43599        closeArray();
43600      };
43601      if (element.hasGeneralPractitioner()) {
43602        openArray("generalPractitioner");
43603        for (Reference e : element.getGeneralPractitioner()) 
43604          composeReference(null, e);
43605        closeArray();
43606      };
43607      if (element.hasManagingOrganization()) {
43608        composeReference("managingOrganization", element.getManagingOrganization());
43609      }
43610      if (element.hasLink()) {
43611        openArray("link");
43612        for (Patient.PatientLinkComponent e : element.getLink()) 
43613          composePatientPatientLinkComponent(null, e);
43614        closeArray();
43615      };
43616  }
43617
43618  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
43619    if (element != null) {
43620      open(name);
43621      composePatientContactComponentInner(element);
43622      close();
43623    }
43624  }
43625
43626  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
43627      composeBackbone(element);
43628      if (element.hasRelationship()) {
43629        openArray("relationship");
43630        for (CodeableConcept e : element.getRelationship()) 
43631          composeCodeableConcept(null, e);
43632        closeArray();
43633      };
43634      if (element.hasName()) {
43635        composeHumanName("name", element.getName());
43636      }
43637      if (element.hasTelecom()) {
43638        openArray("telecom");
43639        for (ContactPoint e : element.getTelecom()) 
43640          composeContactPoint(null, e);
43641        closeArray();
43642      };
43643      if (element.hasAddress()) {
43644        composeAddress("address", element.getAddress());
43645      }
43646      if (element.hasGenderElement()) {
43647        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
43648        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
43649      }
43650      if (element.hasOrganization()) {
43651        composeReference("organization", element.getOrganization());
43652      }
43653      if (element.hasPeriod()) {
43654        composePeriod("period", element.getPeriod());
43655      }
43656  }
43657
43658  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
43659    if (element != null) {
43660      open(name);
43661      composePatientPatientCommunicationComponentInner(element);
43662      close();
43663    }
43664  }
43665
43666  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
43667      composeBackbone(element);
43668      if (element.hasLanguage()) {
43669        composeCodeableConcept("language", element.getLanguage());
43670      }
43671      if (element.hasPreferredElement()) {
43672        composeBooleanCore("preferred", element.getPreferredElement(), false);
43673        composeBooleanExtras("preferred", element.getPreferredElement(), false);
43674      }
43675  }
43676
43677  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
43678    if (element != null) {
43679      open(name);
43680      composePatientPatientLinkComponentInner(element);
43681      close();
43682    }
43683  }
43684
43685  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
43686      composeBackbone(element);
43687      if (element.hasOther()) {
43688        composeReference("other", element.getOther());
43689      }
43690      if (element.hasTypeElement()) {
43691        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
43692        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
43693      }
43694  }
43695
43696  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
43697    if (element != null) {
43698      prop("resourceType", name);
43699      composePaymentNoticeInner(element);
43700    }
43701  }
43702
43703  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
43704      composeDomainResourceElements(element);
43705      if (element.hasIdentifier()) {
43706        openArray("identifier");
43707        for (Identifier e : element.getIdentifier()) 
43708          composeIdentifier(null, e);
43709        closeArray();
43710      };
43711      if (element.hasStatusElement()) {
43712        composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
43713        composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
43714      }
43715      if (element.hasRequest()) {
43716        composeReference("request", element.getRequest());
43717      }
43718      if (element.hasResponse()) {
43719        composeReference("response", element.getResponse());
43720      }
43721      if (element.hasStatusDateElement()) {
43722        composeDateCore("statusDate", element.getStatusDateElement(), false);
43723        composeDateExtras("statusDate", element.getStatusDateElement(), false);
43724      }
43725      if (element.hasCreatedElement()) {
43726        composeDateTimeCore("created", element.getCreatedElement(), false);
43727        composeDateTimeExtras("created", element.getCreatedElement(), false);
43728      }
43729      if (element.hasTarget()) {
43730        composeReference("target", element.getTarget());
43731      }
43732      if (element.hasProvider()) {
43733        composeReference("provider", element.getProvider());
43734      }
43735      if (element.hasPaymentStatus()) {
43736        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
43737      }
43738  }
43739
43740  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
43741    if (element != null) {
43742      prop("resourceType", name);
43743      composePaymentReconciliationInner(element);
43744    }
43745  }
43746
43747  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
43748      composeDomainResourceElements(element);
43749      if (element.hasIdentifier()) {
43750        openArray("identifier");
43751        for (Identifier e : element.getIdentifier()) 
43752          composeIdentifier(null, e);
43753        closeArray();
43754      };
43755      if (element.hasStatusElement()) {
43756        composeEnumerationCore("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
43757        composeEnumerationExtras("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
43758      }
43759      if (element.hasPeriod()) {
43760        composePeriod("period", element.getPeriod());
43761      }
43762      if (element.hasCreatedElement()) {
43763        composeDateTimeCore("created", element.getCreatedElement(), false);
43764        composeDateTimeExtras("created", element.getCreatedElement(), false);
43765      }
43766      if (element.hasOrganization()) {
43767        composeReference("organization", element.getOrganization());
43768      }
43769      if (element.hasRequest()) {
43770        composeReference("request", element.getRequest());
43771      }
43772      if (element.hasOutcomeElement()) {
43773        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
43774        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
43775      }
43776      if (element.hasDispositionElement()) {
43777        composeStringCore("disposition", element.getDispositionElement(), false);
43778        composeStringExtras("disposition", element.getDispositionElement(), false);
43779      }
43780      if (element.hasRequestProvider()) {
43781        composeReference("requestProvider", element.getRequestProvider());
43782      }
43783      if (element.hasDetail()) {
43784        openArray("detail");
43785        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
43786          composePaymentReconciliationDetailsComponent(null, e);
43787        closeArray();
43788      };
43789      if (element.hasForm()) {
43790        composeCodeableConcept("form", element.getForm());
43791      }
43792      if (element.hasTotal()) {
43793        composeMoney("total", element.getTotal());
43794      }
43795      if (element.hasProcessNote()) {
43796        openArray("processNote");
43797        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
43798          composePaymentReconciliationNotesComponent(null, e);
43799        closeArray();
43800      };
43801  }
43802
43803  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
43804    if (element != null) {
43805      open(name);
43806      composePaymentReconciliationDetailsComponentInner(element);
43807      close();
43808    }
43809  }
43810
43811  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
43812      composeBackbone(element);
43813      if (element.hasType()) {
43814        composeCodeableConcept("type", element.getType());
43815      }
43816      if (element.hasRequest()) {
43817        composeReference("request", element.getRequest());
43818      }
43819      if (element.hasResponse()) {
43820        composeReference("response", element.getResponse());
43821      }
43822      if (element.hasSubmitter()) {
43823        composeReference("submitter", element.getSubmitter());
43824      }
43825      if (element.hasPayee()) {
43826        composeReference("payee", element.getPayee());
43827      }
43828      if (element.hasDateElement()) {
43829        composeDateCore("date", element.getDateElement(), false);
43830        composeDateExtras("date", element.getDateElement(), false);
43831      }
43832      if (element.hasAmount()) {
43833        composeMoney("amount", element.getAmount());
43834      }
43835  }
43836
43837  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
43838    if (element != null) {
43839      open(name);
43840      composePaymentReconciliationNotesComponentInner(element);
43841      close();
43842    }
43843  }
43844
43845  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
43846      composeBackbone(element);
43847      if (element.hasTypeElement()) {
43848        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
43849        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
43850      }
43851      if (element.hasTextElement()) {
43852        composeStringCore("text", element.getTextElement(), false);
43853        composeStringExtras("text", element.getTextElement(), false);
43854      }
43855  }
43856
43857  protected void composePerson(String name, Person element) throws IOException {
43858    if (element != null) {
43859      prop("resourceType", name);
43860      composePersonInner(element);
43861    }
43862  }
43863
43864  protected void composePersonInner(Person element) throws IOException {
43865      composeDomainResourceElements(element);
43866      if (element.hasIdentifier()) {
43867        openArray("identifier");
43868        for (Identifier e : element.getIdentifier()) 
43869          composeIdentifier(null, e);
43870        closeArray();
43871      };
43872      if (element.hasName()) {
43873        openArray("name");
43874        for (HumanName e : element.getName()) 
43875          composeHumanName(null, e);
43876        closeArray();
43877      };
43878      if (element.hasTelecom()) {
43879        openArray("telecom");
43880        for (ContactPoint e : element.getTelecom()) 
43881          composeContactPoint(null, e);
43882        closeArray();
43883      };
43884      if (element.hasGenderElement()) {
43885        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
43886        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
43887      }
43888      if (element.hasBirthDateElement()) {
43889        composeDateCore("birthDate", element.getBirthDateElement(), false);
43890        composeDateExtras("birthDate", element.getBirthDateElement(), false);
43891      }
43892      if (element.hasAddress()) {
43893        openArray("address");
43894        for (Address e : element.getAddress()) 
43895          composeAddress(null, e);
43896        closeArray();
43897      };
43898      if (element.hasPhoto()) {
43899        composeAttachment("photo", element.getPhoto());
43900      }
43901      if (element.hasManagingOrganization()) {
43902        composeReference("managingOrganization", element.getManagingOrganization());
43903      }
43904      if (element.hasActiveElement()) {
43905        composeBooleanCore("active", element.getActiveElement(), false);
43906        composeBooleanExtras("active", element.getActiveElement(), false);
43907      }
43908      if (element.hasLink()) {
43909        openArray("link");
43910        for (Person.PersonLinkComponent e : element.getLink()) 
43911          composePersonPersonLinkComponent(null, e);
43912        closeArray();
43913      };
43914  }
43915
43916  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
43917    if (element != null) {
43918      open(name);
43919      composePersonPersonLinkComponentInner(element);
43920      close();
43921    }
43922  }
43923
43924  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
43925      composeBackbone(element);
43926      if (element.hasTarget()) {
43927        composeReference("target", element.getTarget());
43928      }
43929      if (element.hasAssuranceElement()) {
43930        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
43931        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
43932      }
43933  }
43934
43935  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
43936    if (element != null) {
43937      prop("resourceType", name);
43938      composePlanDefinitionInner(element);
43939    }
43940  }
43941
43942  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
43943      composeDomainResourceElements(element);
43944      if (element.hasUrlElement()) {
43945        composeUriCore("url", element.getUrlElement(), false);
43946        composeUriExtras("url", element.getUrlElement(), false);
43947      }
43948      if (element.hasIdentifier()) {
43949        openArray("identifier");
43950        for (Identifier e : element.getIdentifier()) 
43951          composeIdentifier(null, e);
43952        closeArray();
43953      };
43954      if (element.hasVersionElement()) {
43955        composeStringCore("version", element.getVersionElement(), false);
43956        composeStringExtras("version", element.getVersionElement(), false);
43957      }
43958      if (element.hasNameElement()) {
43959        composeStringCore("name", element.getNameElement(), false);
43960        composeStringExtras("name", element.getNameElement(), false);
43961      }
43962      if (element.hasTitleElement()) {
43963        composeStringCore("title", element.getTitleElement(), false);
43964        composeStringExtras("title", element.getTitleElement(), false);
43965      }
43966      if (element.hasSubtitleElement()) {
43967        composeStringCore("subtitle", element.getSubtitleElement(), false);
43968        composeStringExtras("subtitle", element.getSubtitleElement(), false);
43969      }
43970      if (element.hasType()) {
43971        composeCodeableConcept("type", element.getType());
43972      }
43973      if (element.hasStatusElement()) {
43974        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43975        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43976      }
43977      if (element.hasExperimentalElement()) {
43978        composeBooleanCore("experimental", element.getExperimentalElement(), false);
43979        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
43980      }
43981      if (element.hasSubject()) {
43982        composeType("subject", element.getSubject());
43983      }
43984      if (element.hasDateElement()) {
43985        composeDateTimeCore("date", element.getDateElement(), false);
43986        composeDateTimeExtras("date", element.getDateElement(), false);
43987      }
43988      if (element.hasPublisherElement()) {
43989        composeStringCore("publisher", element.getPublisherElement(), false);
43990        composeStringExtras("publisher", element.getPublisherElement(), false);
43991      }
43992      if (element.hasContact()) {
43993        openArray("contact");
43994        for (ContactDetail e : element.getContact()) 
43995          composeContactDetail(null, e);
43996        closeArray();
43997      };
43998      if (element.hasDescriptionElement()) {
43999        composeMarkdownCore("description", element.getDescriptionElement(), false);
44000        composeMarkdownExtras("description", element.getDescriptionElement(), false);
44001      }
44002      if (element.hasUseContext()) {
44003        openArray("useContext");
44004        for (UsageContext e : element.getUseContext()) 
44005          composeUsageContext(null, e);
44006        closeArray();
44007      };
44008      if (element.hasJurisdiction()) {
44009        openArray("jurisdiction");
44010        for (CodeableConcept e : element.getJurisdiction()) 
44011          composeCodeableConcept(null, e);
44012        closeArray();
44013      };
44014      if (element.hasPurposeElement()) {
44015        composeMarkdownCore("purpose", element.getPurposeElement(), false);
44016        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
44017      }
44018      if (element.hasUsageElement()) {
44019        composeStringCore("usage", element.getUsageElement(), false);
44020        composeStringExtras("usage", element.getUsageElement(), false);
44021      }
44022      if (element.hasCopyrightElement()) {
44023        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
44024        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
44025      }
44026      if (element.hasApprovalDateElement()) {
44027        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
44028        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
44029      }
44030      if (element.hasLastReviewDateElement()) {
44031        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
44032        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
44033      }
44034      if (element.hasEffectivePeriod()) {
44035        composePeriod("effectivePeriod", element.getEffectivePeriod());
44036      }
44037      if (element.hasTopic()) {
44038        openArray("topic");
44039        for (CodeableConcept e : element.getTopic()) 
44040          composeCodeableConcept(null, e);
44041        closeArray();
44042      };
44043      if (element.hasContributor()) {
44044        openArray("contributor");
44045        for (Contributor e : element.getContributor()) 
44046          composeContributor(null, e);
44047        closeArray();
44048      };
44049      if (element.hasRelatedArtifact()) {
44050        openArray("relatedArtifact");
44051        for (RelatedArtifact e : element.getRelatedArtifact()) 
44052          composeRelatedArtifact(null, e);
44053        closeArray();
44054      };
44055      if (element.hasLibrary()) {
44056        openArray("library");
44057        for (CanonicalType e : element.getLibrary()) 
44058          composeCanonicalCore(null, e, true);
44059        closeArray();
44060        if (anyHasExtras(element.getLibrary())) {
44061          openArray("_library");
44062          for (CanonicalType e : element.getLibrary()) 
44063            composeCanonicalExtras(null, e, true);
44064          closeArray();
44065        }
44066      };
44067      if (element.hasGoal()) {
44068        openArray("goal");
44069        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
44070          composePlanDefinitionPlanDefinitionGoalComponent(null, e);
44071        closeArray();
44072      };
44073      if (element.hasAction()) {
44074        openArray("action");
44075        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
44076          composePlanDefinitionPlanDefinitionActionComponent(null, e);
44077        closeArray();
44078      };
44079  }
44080
44081  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
44082    if (element != null) {
44083      open(name);
44084      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
44085      close();
44086    }
44087  }
44088
44089  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
44090      composeBackbone(element);
44091      if (element.hasCategory()) {
44092        composeCodeableConcept("category", element.getCategory());
44093      }
44094      if (element.hasDescription()) {
44095        composeCodeableConcept("description", element.getDescription());
44096      }
44097      if (element.hasPriority()) {
44098        composeCodeableConcept("priority", element.getPriority());
44099      }
44100      if (element.hasStart()) {
44101        composeCodeableConcept("start", element.getStart());
44102      }
44103      if (element.hasAddresses()) {
44104        openArray("addresses");
44105        for (CodeableConcept e : element.getAddresses()) 
44106          composeCodeableConcept(null, e);
44107        closeArray();
44108      };
44109      if (element.hasDocumentation()) {
44110        openArray("documentation");
44111        for (RelatedArtifact e : element.getDocumentation()) 
44112          composeRelatedArtifact(null, e);
44113        closeArray();
44114      };
44115      if (element.hasTarget()) {
44116        openArray("target");
44117        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
44118          composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
44119        closeArray();
44120      };
44121  }
44122
44123  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
44124    if (element != null) {
44125      open(name);
44126      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
44127      close();
44128    }
44129  }
44130
44131  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
44132      composeBackbone(element);
44133      if (element.hasMeasure()) {
44134        composeCodeableConcept("measure", element.getMeasure());
44135      }
44136      if (element.hasDetail()) {
44137        composeType("detail", element.getDetail());
44138      }
44139      if (element.hasDue()) {
44140        composeDuration("due", element.getDue());
44141      }
44142  }
44143
44144  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
44145    if (element != null) {
44146      open(name);
44147      composePlanDefinitionPlanDefinitionActionComponentInner(element);
44148      close();
44149    }
44150  }
44151
44152  protected void composePlanDefinitionPlanDefinitionActionComponentInner(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
44153      composeBackbone(element);
44154      if (element.hasPrefixElement()) {
44155        composeStringCore("prefix", element.getPrefixElement(), false);
44156        composeStringExtras("prefix", element.getPrefixElement(), false);
44157      }
44158      if (element.hasTitleElement()) {
44159        composeStringCore("title", element.getTitleElement(), false);
44160        composeStringExtras("title", element.getTitleElement(), false);
44161      }
44162      if (element.hasDescriptionElement()) {
44163        composeStringCore("description", element.getDescriptionElement(), false);
44164        composeStringExtras("description", element.getDescriptionElement(), false);
44165      }
44166      if (element.hasTextEquivalentElement()) {
44167        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
44168        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
44169      }
44170      if (element.hasCode()) {
44171        openArray("code");
44172        for (CodeableConcept e : element.getCode()) 
44173          composeCodeableConcept(null, e);
44174        closeArray();
44175      };
44176      if (element.hasReason()) {
44177        openArray("reason");
44178        for (CodeableConcept e : element.getReason()) 
44179          composeCodeableConcept(null, e);
44180        closeArray();
44181      };
44182      if (element.hasDocumentation()) {
44183        openArray("documentation");
44184        for (RelatedArtifact e : element.getDocumentation()) 
44185          composeRelatedArtifact(null, e);
44186        closeArray();
44187      };
44188      if (element.hasGoalId()) {
44189        openArray("goalId");
44190        for (IdType e : element.getGoalId()) 
44191          composeIdCore(null, e, true);
44192        closeArray();
44193        if (anyHasExtras(element.getGoalId())) {
44194          openArray("_goalId");
44195          for (IdType e : element.getGoalId()) 
44196            composeIdExtras(null, e, true);
44197          closeArray();
44198        }
44199      };
44200      if (element.hasTrigger()) {
44201        openArray("trigger");
44202        for (TriggerDefinition e : element.getTrigger()) 
44203          composeTriggerDefinition(null, e);
44204        closeArray();
44205      };
44206      if (element.hasCondition()) {
44207        openArray("condition");
44208        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
44209          composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
44210        closeArray();
44211      };
44212      if (element.hasInput()) {
44213        openArray("input");
44214        for (DataRequirement e : element.getInput()) 
44215          composeDataRequirement(null, e);
44216        closeArray();
44217      };
44218      if (element.hasOutput()) {
44219        openArray("output");
44220        for (DataRequirement e : element.getOutput()) 
44221          composeDataRequirement(null, e);
44222        closeArray();
44223      };
44224      if (element.hasRelatedAction()) {
44225        openArray("relatedAction");
44226        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
44227          composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
44228        closeArray();
44229      };
44230      if (element.hasTiming()) {
44231        composeType("timing", element.getTiming());
44232      }
44233      if (element.hasParticipant()) {
44234        openArray("participant");
44235        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
44236          composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
44237        closeArray();
44238      };
44239      if (element.hasType()) {
44240        composeCodeableConcept("type", element.getType());
44241      }
44242      if (element.hasGroupingBehaviorElement()) {
44243        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
44244        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
44245      }
44246      if (element.hasSelectionBehaviorElement()) {
44247        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
44248        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
44249      }
44250      if (element.hasRequiredBehaviorElement()) {
44251        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
44252        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
44253      }
44254      if (element.hasPrecheckBehaviorElement()) {
44255        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
44256        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
44257      }
44258      if (element.hasCardinalityBehaviorElement()) {
44259        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
44260        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
44261      }
44262      if (element.hasDefinitionElement()) {
44263        composeCanonicalCore("definition", element.getDefinitionElement(), false);
44264        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
44265      }
44266      if (element.hasTransformElement()) {
44267        composeCanonicalCore("transform", element.getTransformElement(), false);
44268        composeCanonicalExtras("transform", element.getTransformElement(), false);
44269      }
44270      if (element.hasDynamicValue()) {
44271        openArray("dynamicValue");
44272        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
44273          composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
44274        closeArray();
44275      };
44276      if (element.hasAction()) {
44277        openArray("action");
44278        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
44279          composePlanDefinitionPlanDefinitionActionComponent(null, e);
44280        closeArray();
44281      };
44282  }
44283
44284  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
44285    if (element != null) {
44286      open(name);
44287      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
44288      close();
44289    }
44290  }
44291
44292  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
44293      composeBackbone(element);
44294      if (element.hasKindElement()) {
44295        composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
44296        composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
44297      }
44298      if (element.hasDescriptionElement()) {
44299        composeStringCore("description", element.getDescriptionElement(), false);
44300        composeStringExtras("description", element.getDescriptionElement(), false);
44301      }
44302      if (element.hasLanguageElement()) {
44303        composeStringCore("language", element.getLanguageElement(), false);
44304        composeStringExtras("language", element.getLanguageElement(), false);
44305      }
44306      if (element.hasExpressionElement()) {
44307        composeStringCore("expression", element.getExpressionElement(), false);
44308        composeStringExtras("expression", element.getExpressionElement(), false);
44309      }
44310  }
44311
44312  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
44313    if (element != null) {
44314      open(name);
44315      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
44316      close();
44317    }
44318  }
44319
44320  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
44321      composeBackbone(element);
44322      if (element.hasActionIdElement()) {
44323        composeIdCore("actionId", element.getActionIdElement(), false);
44324        composeIdExtras("actionId", element.getActionIdElement(), false);
44325      }
44326      if (element.hasRelationshipElement()) {
44327        composeEnumerationCore("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
44328        composeEnumerationExtras("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
44329      }
44330      if (element.hasOffset()) {
44331        composeType("offset", element.getOffset());
44332      }
44333  }
44334
44335  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
44336    if (element != null) {
44337      open(name);
44338      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
44339      close();
44340    }
44341  }
44342
44343  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
44344      composeBackbone(element);
44345      if (element.hasTypeElement()) {
44346        composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
44347        composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
44348      }
44349      if (element.hasRole()) {
44350        composeCodeableConcept("role", element.getRole());
44351      }
44352  }
44353
44354  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
44355    if (element != null) {
44356      open(name);
44357      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
44358      close();
44359    }
44360  }
44361
44362  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
44363      composeBackbone(element);
44364      if (element.hasDescriptionElement()) {
44365        composeStringCore("description", element.getDescriptionElement(), false);
44366        composeStringExtras("description", element.getDescriptionElement(), false);
44367      }
44368      if (element.hasPathElement()) {
44369        composeStringCore("path", element.getPathElement(), false);
44370        composeStringExtras("path", element.getPathElement(), false);
44371      }
44372      if (element.hasLanguageElement()) {
44373        composeStringCore("language", element.getLanguageElement(), false);
44374        composeStringExtras("language", element.getLanguageElement(), false);
44375      }
44376      if (element.hasExpressionElement()) {
44377        composeStringCore("expression", element.getExpressionElement(), false);
44378        composeStringExtras("expression", element.getExpressionElement(), false);
44379      }
44380  }
44381
44382  protected void composePractitioner(String name, Practitioner element) throws IOException {
44383    if (element != null) {
44384      prop("resourceType", name);
44385      composePractitionerInner(element);
44386    }
44387  }
44388
44389  protected void composePractitionerInner(Practitioner element) throws IOException {
44390      composeDomainResourceElements(element);
44391      if (element.hasIdentifier()) {
44392        openArray("identifier");
44393        for (Identifier e : element.getIdentifier()) 
44394          composeIdentifier(null, e);
44395        closeArray();
44396      };
44397      if (element.hasActiveElement()) {
44398        composeBooleanCore("active", element.getActiveElement(), false);
44399        composeBooleanExtras("active", element.getActiveElement(), false);
44400      }
44401      if (element.hasName()) {
44402        openArray("name");
44403        for (HumanName e : element.getName()) 
44404          composeHumanName(null, e);
44405        closeArray();
44406      };
44407      if (element.hasTelecom()) {
44408        openArray("telecom");
44409        for (ContactPoint e : element.getTelecom()) 
44410          composeContactPoint(null, e);
44411        closeArray();
44412      };
44413      if (element.hasAddress()) {
44414        openArray("address");
44415        for (Address e : element.getAddress()) 
44416          composeAddress(null, e);
44417        closeArray();
44418      };
44419      if (element.hasGenderElement()) {
44420        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
44421        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
44422      }
44423      if (element.hasBirthDateElement()) {
44424        composeDateCore("birthDate", element.getBirthDateElement(), false);
44425        composeDateExtras("birthDate", element.getBirthDateElement(), false);
44426      }
44427      if (element.hasPhoto()) {
44428        openArray("photo");
44429        for (Attachment e : element.getPhoto()) 
44430          composeAttachment(null, e);
44431        closeArray();
44432      };
44433      if (element.hasQualification()) {
44434        openArray("qualification");
44435        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
44436          composePractitionerPractitionerQualificationComponent(null, e);
44437        closeArray();
44438      };
44439      if (element.hasCommunication()) {
44440        openArray("communication");
44441        for (CodeableConcept e : element.getCommunication()) 
44442          composeCodeableConcept(null, e);
44443        closeArray();
44444      };
44445  }
44446
44447  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
44448    if (element != null) {
44449      open(name);
44450      composePractitionerPractitionerQualificationComponentInner(element);
44451      close();
44452    }
44453  }
44454
44455  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
44456      composeBackbone(element);
44457      if (element.hasIdentifier()) {
44458        openArray("identifier");
44459        for (Identifier e : element.getIdentifier()) 
44460          composeIdentifier(null, e);
44461        closeArray();
44462      };
44463      if (element.hasCode()) {
44464        composeCodeableConcept("code", element.getCode());
44465      }
44466      if (element.hasPeriod()) {
44467        composePeriod("period", element.getPeriod());
44468      }
44469      if (element.hasIssuer()) {
44470        composeReference("issuer", element.getIssuer());
44471      }
44472  }
44473
44474  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
44475    if (element != null) {
44476      prop("resourceType", name);
44477      composePractitionerRoleInner(element);
44478    }
44479  }
44480
44481  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
44482      composeDomainResourceElements(element);
44483      if (element.hasIdentifier()) {
44484        openArray("identifier");
44485        for (Identifier e : element.getIdentifier()) 
44486          composeIdentifier(null, e);
44487        closeArray();
44488      };
44489      if (element.hasActiveElement()) {
44490        composeBooleanCore("active", element.getActiveElement(), false);
44491        composeBooleanExtras("active", element.getActiveElement(), false);
44492      }
44493      if (element.hasPeriod()) {
44494        composePeriod("period", element.getPeriod());
44495      }
44496      if (element.hasPractitioner()) {
44497        composeReference("practitioner", element.getPractitioner());
44498      }
44499      if (element.hasOrganization()) {
44500        composeReference("organization", element.getOrganization());
44501      }
44502      if (element.hasCode()) {
44503        openArray("code");
44504        for (CodeableConcept e : element.getCode()) 
44505          composeCodeableConcept(null, e);
44506        closeArray();
44507      };
44508      if (element.hasSpecialty()) {
44509        openArray("specialty");
44510        for (CodeableConcept e : element.getSpecialty()) 
44511          composeCodeableConcept(null, e);
44512        closeArray();
44513      };
44514      if (element.hasLocation()) {
44515        openArray("location");
44516        for (Reference e : element.getLocation()) 
44517          composeReference(null, e);
44518        closeArray();
44519      };
44520      if (element.hasHealthcareService()) {
44521        openArray("healthcareService");
44522        for (Reference e : element.getHealthcareService()) 
44523          composeReference(null, e);
44524        closeArray();
44525      };
44526      if (element.hasTelecom()) {
44527        openArray("telecom");
44528        for (ContactPoint e : element.getTelecom()) 
44529          composeContactPoint(null, e);
44530        closeArray();
44531      };
44532      if (element.hasAvailableTime()) {
44533        openArray("availableTime");
44534        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
44535          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
44536        closeArray();
44537      };
44538      if (element.hasNotAvailable()) {
44539        openArray("notAvailable");
44540        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
44541          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
44542        closeArray();
44543      };
44544      if (element.hasAvailabilityExceptionsElement()) {
44545        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
44546        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
44547      }
44548      if (element.hasEndpoint()) {
44549        openArray("endpoint");
44550        for (Reference e : element.getEndpoint()) 
44551          composeReference(null, e);
44552        closeArray();
44553      };
44554  }
44555
44556  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
44557    if (element != null) {
44558      open(name);
44559      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
44560      close();
44561    }
44562  }
44563
44564  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
44565      composeBackbone(element);
44566      if (element.hasDaysOfWeek()) {
44567        openArray("daysOfWeek");
44568        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
44569          composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
44570        closeArray();
44571        if (anyHasExtras(element.getDaysOfWeek())) {
44572          openArray("_daysOfWeek");
44573          for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
44574            composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
44575          closeArray();
44576        }
44577      };
44578      if (element.hasAllDayElement()) {
44579        composeBooleanCore("allDay", element.getAllDayElement(), false);
44580        composeBooleanExtras("allDay", element.getAllDayElement(), false);
44581      }
44582      if (element.hasAvailableStartTimeElement()) {
44583        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
44584        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
44585      }
44586      if (element.hasAvailableEndTimeElement()) {
44587        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
44588        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
44589      }
44590  }
44591
44592  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
44593    if (element != null) {
44594      open(name);
44595      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
44596      close();
44597    }
44598  }
44599
44600  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
44601      composeBackbone(element);
44602      if (element.hasDescriptionElement()) {
44603        composeStringCore("description", element.getDescriptionElement(), false);
44604        composeStringExtras("description", element.getDescriptionElement(), false);
44605      }
44606      if (element.hasDuring()) {
44607        composePeriod("during", element.getDuring());
44608      }
44609  }
44610
44611  protected void composeProcedure(String name, Procedure element) throws IOException {
44612    if (element != null) {
44613      prop("resourceType", name);
44614      composeProcedureInner(element);
44615    }
44616  }
44617
44618  protected void composeProcedureInner(Procedure element) throws IOException {
44619      composeDomainResourceElements(element);
44620      if (element.hasIdentifier()) {
44621        openArray("identifier");
44622        for (Identifier e : element.getIdentifier()) 
44623          composeIdentifier(null, e);
44624        closeArray();
44625      };
44626      if (element.hasInstantiates()) {
44627        openArray("instantiates");
44628        for (UriType e : element.getInstantiates()) 
44629          composeUriCore(null, e, true);
44630        closeArray();
44631        if (anyHasExtras(element.getInstantiates())) {
44632          openArray("_instantiates");
44633          for (UriType e : element.getInstantiates()) 
44634            composeUriExtras(null, e, true);
44635          closeArray();
44636        }
44637      };
44638      if (element.hasBasedOn()) {
44639        openArray("basedOn");
44640        for (Reference e : element.getBasedOn()) 
44641          composeReference(null, e);
44642        closeArray();
44643      };
44644      if (element.hasPartOf()) {
44645        openArray("partOf");
44646        for (Reference e : element.getPartOf()) 
44647          composeReference(null, e);
44648        closeArray();
44649      };
44650      if (element.hasStatusElement()) {
44651        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
44652        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
44653      }
44654      if (element.hasStatusReason()) {
44655        composeCodeableConcept("statusReason", element.getStatusReason());
44656      }
44657      if (element.hasCategory()) {
44658        composeCodeableConcept("category", element.getCategory());
44659      }
44660      if (element.hasCode()) {
44661        composeCodeableConcept("code", element.getCode());
44662      }
44663      if (element.hasSubject()) {
44664        composeReference("subject", element.getSubject());
44665      }
44666      if (element.hasContext()) {
44667        composeReference("context", element.getContext());
44668      }
44669      if (element.hasPerformed()) {
44670        composeType("performed", element.getPerformed());
44671      }
44672      if (element.hasRecorder()) {
44673        composeReference("recorder", element.getRecorder());
44674      }
44675      if (element.hasAsserter()) {
44676        composeReference("asserter", element.getAsserter());
44677      }
44678      if (element.hasPerformer()) {
44679        openArray("performer");
44680        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
44681          composeProcedureProcedurePerformerComponent(null, e);
44682        closeArray();
44683      };
44684      if (element.hasLocation()) {
44685        composeReference("location", element.getLocation());
44686      }
44687      if (element.hasReasonCode()) {
44688        openArray("reasonCode");
44689        for (CodeableConcept e : element.getReasonCode()) 
44690          composeCodeableConcept(null, e);
44691        closeArray();
44692      };
44693      if (element.hasReasonReference()) {
44694        openArray("reasonReference");
44695        for (Reference e : element.getReasonReference()) 
44696          composeReference(null, e);
44697        closeArray();
44698      };
44699      if (element.hasBodySite()) {
44700        openArray("bodySite");
44701        for (CodeableConcept e : element.getBodySite()) 
44702          composeCodeableConcept(null, e);
44703        closeArray();
44704      };
44705      if (element.hasOutcome()) {
44706        composeCodeableConcept("outcome", element.getOutcome());
44707      }
44708      if (element.hasReport()) {
44709        openArray("report");
44710        for (Reference e : element.getReport()) 
44711          composeReference(null, e);
44712        closeArray();
44713      };
44714      if (element.hasComplication()) {
44715        openArray("complication");
44716        for (CodeableConcept e : element.getComplication()) 
44717          composeCodeableConcept(null, e);
44718        closeArray();
44719      };
44720      if (element.hasComplicationDetail()) {
44721        openArray("complicationDetail");
44722        for (Reference e : element.getComplicationDetail()) 
44723          composeReference(null, e);
44724        closeArray();
44725      };
44726      if (element.hasFollowUp()) {
44727        openArray("followUp");
44728        for (CodeableConcept e : element.getFollowUp()) 
44729          composeCodeableConcept(null, e);
44730        closeArray();
44731      };
44732      if (element.hasNote()) {
44733        openArray("note");
44734        for (Annotation e : element.getNote()) 
44735          composeAnnotation(null, e);
44736        closeArray();
44737      };
44738      if (element.hasFocalDevice()) {
44739        openArray("focalDevice");
44740        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
44741          composeProcedureProcedureFocalDeviceComponent(null, e);
44742        closeArray();
44743      };
44744      if (element.hasUsedReference()) {
44745        openArray("usedReference");
44746        for (Reference e : element.getUsedReference()) 
44747          composeReference(null, e);
44748        closeArray();
44749      };
44750      if (element.hasUsedCode()) {
44751        openArray("usedCode");
44752        for (CodeableConcept e : element.getUsedCode()) 
44753          composeCodeableConcept(null, e);
44754        closeArray();
44755      };
44756  }
44757
44758  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
44759    if (element != null) {
44760      open(name);
44761      composeProcedureProcedurePerformerComponentInner(element);
44762      close();
44763    }
44764  }
44765
44766  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
44767      composeBackbone(element);
44768      if (element.hasRole()) {
44769        composeCodeableConcept("role", element.getRole());
44770      }
44771      if (element.hasActor()) {
44772        composeReference("actor", element.getActor());
44773      }
44774      if (element.hasOnBehalfOf()) {
44775        composeReference("onBehalfOf", element.getOnBehalfOf());
44776      }
44777  }
44778
44779  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
44780    if (element != null) {
44781      open(name);
44782      composeProcedureProcedureFocalDeviceComponentInner(element);
44783      close();
44784    }
44785  }
44786
44787  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
44788      composeBackbone(element);
44789      if (element.hasAction()) {
44790        composeCodeableConcept("action", element.getAction());
44791      }
44792      if (element.hasManipulated()) {
44793        composeReference("manipulated", element.getManipulated());
44794      }
44795  }
44796
44797  protected void composeProcessRequest(String name, ProcessRequest element) throws IOException {
44798    if (element != null) {
44799      prop("resourceType", name);
44800      composeProcessRequestInner(element);
44801    }
44802  }
44803
44804  protected void composeProcessRequestInner(ProcessRequest element) throws IOException {
44805      composeDomainResourceElements(element);
44806      if (element.hasIdentifier()) {
44807        openArray("identifier");
44808        for (Identifier e : element.getIdentifier()) 
44809          composeIdentifier(null, e);
44810        closeArray();
44811      };
44812      if (element.hasStatusElement()) {
44813        composeEnumerationCore("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory(), false);
44814        composeEnumerationExtras("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory(), false);
44815      }
44816      if (element.hasActionElement()) {
44817        composeEnumerationCore("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
44818        composeEnumerationExtras("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
44819      }
44820      if (element.hasTarget()) {
44821        composeReference("target", element.getTarget());
44822      }
44823      if (element.hasCreatedElement()) {
44824        composeDateTimeCore("created", element.getCreatedElement(), false);
44825        composeDateTimeExtras("created", element.getCreatedElement(), false);
44826      }
44827      if (element.hasProvider()) {
44828        composeReference("provider", element.getProvider());
44829      }
44830      if (element.hasRequest()) {
44831        composeReference("request", element.getRequest());
44832      }
44833      if (element.hasResponse()) {
44834        composeReference("response", element.getResponse());
44835      }
44836      if (element.hasNullifyElement()) {
44837        composeBooleanCore("nullify", element.getNullifyElement(), false);
44838        composeBooleanExtras("nullify", element.getNullifyElement(), false);
44839      }
44840      if (element.hasReferenceElement()) {
44841        composeStringCore("reference", element.getReferenceElement(), false);
44842        composeStringExtras("reference", element.getReferenceElement(), false);
44843      }
44844      if (element.hasItem()) {
44845        openArray("item");
44846        for (ProcessRequest.ItemsComponent e : element.getItem()) 
44847          composeProcessRequestItemsComponent(null, e);
44848        closeArray();
44849      };
44850      if (element.hasInclude()) {
44851        openArray("include");
44852        for (StringType e : element.getInclude()) 
44853          composeStringCore(null, e, true);
44854        closeArray();
44855        if (anyHasExtras(element.getInclude())) {
44856          openArray("_include");
44857          for (StringType e : element.getInclude()) 
44858            composeStringExtras(null, e, true);
44859          closeArray();
44860        }
44861      };
44862      if (element.hasExclude()) {
44863        openArray("exclude");
44864        for (StringType e : element.getExclude()) 
44865          composeStringCore(null, e, true);
44866        closeArray();
44867        if (anyHasExtras(element.getExclude())) {
44868          openArray("_exclude");
44869          for (StringType e : element.getExclude()) 
44870            composeStringExtras(null, e, true);
44871          closeArray();
44872        }
44873      };
44874      if (element.hasPeriod()) {
44875        composePeriod("period", element.getPeriod());
44876      }
44877  }
44878
44879  protected void composeProcessRequestItemsComponent(String name, ProcessRequest.ItemsComponent element) throws IOException {
44880    if (element != null) {
44881      open(name);
44882      composeProcessRequestItemsComponentInner(element);
44883      close();
44884    }
44885  }
44886
44887  protected void composeProcessRequestItemsComponentInner(ProcessRequest.ItemsComponent element) throws IOException {
44888      composeBackbone(element);
44889      if (element.hasSequenceLinkIdElement()) {
44890        composeIntegerCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
44891        composeIntegerExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
44892      }
44893  }
44894
44895  protected void composeProcessResponse(String name, ProcessResponse element) throws IOException {
44896    if (element != null) {
44897      prop("resourceType", name);
44898      composeProcessResponseInner(element);
44899    }
44900  }
44901
44902  protected void composeProcessResponseInner(ProcessResponse element) throws IOException {
44903      composeDomainResourceElements(element);
44904      if (element.hasIdentifier()) {
44905        openArray("identifier");
44906        for (Identifier e : element.getIdentifier()) 
44907          composeIdentifier(null, e);
44908        closeArray();
44909      };
44910      if (element.hasStatusElement()) {
44911        composeEnumerationCore("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory(), false);
44912        composeEnumerationExtras("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory(), false);
44913      }
44914      if (element.hasCreatedElement()) {
44915        composeDateTimeCore("created", element.getCreatedElement(), false);
44916        composeDateTimeExtras("created", element.getCreatedElement(), false);
44917      }
44918      if (element.hasOrganization()) {
44919        composeReference("organization", element.getOrganization());
44920      }
44921      if (element.hasRequest()) {
44922        composeReference("request", element.getRequest());
44923      }
44924      if (element.hasOutcomeElement()) {
44925        composeEnumerationCore("outcome", element.getOutcomeElement(), new ProcessResponse.ProcessingOutcomeEnumFactory(), false);
44926        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ProcessResponse.ProcessingOutcomeEnumFactory(), false);
44927      }
44928      if (element.hasDispositionElement()) {
44929        composeStringCore("disposition", element.getDispositionElement(), false);
44930        composeStringExtras("disposition", element.getDispositionElement(), false);
44931      }
44932      if (element.hasRequestProvider()) {
44933        composeReference("requestProvider", element.getRequestProvider());
44934      }
44935      if (element.hasForm()) {
44936        composeCodeableConcept("form", element.getForm());
44937      }
44938      if (element.hasProcessNote()) {
44939        openArray("processNote");
44940        for (ProcessResponse.ProcessResponseProcessNoteComponent e : element.getProcessNote()) 
44941          composeProcessResponseProcessResponseProcessNoteComponent(null, e);
44942        closeArray();
44943      };
44944      if (element.hasError()) {
44945        openArray("error");
44946        for (CodeableConcept e : element.getError()) 
44947          composeCodeableConcept(null, e);
44948        closeArray();
44949      };
44950      if (element.hasCommunicationRequest()) {
44951        openArray("communicationRequest");
44952        for (Reference e : element.getCommunicationRequest()) 
44953          composeReference(null, e);
44954        closeArray();
44955      };
44956  }
44957
44958  protected void composeProcessResponseProcessResponseProcessNoteComponent(String name, ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
44959    if (element != null) {
44960      open(name);
44961      composeProcessResponseProcessResponseProcessNoteComponentInner(element);
44962      close();
44963    }
44964  }
44965
44966  protected void composeProcessResponseProcessResponseProcessNoteComponentInner(ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
44967      composeBackbone(element);
44968      if (element.hasTypeElement()) {
44969        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
44970        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
44971      }
44972      if (element.hasTextElement()) {
44973        composeStringCore("text", element.getTextElement(), false);
44974        composeStringExtras("text", element.getTextElement(), false);
44975      }
44976  }
44977
44978  protected void composeProductPlan(String name, ProductPlan element) throws IOException {
44979    if (element != null) {
44980      prop("resourceType", name);
44981      composeProductPlanInner(element);
44982    }
44983  }
44984
44985  protected void composeProductPlanInner(ProductPlan element) throws IOException {
44986      composeDomainResourceElements(element);
44987      if (element.hasIdentifier()) {
44988        openArray("identifier");
44989        for (Identifier e : element.getIdentifier()) 
44990          composeIdentifier(null, e);
44991        closeArray();
44992      };
44993      if (element.hasStatusElement()) {
44994        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44995        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44996      }
44997      if (element.hasType()) {
44998        openArray("type");
44999        for (CodeableConcept e : element.getType()) 
45000          composeCodeableConcept(null, e);
45001        closeArray();
45002      };
45003      if (element.hasNameElement()) {
45004        composeStringCore("name", element.getNameElement(), false);
45005        composeStringExtras("name", element.getNameElement(), false);
45006      }
45007      if (element.hasAlias()) {
45008        openArray("alias");
45009        for (StringType e : element.getAlias()) 
45010          composeStringCore(null, e, true);
45011        closeArray();
45012        if (anyHasExtras(element.getAlias())) {
45013          openArray("_alias");
45014          for (StringType e : element.getAlias()) 
45015            composeStringExtras(null, e, true);
45016          closeArray();
45017        }
45018      };
45019      if (element.hasPeriod()) {
45020        composePeriod("period", element.getPeriod());
45021      }
45022      if (element.hasOwnedBy()) {
45023        composeReference("ownedBy", element.getOwnedBy());
45024      }
45025      if (element.hasAdministeredBy()) {
45026        composeReference("administeredBy", element.getAdministeredBy());
45027      }
45028      if (element.hasCoverageArea()) {
45029        composeReference("coverageArea", element.getCoverageArea());
45030      }
45031      if (element.hasContact()) {
45032        openArray("contact");
45033        for (ProductPlan.ProductPlanContactComponent e : element.getContact()) 
45034          composeProductPlanProductPlanContactComponent(null, e);
45035        closeArray();
45036      };
45037      if (element.hasEndpoint()) {
45038        openArray("endpoint");
45039        for (Reference e : element.getEndpoint()) 
45040          composeReference(null, e);
45041        closeArray();
45042      };
45043      if (element.hasNetwork()) {
45044        openArray("network");
45045        for (Reference e : element.getNetwork()) 
45046          composeReference(null, e);
45047        closeArray();
45048      };
45049      if (element.hasCoverage()) {
45050        openArray("coverage");
45051        for (ProductPlan.ProductPlanCoverageComponent e : element.getCoverage()) 
45052          composeProductPlanProductPlanCoverageComponent(null, e);
45053        closeArray();
45054      };
45055      if (element.hasPlan()) {
45056        openArray("plan");
45057        for (ProductPlan.ProductPlanPlanComponent e : element.getPlan()) 
45058          composeProductPlanProductPlanPlanComponent(null, e);
45059        closeArray();
45060      };
45061  }
45062
45063  protected void composeProductPlanProductPlanContactComponent(String name, ProductPlan.ProductPlanContactComponent element) throws IOException {
45064    if (element != null) {
45065      open(name);
45066      composeProductPlanProductPlanContactComponentInner(element);
45067      close();
45068    }
45069  }
45070
45071  protected void composeProductPlanProductPlanContactComponentInner(ProductPlan.ProductPlanContactComponent element) throws IOException {
45072      composeBackbone(element);
45073      if (element.hasPurpose()) {
45074        composeCodeableConcept("purpose", element.getPurpose());
45075      }
45076      if (element.hasName()) {
45077        composeHumanName("name", element.getName());
45078      }
45079      if (element.hasTelecom()) {
45080        openArray("telecom");
45081        for (ContactPoint e : element.getTelecom()) 
45082          composeContactPoint(null, e);
45083        closeArray();
45084      };
45085      if (element.hasAddress()) {
45086        composeAddress("address", element.getAddress());
45087      }
45088  }
45089
45090  protected void composeProductPlanProductPlanCoverageComponent(String name, ProductPlan.ProductPlanCoverageComponent element) throws IOException {
45091    if (element != null) {
45092      open(name);
45093      composeProductPlanProductPlanCoverageComponentInner(element);
45094      close();
45095    }
45096  }
45097
45098  protected void composeProductPlanProductPlanCoverageComponentInner(ProductPlan.ProductPlanCoverageComponent element) throws IOException {
45099      composeBackbone(element);
45100      if (element.hasType()) {
45101        composeCodeableConcept("type", element.getType());
45102      }
45103      if (element.hasNetwork()) {
45104        openArray("network");
45105        for (Reference e : element.getNetwork()) 
45106          composeReference(null, e);
45107        closeArray();
45108      };
45109      if (element.hasBenefit()) {
45110        openArray("benefit");
45111        for (ProductPlan.ProductPlanCoverageBenefitComponent e : element.getBenefit()) 
45112          composeProductPlanProductPlanCoverageBenefitComponent(null, e);
45113        closeArray();
45114      };
45115  }
45116
45117  protected void composeProductPlanProductPlanCoverageBenefitComponent(String name, ProductPlan.ProductPlanCoverageBenefitComponent element) throws IOException {
45118    if (element != null) {
45119      open(name);
45120      composeProductPlanProductPlanCoverageBenefitComponentInner(element);
45121      close();
45122    }
45123  }
45124
45125  protected void composeProductPlanProductPlanCoverageBenefitComponentInner(ProductPlan.ProductPlanCoverageBenefitComponent element) throws IOException {
45126      composeBackbone(element);
45127      if (element.hasType()) {
45128        composeCodeableConcept("type", element.getType());
45129      }
45130      if (element.hasRequirementElement()) {
45131        composeStringCore("requirement", element.getRequirementElement(), false);
45132        composeStringExtras("requirement", element.getRequirementElement(), false);
45133      }
45134      if (element.hasLimit()) {
45135        openArray("limit");
45136        for (ProductPlan.ProductPlanCoverageBenefitLimitComponent e : element.getLimit()) 
45137          composeProductPlanProductPlanCoverageBenefitLimitComponent(null, e);
45138        closeArray();
45139      };
45140  }
45141
45142  protected void composeProductPlanProductPlanCoverageBenefitLimitComponent(String name, ProductPlan.ProductPlanCoverageBenefitLimitComponent element) throws IOException {
45143    if (element != null) {
45144      open(name);
45145      composeProductPlanProductPlanCoverageBenefitLimitComponentInner(element);
45146      close();
45147    }
45148  }
45149
45150  protected void composeProductPlanProductPlanCoverageBenefitLimitComponentInner(ProductPlan.ProductPlanCoverageBenefitLimitComponent element) throws IOException {
45151      composeBackbone(element);
45152      if (element.hasValue()) {
45153        composeQuantity("value", element.getValue());
45154      }
45155      if (element.hasCode()) {
45156        composeCodeableConcept("code", element.getCode());
45157      }
45158  }
45159
45160  protected void composeProductPlanProductPlanPlanComponent(String name, ProductPlan.ProductPlanPlanComponent element) throws IOException {
45161    if (element != null) {
45162      open(name);
45163      composeProductPlanProductPlanPlanComponentInner(element);
45164      close();
45165    }
45166  }
45167
45168  protected void composeProductPlanProductPlanPlanComponentInner(ProductPlan.ProductPlanPlanComponent element) throws IOException {
45169      composeBackbone(element);
45170      if (element.hasIdentifier()) {
45171        openArray("identifier");
45172        for (Identifier e : element.getIdentifier()) 
45173          composeIdentifier(null, e);
45174        closeArray();
45175      };
45176      if (element.hasType()) {
45177        composeCodeableConcept("type", element.getType());
45178      }
45179      if (element.hasCoverageArea()) {
45180        composeReference("coverageArea", element.getCoverageArea());
45181      }
45182      if (element.hasNetwork()) {
45183        openArray("network");
45184        for (Reference e : element.getNetwork()) 
45185          composeReference(null, e);
45186        closeArray();
45187      };
45188      if (element.hasGeneralCost()) {
45189        openArray("generalCost");
45190        for (ProductPlan.ProductPlanPlanGeneralCostComponent e : element.getGeneralCost()) 
45191          composeProductPlanProductPlanPlanGeneralCostComponent(null, e);
45192        closeArray();
45193      };
45194      if (element.hasSpecificCost()) {
45195        openArray("specificCost");
45196        for (ProductPlan.ProductPlanPlanSpecificCostComponent e : element.getSpecificCost()) 
45197          composeProductPlanProductPlanPlanSpecificCostComponent(null, e);
45198        closeArray();
45199      };
45200  }
45201
45202  protected void composeProductPlanProductPlanPlanGeneralCostComponent(String name, ProductPlan.ProductPlanPlanGeneralCostComponent element) throws IOException {
45203    if (element != null) {
45204      open(name);
45205      composeProductPlanProductPlanPlanGeneralCostComponentInner(element);
45206      close();
45207    }
45208  }
45209
45210  protected void composeProductPlanProductPlanPlanGeneralCostComponentInner(ProductPlan.ProductPlanPlanGeneralCostComponent element) throws IOException {
45211      composeBackbone(element);
45212      if (element.hasType()) {
45213        composeCodeableConcept("type", element.getType());
45214      }
45215      if (element.hasGroupSizeElement()) {
45216        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
45217        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
45218      }
45219      if (element.hasCost()) {
45220        composeMoney("cost", element.getCost());
45221      }
45222      if (element.hasCommentElement()) {
45223        composeStringCore("comment", element.getCommentElement(), false);
45224        composeStringExtras("comment", element.getCommentElement(), false);
45225      }
45226  }
45227
45228  protected void composeProductPlanProductPlanPlanSpecificCostComponent(String name, ProductPlan.ProductPlanPlanSpecificCostComponent element) throws IOException {
45229    if (element != null) {
45230      open(name);
45231      composeProductPlanProductPlanPlanSpecificCostComponentInner(element);
45232      close();
45233    }
45234  }
45235
45236  protected void composeProductPlanProductPlanPlanSpecificCostComponentInner(ProductPlan.ProductPlanPlanSpecificCostComponent element) throws IOException {
45237      composeBackbone(element);
45238      if (element.hasCategory()) {
45239        composeCodeableConcept("category", element.getCategory());
45240      }
45241      if (element.hasBenefit()) {
45242        openArray("benefit");
45243        for (ProductPlan.ProductPlanPlanSpecificCostBenefitComponent e : element.getBenefit()) 
45244          composeProductPlanProductPlanPlanSpecificCostBenefitComponent(null, e);
45245        closeArray();
45246      };
45247  }
45248
45249  protected void composeProductPlanProductPlanPlanSpecificCostBenefitComponent(String name, ProductPlan.ProductPlanPlanSpecificCostBenefitComponent element) throws IOException {
45250    if (element != null) {
45251      open(name);
45252      composeProductPlanProductPlanPlanSpecificCostBenefitComponentInner(element);
45253      close();
45254    }
45255  }
45256
45257  protected void composeProductPlanProductPlanPlanSpecificCostBenefitComponentInner(ProductPlan.ProductPlanPlanSpecificCostBenefitComponent element) throws IOException {
45258      composeBackbone(element);
45259      if (element.hasType()) {
45260        composeCodeableConcept("type", element.getType());
45261      }
45262      if (element.hasDescriptionElement()) {
45263        composeStringCore("description", element.getDescriptionElement(), false);
45264        composeStringExtras("description", element.getDescriptionElement(), false);
45265      }
45266      if (element.hasCost()) {
45267        openArray("cost");
45268        for (ProductPlan.ProductPlanPlanSpecificCostBenefitCostComponent e : element.getCost()) 
45269          composeProductPlanProductPlanPlanSpecificCostBenefitCostComponent(null, e);
45270        closeArray();
45271      };
45272  }
45273
45274  protected void composeProductPlanProductPlanPlanSpecificCostBenefitCostComponent(String name, ProductPlan.ProductPlanPlanSpecificCostBenefitCostComponent element) throws IOException {
45275    if (element != null) {
45276      open(name);
45277      composeProductPlanProductPlanPlanSpecificCostBenefitCostComponentInner(element);
45278      close();
45279    }
45280  }
45281
45282  protected void composeProductPlanProductPlanPlanSpecificCostBenefitCostComponentInner(ProductPlan.ProductPlanPlanSpecificCostBenefitCostComponent element) throws IOException {
45283      composeBackbone(element);
45284      if (element.hasType()) {
45285        composeCodeableConcept("type", element.getType());
45286      }
45287      if (element.hasApplicabilityElement()) {
45288        composeEnumerationCore("applicability", element.getApplicabilityElement(), new ProductPlan.BenefitCostApplicabilityEnumFactory(), false);
45289        composeEnumerationExtras("applicability", element.getApplicabilityElement(), new ProductPlan.BenefitCostApplicabilityEnumFactory(), false);
45290      }
45291      if (element.hasQualifiers()) {
45292        openArray("qualifiers");
45293        for (CodeableConcept e : element.getQualifiers()) 
45294          composeCodeableConcept(null, e);
45295        closeArray();
45296      };
45297      if (element.hasValue()) {
45298        composeMoney("value", element.getValue());
45299      }
45300  }
45301
45302  protected void composeProvenance(String name, Provenance element) throws IOException {
45303    if (element != null) {
45304      prop("resourceType", name);
45305      composeProvenanceInner(element);
45306    }
45307  }
45308
45309  protected void composeProvenanceInner(Provenance element) throws IOException {
45310      composeDomainResourceElements(element);
45311      if (element.hasTarget()) {
45312        openArray("target");
45313        for (Reference e : element.getTarget()) 
45314          composeReference(null, e);
45315        closeArray();
45316      };
45317      if (element.hasOccurred()) {
45318        composeType("occurred", element.getOccurred());
45319      }
45320      if (element.hasRecordedElement()) {
45321        composeInstantCore("recorded", element.getRecordedElement(), false);
45322        composeInstantExtras("recorded", element.getRecordedElement(), false);
45323      }
45324      if (element.hasPolicy()) {
45325        openArray("policy");
45326        for (UriType e : element.getPolicy()) 
45327          composeUriCore(null, e, true);
45328        closeArray();
45329        if (anyHasExtras(element.getPolicy())) {
45330          openArray("_policy");
45331          for (UriType e : element.getPolicy()) 
45332            composeUriExtras(null, e, true);
45333          closeArray();
45334        }
45335      };
45336      if (element.hasLocation()) {
45337        composeReference("location", element.getLocation());
45338      }
45339      if (element.hasReason()) {
45340        openArray("reason");
45341        for (CodeableConcept e : element.getReason()) 
45342          composeCodeableConcept(null, e);
45343        closeArray();
45344      };
45345      if (element.hasActivity()) {
45346        composeCodeableConcept("activity", element.getActivity());
45347      }
45348      if (element.hasAgent()) {
45349        openArray("agent");
45350        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
45351          composeProvenanceProvenanceAgentComponent(null, e);
45352        closeArray();
45353      };
45354      if (element.hasEntity()) {
45355        openArray("entity");
45356        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
45357          composeProvenanceProvenanceEntityComponent(null, e);
45358        closeArray();
45359      };
45360      if (element.hasSignature()) {
45361        openArray("signature");
45362        for (Signature e : element.getSignature()) 
45363          composeSignature(null, e);
45364        closeArray();
45365      };
45366  }
45367
45368  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
45369    if (element != null) {
45370      open(name);
45371      composeProvenanceProvenanceAgentComponentInner(element);
45372      close();
45373    }
45374  }
45375
45376  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
45377      composeBackbone(element);
45378      if (element.hasType()) {
45379        composeCodeableConcept("type", element.getType());
45380      }
45381      if (element.hasRole()) {
45382        openArray("role");
45383        for (CodeableConcept e : element.getRole()) 
45384          composeCodeableConcept(null, e);
45385        closeArray();
45386      };
45387      if (element.hasWho()) {
45388        composeType("who", element.getWho());
45389      }
45390      if (element.hasOnBehalfOf()) {
45391        composeType("onBehalfOf", element.getOnBehalfOf());
45392      }
45393  }
45394
45395  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
45396    if (element != null) {
45397      open(name);
45398      composeProvenanceProvenanceEntityComponentInner(element);
45399      close();
45400    }
45401  }
45402
45403  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
45404      composeBackbone(element);
45405      if (element.hasRoleElement()) {
45406        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
45407        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
45408      }
45409      if (element.hasWhat()) {
45410        composeType("what", element.getWhat());
45411      }
45412      if (element.hasAgent()) {
45413        openArray("agent");
45414        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
45415          composeProvenanceProvenanceAgentComponent(null, e);
45416        closeArray();
45417      };
45418  }
45419
45420  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
45421    if (element != null) {
45422      prop("resourceType", name);
45423      composeQuestionnaireInner(element);
45424    }
45425  }
45426
45427  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
45428      composeDomainResourceElements(element);
45429      if (element.hasUrlElement()) {
45430        composeUriCore("url", element.getUrlElement(), false);
45431        composeUriExtras("url", element.getUrlElement(), false);
45432      }
45433      if (element.hasIdentifier()) {
45434        openArray("identifier");
45435        for (Identifier e : element.getIdentifier()) 
45436          composeIdentifier(null, e);
45437        closeArray();
45438      };
45439      if (element.hasVersionElement()) {
45440        composeStringCore("version", element.getVersionElement(), false);
45441        composeStringExtras("version", element.getVersionElement(), false);
45442      }
45443      if (element.hasNameElement()) {
45444        composeStringCore("name", element.getNameElement(), false);
45445        composeStringExtras("name", element.getNameElement(), false);
45446      }
45447      if (element.hasTitleElement()) {
45448        composeStringCore("title", element.getTitleElement(), false);
45449        composeStringExtras("title", element.getTitleElement(), false);
45450      }
45451      if (element.hasDerivedFrom()) {
45452        openArray("derivedFrom");
45453        for (CanonicalType e : element.getDerivedFrom()) 
45454          composeCanonicalCore(null, e, true);
45455        closeArray();
45456        if (anyHasExtras(element.getDerivedFrom())) {
45457          openArray("_derivedFrom");
45458          for (CanonicalType e : element.getDerivedFrom()) 
45459            composeCanonicalExtras(null, e, true);
45460          closeArray();
45461        }
45462      };
45463      if (element.hasStatusElement()) {
45464        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45465        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
45466      }
45467      if (element.hasExperimentalElement()) {
45468        composeBooleanCore("experimental", element.getExperimentalElement(), false);
45469        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
45470      }
45471      if (element.hasSubjectType()) {
45472        openArray("subjectType");
45473        for (CodeType e : element.getSubjectType()) 
45474          composeCodeCore(null, e, true);
45475        closeArray();
45476        if (anyHasExtras(element.getSubjectType())) {
45477          openArray("_subjectType");
45478          for (CodeType e : element.getSubjectType()) 
45479            composeCodeExtras(null, e, true);
45480          closeArray();
45481        }
45482      };
45483      if (element.hasDateElement()) {
45484        composeDateTimeCore("date", element.getDateElement(), false);
45485        composeDateTimeExtras("date", element.getDateElement(), false);
45486      }
45487      if (element.hasPublisherElement()) {
45488        composeStringCore("publisher", element.getPublisherElement(), false);
45489        composeStringExtras("publisher", element.getPublisherElement(), false);
45490      }
45491      if (element.hasContact()) {
45492        openArray("contact");
45493        for (ContactDetail e : element.getContact()) 
45494          composeContactDetail(null, e);
45495        closeArray();
45496      };
45497      if (element.hasDescriptionElement()) {
45498        composeMarkdownCore("description", element.getDescriptionElement(), false);
45499        composeMarkdownExtras("description", element.getDescriptionElement(), false);
45500      }
45501      if (element.hasUseContext()) {
45502        openArray("useContext");
45503        for (UsageContext e : element.getUseContext()) 
45504          composeUsageContext(null, e);
45505        closeArray();
45506      };
45507      if (element.hasJurisdiction()) {
45508        openArray("jurisdiction");
45509        for (CodeableConcept e : element.getJurisdiction()) 
45510          composeCodeableConcept(null, e);
45511        closeArray();
45512      };
45513      if (element.hasPurposeElement()) {
45514        composeMarkdownCore("purpose", element.getPurposeElement(), false);
45515        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
45516      }
45517      if (element.hasCopyrightElement()) {
45518        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
45519        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
45520      }
45521      if (element.hasApprovalDateElement()) {
45522        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
45523        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
45524      }
45525      if (element.hasLastReviewDateElement()) {
45526        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
45527        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
45528      }
45529      if (element.hasEffectivePeriod()) {
45530        composePeriod("effectivePeriod", element.getEffectivePeriod());
45531      }
45532      if (element.hasCode()) {
45533        openArray("code");
45534        for (Coding e : element.getCode()) 
45535          composeCoding(null, e);
45536        closeArray();
45537      };
45538      if (element.hasItem()) {
45539        openArray("item");
45540        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
45541          composeQuestionnaireQuestionnaireItemComponent(null, e);
45542        closeArray();
45543      };
45544  }
45545
45546  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
45547    if (element != null) {
45548      open(name);
45549      composeQuestionnaireQuestionnaireItemComponentInner(element);
45550      close();
45551    }
45552  }
45553
45554  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
45555      composeBackbone(element);
45556      if (element.hasLinkIdElement()) {
45557        composeStringCore("linkId", element.getLinkIdElement(), false);
45558        composeStringExtras("linkId", element.getLinkIdElement(), false);
45559      }
45560      if (element.hasDefinitionElement()) {
45561        composeUriCore("definition", element.getDefinitionElement(), false);
45562        composeUriExtras("definition", element.getDefinitionElement(), false);
45563      }
45564      if (element.hasCode()) {
45565        openArray("code");
45566        for (Coding e : element.getCode()) 
45567          composeCoding(null, e);
45568        closeArray();
45569      };
45570      if (element.hasPrefixElement()) {
45571        composeStringCore("prefix", element.getPrefixElement(), false);
45572        composeStringExtras("prefix", element.getPrefixElement(), false);
45573      }
45574      if (element.hasTextElement()) {
45575        composeStringCore("text", element.getTextElement(), false);
45576        composeStringExtras("text", element.getTextElement(), false);
45577      }
45578      if (element.hasTypeElement()) {
45579        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
45580        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
45581      }
45582      if (element.hasEnableWhen()) {
45583        openArray("enableWhen");
45584        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
45585          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
45586        closeArray();
45587      };
45588      if (element.hasEnableBehaviorElement()) {
45589        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
45590        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
45591      }
45592      if (element.hasRequiredElement()) {
45593        composeBooleanCore("required", element.getRequiredElement(), false);
45594        composeBooleanExtras("required", element.getRequiredElement(), false);
45595      }
45596      if (element.hasRepeatsElement()) {
45597        composeBooleanCore("repeats", element.getRepeatsElement(), false);
45598        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
45599      }
45600      if (element.hasReadOnlyElement()) {
45601        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
45602        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
45603      }
45604      if (element.hasMaxLengthElement()) {
45605        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
45606        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
45607      }
45608      if (element.hasOptionsElement()) {
45609        composeCanonicalCore("options", element.getOptionsElement(), false);
45610        composeCanonicalExtras("options", element.getOptionsElement(), false);
45611      }
45612      if (element.hasOption()) {
45613        openArray("option");
45614        for (Questionnaire.QuestionnaireItemOptionComponent e : element.getOption()) 
45615          composeQuestionnaireQuestionnaireItemOptionComponent(null, e);
45616        closeArray();
45617      };
45618      if (element.hasInitial()) {
45619        openArray("initial");
45620        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
45621          composeQuestionnaireQuestionnaireItemInitialComponent(null, e);
45622        closeArray();
45623      };
45624      if (element.hasItem()) {
45625        openArray("item");
45626        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
45627          composeQuestionnaireQuestionnaireItemComponent(null, e);
45628        closeArray();
45629      };
45630  }
45631
45632  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
45633    if (element != null) {
45634      open(name);
45635      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
45636      close();
45637    }
45638  }
45639
45640  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
45641      composeBackbone(element);
45642      if (element.hasQuestionElement()) {
45643        composeStringCore("question", element.getQuestionElement(), false);
45644        composeStringExtras("question", element.getQuestionElement(), false);
45645      }
45646      if (element.hasOperatorElement()) {
45647        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
45648        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
45649      }
45650      if (element.hasAnswer()) {
45651        composeType("answer", element.getAnswer());
45652      }
45653  }
45654
45655  protected void composeQuestionnaireQuestionnaireItemOptionComponent(String name, Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
45656    if (element != null) {
45657      open(name);
45658      composeQuestionnaireQuestionnaireItemOptionComponentInner(element);
45659      close();
45660    }
45661  }
45662
45663  protected void composeQuestionnaireQuestionnaireItemOptionComponentInner(Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
45664      composeBackbone(element);
45665      if (element.hasValue()) {
45666        composeType("value", element.getValue());
45667      }
45668      if (element.hasInitialSelectedElement()) {
45669        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
45670        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
45671      }
45672  }
45673
45674  protected void composeQuestionnaireQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
45675    if (element != null) {
45676      open(name);
45677      composeQuestionnaireQuestionnaireItemInitialComponentInner(element);
45678      close();
45679    }
45680  }
45681
45682  protected void composeQuestionnaireQuestionnaireItemInitialComponentInner(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
45683      composeBackbone(element);
45684      if (element.hasValue()) {
45685        composeType("value", element.getValue());
45686      }
45687  }
45688
45689  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
45690    if (element != null) {
45691      prop("resourceType", name);
45692      composeQuestionnaireResponseInner(element);
45693    }
45694  }
45695
45696  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
45697      composeDomainResourceElements(element);
45698      if (element.hasIdentifier()) {
45699        composeIdentifier("identifier", element.getIdentifier());
45700      }
45701      if (element.hasBasedOn()) {
45702        openArray("basedOn");
45703        for (Reference e : element.getBasedOn()) 
45704          composeReference(null, e);
45705        closeArray();
45706      };
45707      if (element.hasPartOf()) {
45708        openArray("partOf");
45709        for (Reference e : element.getPartOf()) 
45710          composeReference(null, e);
45711        closeArray();
45712      };
45713      if (element.hasQuestionnaireElement()) {
45714        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
45715        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
45716      }
45717      if (element.hasStatusElement()) {
45718        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
45719        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
45720      }
45721      if (element.hasSubject()) {
45722        composeReference("subject", element.getSubject());
45723      }
45724      if (element.hasContext()) {
45725        composeReference("context", element.getContext());
45726      }
45727      if (element.hasAuthoredElement()) {
45728        composeDateTimeCore("authored", element.getAuthoredElement(), false);
45729        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
45730      }
45731      if (element.hasAuthor()) {
45732        composeReference("author", element.getAuthor());
45733      }
45734      if (element.hasSource()) {
45735        composeReference("source", element.getSource());
45736      }
45737      if (element.hasItem()) {
45738        openArray("item");
45739        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
45740          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
45741        closeArray();
45742      };
45743  }
45744
45745  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
45746    if (element != null) {
45747      open(name);
45748      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
45749      close();
45750    }
45751  }
45752
45753  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
45754      composeBackbone(element);
45755      if (element.hasLinkIdElement()) {
45756        composeStringCore("linkId", element.getLinkIdElement(), false);
45757        composeStringExtras("linkId", element.getLinkIdElement(), false);
45758      }
45759      if (element.hasDefinitionElement()) {
45760        composeUriCore("definition", element.getDefinitionElement(), false);
45761        composeUriExtras("definition", element.getDefinitionElement(), false);
45762      }
45763      if (element.hasTextElement()) {
45764        composeStringCore("text", element.getTextElement(), false);
45765        composeStringExtras("text", element.getTextElement(), false);
45766      }
45767      if (element.hasSubject()) {
45768        composeReference("subject", element.getSubject());
45769      }
45770      if (element.hasAnswer()) {
45771        openArray("answer");
45772        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
45773          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
45774        closeArray();
45775      };
45776      if (element.hasItem()) {
45777        openArray("item");
45778        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
45779          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
45780        closeArray();
45781      };
45782  }
45783
45784  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
45785    if (element != null) {
45786      open(name);
45787      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
45788      close();
45789    }
45790  }
45791
45792  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
45793      composeBackbone(element);
45794      if (element.hasValue()) {
45795        composeType("value", element.getValue());
45796      }
45797      if (element.hasItem()) {
45798        openArray("item");
45799        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
45800          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
45801        closeArray();
45802      };
45803  }
45804
45805  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
45806    if (element != null) {
45807      prop("resourceType", name);
45808      composeRelatedPersonInner(element);
45809    }
45810  }
45811
45812  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
45813      composeDomainResourceElements(element);
45814      if (element.hasIdentifier()) {
45815        openArray("identifier");
45816        for (Identifier e : element.getIdentifier()) 
45817          composeIdentifier(null, e);
45818        closeArray();
45819      };
45820      if (element.hasActiveElement()) {
45821        composeBooleanCore("active", element.getActiveElement(), false);
45822        composeBooleanExtras("active", element.getActiveElement(), false);
45823      }
45824      if (element.hasPatient()) {
45825        composeReference("patient", element.getPatient());
45826      }
45827      if (element.hasRelationship()) {
45828        openArray("relationship");
45829        for (CodeableConcept e : element.getRelationship()) 
45830          composeCodeableConcept(null, e);
45831        closeArray();
45832      };
45833      if (element.hasName()) {
45834        openArray("name");
45835        for (HumanName e : element.getName()) 
45836          composeHumanName(null, e);
45837        closeArray();
45838      };
45839      if (element.hasTelecom()) {
45840        openArray("telecom");
45841        for (ContactPoint e : element.getTelecom()) 
45842          composeContactPoint(null, e);
45843        closeArray();
45844      };
45845      if (element.hasGenderElement()) {
45846        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
45847        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
45848      }
45849      if (element.hasBirthDateElement()) {
45850        composeDateCore("birthDate", element.getBirthDateElement(), false);
45851        composeDateExtras("birthDate", element.getBirthDateElement(), false);
45852      }
45853      if (element.hasAddress()) {
45854        openArray("address");
45855        for (Address e : element.getAddress()) 
45856          composeAddress(null, e);
45857        closeArray();
45858      };
45859      if (element.hasPhoto()) {
45860        openArray("photo");
45861        for (Attachment e : element.getPhoto()) 
45862          composeAttachment(null, e);
45863        closeArray();
45864      };
45865      if (element.hasPeriod()) {
45866        composePeriod("period", element.getPeriod());
45867      }
45868  }
45869
45870  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
45871    if (element != null) {
45872      prop("resourceType", name);
45873      composeRequestGroupInner(element);
45874    }
45875  }
45876
45877  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
45878      composeDomainResourceElements(element);
45879      if (element.hasIdentifier()) {
45880        openArray("identifier");
45881        for (Identifier e : element.getIdentifier()) 
45882          composeIdentifier(null, e);
45883        closeArray();
45884      };
45885      if (element.hasInstantiatesCanonical()) {
45886        openArray("instantiatesCanonical");
45887        for (CanonicalType e : element.getInstantiatesCanonical()) 
45888          composeCanonicalCore(null, e, true);
45889        closeArray();
45890        if (anyHasExtras(element.getInstantiatesCanonical())) {
45891          openArray("_instantiatesCanonical");
45892          for (CanonicalType e : element.getInstantiatesCanonical()) 
45893            composeCanonicalExtras(null, e, true);
45894          closeArray();
45895        }
45896      };
45897      if (element.hasInstantiatesUri()) {
45898        openArray("instantiatesUri");
45899        for (UriType e : element.getInstantiatesUri()) 
45900          composeUriCore(null, e, true);
45901        closeArray();
45902        if (anyHasExtras(element.getInstantiatesUri())) {
45903          openArray("_instantiatesUri");
45904          for (UriType e : element.getInstantiatesUri()) 
45905            composeUriExtras(null, e, true);
45906          closeArray();
45907        }
45908      };
45909      if (element.hasBasedOn()) {
45910        openArray("basedOn");
45911        for (Reference e : element.getBasedOn()) 
45912          composeReference(null, e);
45913        closeArray();
45914      };
45915      if (element.hasReplaces()) {
45916        openArray("replaces");
45917        for (Reference e : element.getReplaces()) 
45918          composeReference(null, e);
45919        closeArray();
45920      };
45921      if (element.hasGroupIdentifier()) {
45922        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
45923      }
45924      if (element.hasStatusElement()) {
45925        composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
45926        composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
45927      }
45928      if (element.hasIntentElement()) {
45929        composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
45930        composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
45931      }
45932      if (element.hasPriorityElement()) {
45933        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
45934        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
45935      }
45936      if (element.hasCode()) {
45937        composeCodeableConcept("code", element.getCode());
45938      }
45939      if (element.hasSubject()) {
45940        composeReference("subject", element.getSubject());
45941      }
45942      if (element.hasContext()) {
45943        composeReference("context", element.getContext());
45944      }
45945      if (element.hasAuthoredOnElement()) {
45946        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
45947        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
45948      }
45949      if (element.hasAuthor()) {
45950        composeReference("author", element.getAuthor());
45951      }
45952      if (element.hasReasonCode()) {
45953        openArray("reasonCode");
45954        for (CodeableConcept e : element.getReasonCode()) 
45955          composeCodeableConcept(null, e);
45956        closeArray();
45957      };
45958      if (element.hasReasonReference()) {
45959        openArray("reasonReference");
45960        for (Reference e : element.getReasonReference()) 
45961          composeReference(null, e);
45962        closeArray();
45963      };
45964      if (element.hasNote()) {
45965        openArray("note");
45966        for (Annotation e : element.getNote()) 
45967          composeAnnotation(null, e);
45968        closeArray();
45969      };
45970      if (element.hasAction()) {
45971        openArray("action");
45972        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
45973          composeRequestGroupRequestGroupActionComponent(null, e);
45974        closeArray();
45975      };
45976  }
45977
45978  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
45979    if (element != null) {
45980      open(name);
45981      composeRequestGroupRequestGroupActionComponentInner(element);
45982      close();
45983    }
45984  }
45985
45986  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element) throws IOException {
45987      composeBackbone(element);
45988      if (element.hasPrefixElement()) {
45989        composeStringCore("prefix", element.getPrefixElement(), false);
45990        composeStringExtras("prefix", element.getPrefixElement(), false);
45991      }
45992      if (element.hasTitleElement()) {
45993        composeStringCore("title", element.getTitleElement(), false);
45994        composeStringExtras("title", element.getTitleElement(), false);
45995      }
45996      if (element.hasDescriptionElement()) {
45997        composeStringCore("description", element.getDescriptionElement(), false);
45998        composeStringExtras("description", element.getDescriptionElement(), false);
45999      }
46000      if (element.hasTextEquivalentElement()) {
46001        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
46002        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
46003      }
46004      if (element.hasCode()) {
46005        openArray("code");
46006        for (CodeableConcept e : element.getCode()) 
46007          composeCodeableConcept(null, e);
46008        closeArray();
46009      };
46010      if (element.hasDocumentation()) {
46011        openArray("documentation");
46012        for (RelatedArtifact e : element.getDocumentation()) 
46013          composeRelatedArtifact(null, e);
46014        closeArray();
46015      };
46016      if (element.hasCondition()) {
46017        openArray("condition");
46018        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
46019          composeRequestGroupRequestGroupActionConditionComponent(null, e);
46020        closeArray();
46021      };
46022      if (element.hasRelatedAction()) {
46023        openArray("relatedAction");
46024        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
46025          composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
46026        closeArray();
46027      };
46028      if (element.hasTiming()) {
46029        composeType("timing", element.getTiming());
46030      }
46031      if (element.hasParticipant()) {
46032        openArray("participant");
46033        for (Reference e : element.getParticipant()) 
46034          composeReference(null, e);
46035        closeArray();
46036      };
46037      if (element.hasType()) {
46038        composeCodeableConcept("type", element.getType());
46039      }
46040      if (element.hasGroupingBehaviorElement()) {
46041        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
46042        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
46043      }
46044      if (element.hasSelectionBehaviorElement()) {
46045        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
46046        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
46047      }
46048      if (element.hasRequiredBehaviorElement()) {
46049        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
46050        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
46051      }
46052      if (element.hasPrecheckBehaviorElement()) {
46053        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
46054        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
46055      }
46056      if (element.hasCardinalityBehaviorElement()) {
46057        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
46058        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
46059      }
46060      if (element.hasResource()) {
46061        composeReference("resource", element.getResource());
46062      }
46063      if (element.hasAction()) {
46064        openArray("action");
46065        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
46066          composeRequestGroupRequestGroupActionComponent(null, e);
46067        closeArray();
46068      };
46069  }
46070
46071  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
46072    if (element != null) {
46073      open(name);
46074      composeRequestGroupRequestGroupActionConditionComponentInner(element);
46075      close();
46076    }
46077  }
46078
46079  protected void composeRequestGroupRequestGroupActionConditionComponentInner(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
46080      composeBackbone(element);
46081      if (element.hasKindElement()) {
46082        composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
46083        composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
46084      }
46085      if (element.hasDescriptionElement()) {
46086        composeStringCore("description", element.getDescriptionElement(), false);
46087        composeStringExtras("description", element.getDescriptionElement(), false);
46088      }
46089      if (element.hasLanguageElement()) {
46090        composeStringCore("language", element.getLanguageElement(), false);
46091        composeStringExtras("language", element.getLanguageElement(), false);
46092      }
46093      if (element.hasExpressionElement()) {
46094        composeStringCore("expression", element.getExpressionElement(), false);
46095        composeStringExtras("expression", element.getExpressionElement(), false);
46096      }
46097  }
46098
46099  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
46100    if (element != null) {
46101      open(name);
46102      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
46103      close();
46104    }
46105  }
46106
46107  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
46108      composeBackbone(element);
46109      if (element.hasActionIdElement()) {
46110        composeIdCore("actionId", element.getActionIdElement(), false);
46111        composeIdExtras("actionId", element.getActionIdElement(), false);
46112      }
46113      if (element.hasRelationshipElement()) {
46114        composeEnumerationCore("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
46115        composeEnumerationExtras("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
46116      }
46117      if (element.hasOffset()) {
46118        composeType("offset", element.getOffset());
46119      }
46120  }
46121
46122  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
46123    if (element != null) {
46124      prop("resourceType", name);
46125      composeResearchStudyInner(element);
46126    }
46127  }
46128
46129  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
46130      composeDomainResourceElements(element);
46131      if (element.hasIdentifier()) {
46132        openArray("identifier");
46133        for (Identifier e : element.getIdentifier()) 
46134          composeIdentifier(null, e);
46135        closeArray();
46136      };
46137      if (element.hasTitleElement()) {
46138        composeStringCore("title", element.getTitleElement(), false);
46139        composeStringExtras("title", element.getTitleElement(), false);
46140      }
46141      if (element.hasProtocol()) {
46142        openArray("protocol");
46143        for (Reference e : element.getProtocol()) 
46144          composeReference(null, e);
46145        closeArray();
46146      };
46147      if (element.hasPartOf()) {
46148        openArray("partOf");
46149        for (Reference e : element.getPartOf()) 
46150          composeReference(null, e);
46151        closeArray();
46152      };
46153      if (element.hasStatusElement()) {
46154        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
46155        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
46156      }
46157      if (element.hasPrimaryPurposeType()) {
46158        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
46159      }
46160      if (element.hasPhase()) {
46161        composeCodeableConcept("phase", element.getPhase());
46162      }
46163      if (element.hasCategory()) {
46164        openArray("category");
46165        for (CodeableConcept e : element.getCategory()) 
46166          composeCodeableConcept(null, e);
46167        closeArray();
46168      };
46169      if (element.hasFocus()) {
46170        openArray("focus");
46171        for (CodeableConcept e : element.getFocus()) 
46172          composeCodeableConcept(null, e);
46173        closeArray();
46174      };
46175      if (element.hasCondition()) {
46176        openArray("condition");
46177        for (Reference e : element.getCondition()) 
46178          composeReference(null, e);
46179        closeArray();
46180      };
46181      if (element.hasContact()) {
46182        openArray("contact");
46183        for (ContactDetail e : element.getContact()) 
46184          composeContactDetail(null, e);
46185        closeArray();
46186      };
46187      if (element.hasRelatedArtifact()) {
46188        openArray("relatedArtifact");
46189        for (RelatedArtifact e : element.getRelatedArtifact()) 
46190          composeRelatedArtifact(null, e);
46191        closeArray();
46192      };
46193      if (element.hasKeyword()) {
46194        openArray("keyword");
46195        for (CodeableConcept e : element.getKeyword()) 
46196          composeCodeableConcept(null, e);
46197        closeArray();
46198      };
46199      if (element.hasLocation()) {
46200        openArray("location");
46201        for (CodeableConcept e : element.getLocation()) 
46202          composeCodeableConcept(null, e);
46203        closeArray();
46204      };
46205      if (element.hasDescriptionElement()) {
46206        composeMarkdownCore("description", element.getDescriptionElement(), false);
46207        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46208      }
46209      if (element.hasEnrollment()) {
46210        openArray("enrollment");
46211        for (Reference e : element.getEnrollment()) 
46212          composeReference(null, e);
46213        closeArray();
46214      };
46215      if (element.hasPeriod()) {
46216        composePeriod("period", element.getPeriod());
46217      }
46218      if (element.hasSponsor()) {
46219        composeReference("sponsor", element.getSponsor());
46220      }
46221      if (element.hasPrincipalInvestigator()) {
46222        composeReference("principalInvestigator", element.getPrincipalInvestigator());
46223      }
46224      if (element.hasSite()) {
46225        openArray("site");
46226        for (Reference e : element.getSite()) 
46227          composeReference(null, e);
46228        closeArray();
46229      };
46230      if (element.hasReasonStopped()) {
46231        composeCodeableConcept("reasonStopped", element.getReasonStopped());
46232      }
46233      if (element.hasNote()) {
46234        openArray("note");
46235        for (Annotation e : element.getNote()) 
46236          composeAnnotation(null, e);
46237        closeArray();
46238      };
46239      if (element.hasArm()) {
46240        openArray("arm");
46241        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
46242          composeResearchStudyResearchStudyArmComponent(null, e);
46243        closeArray();
46244      };
46245      if (element.hasObjective()) {
46246        openArray("objective");
46247        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
46248          composeResearchStudyResearchStudyObjectiveComponent(null, e);
46249        closeArray();
46250      };
46251  }
46252
46253  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
46254    if (element != null) {
46255      open(name);
46256      composeResearchStudyResearchStudyArmComponentInner(element);
46257      close();
46258    }
46259  }
46260
46261  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
46262      composeBackbone(element);
46263      if (element.hasNameElement()) {
46264        composeStringCore("name", element.getNameElement(), false);
46265        composeStringExtras("name", element.getNameElement(), false);
46266      }
46267      if (element.hasType()) {
46268        composeCodeableConcept("type", element.getType());
46269      }
46270      if (element.hasDescriptionElement()) {
46271        composeStringCore("description", element.getDescriptionElement(), false);
46272        composeStringExtras("description", element.getDescriptionElement(), false);
46273      }
46274  }
46275
46276  protected void composeResearchStudyResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
46277    if (element != null) {
46278      open(name);
46279      composeResearchStudyResearchStudyObjectiveComponentInner(element);
46280      close();
46281    }
46282  }
46283
46284  protected void composeResearchStudyResearchStudyObjectiveComponentInner(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
46285      composeBackbone(element);
46286      if (element.hasNameElement()) {
46287        composeStringCore("name", element.getNameElement(), false);
46288        composeStringExtras("name", element.getNameElement(), false);
46289      }
46290      if (element.hasType()) {
46291        composeCodeableConcept("type", element.getType());
46292      }
46293  }
46294
46295  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
46296    if (element != null) {
46297      prop("resourceType", name);
46298      composeResearchSubjectInner(element);
46299    }
46300  }
46301
46302  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
46303      composeDomainResourceElements(element);
46304      if (element.hasIdentifier()) {
46305        openArray("identifier");
46306        for (Identifier e : element.getIdentifier()) 
46307          composeIdentifier(null, e);
46308        closeArray();
46309      };
46310      if (element.hasStatusElement()) {
46311        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
46312        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
46313      }
46314      if (element.hasPeriod()) {
46315        composePeriod("period", element.getPeriod());
46316      }
46317      if (element.hasStudy()) {
46318        composeReference("study", element.getStudy());
46319      }
46320      if (element.hasIndividual()) {
46321        composeReference("individual", element.getIndividual());
46322      }
46323      if (element.hasAssignedArmElement()) {
46324        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
46325        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
46326      }
46327      if (element.hasActualArmElement()) {
46328        composeStringCore("actualArm", element.getActualArmElement(), false);
46329        composeStringExtras("actualArm", element.getActualArmElement(), false);
46330      }
46331      if (element.hasConsent()) {
46332        composeReference("consent", element.getConsent());
46333      }
46334  }
46335
46336  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
46337    if (element != null) {
46338      prop("resourceType", name);
46339      composeRiskAssessmentInner(element);
46340    }
46341  }
46342
46343  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
46344      composeDomainResourceElements(element);
46345      if (element.hasIdentifier()) {
46346        openArray("identifier");
46347        for (Identifier e : element.getIdentifier()) 
46348          composeIdentifier(null, e);
46349        closeArray();
46350      };
46351      if (element.hasBasedOn()) {
46352        composeReference("basedOn", element.getBasedOn());
46353      }
46354      if (element.hasParent()) {
46355        composeReference("parent", element.getParent());
46356      }
46357      if (element.hasStatusElement()) {
46358        composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
46359        composeEnumerationExtras("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
46360      }
46361      if (element.hasMethod()) {
46362        composeCodeableConcept("method", element.getMethod());
46363      }
46364      if (element.hasCode()) {
46365        composeCodeableConcept("code", element.getCode());
46366      }
46367      if (element.hasSubject()) {
46368        composeReference("subject", element.getSubject());
46369      }
46370      if (element.hasContext()) {
46371        composeReference("context", element.getContext());
46372      }
46373      if (element.hasOccurrence()) {
46374        composeType("occurrence", element.getOccurrence());
46375      }
46376      if (element.hasCondition()) {
46377        composeReference("condition", element.getCondition());
46378      }
46379      if (element.hasPerformer()) {
46380        composeReference("performer", element.getPerformer());
46381      }
46382      if (element.hasReasonCode()) {
46383        openArray("reasonCode");
46384        for (CodeableConcept e : element.getReasonCode()) 
46385          composeCodeableConcept(null, e);
46386        closeArray();
46387      };
46388      if (element.hasReasonReference()) {
46389        openArray("reasonReference");
46390        for (Reference e : element.getReasonReference()) 
46391          composeReference(null, e);
46392        closeArray();
46393      };
46394      if (element.hasBasis()) {
46395        openArray("basis");
46396        for (Reference e : element.getBasis()) 
46397          composeReference(null, e);
46398        closeArray();
46399      };
46400      if (element.hasPrediction()) {
46401        openArray("prediction");
46402        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
46403          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
46404        closeArray();
46405      };
46406      if (element.hasMitigationElement()) {
46407        composeStringCore("mitigation", element.getMitigationElement(), false);
46408        composeStringExtras("mitigation", element.getMitigationElement(), false);
46409      }
46410      if (element.hasNote()) {
46411        openArray("note");
46412        for (Annotation e : element.getNote()) 
46413          composeAnnotation(null, e);
46414        closeArray();
46415      };
46416  }
46417
46418  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
46419    if (element != null) {
46420      open(name);
46421      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
46422      close();
46423    }
46424  }
46425
46426  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
46427      composeBackbone(element);
46428      if (element.hasOutcome()) {
46429        composeCodeableConcept("outcome", element.getOutcome());
46430      }
46431      if (element.hasProbability()) {
46432        composeType("probability", element.getProbability());
46433      }
46434      if (element.hasQualitativeRisk()) {
46435        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
46436      }
46437      if (element.hasRelativeRiskElement()) {
46438        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
46439        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
46440      }
46441      if (element.hasWhen()) {
46442        composeType("when", element.getWhen());
46443      }
46444      if (element.hasRationaleElement()) {
46445        composeStringCore("rationale", element.getRationaleElement(), false);
46446        composeStringExtras("rationale", element.getRationaleElement(), false);
46447      }
46448  }
46449
46450  protected void composeSchedule(String name, Schedule element) throws IOException {
46451    if (element != null) {
46452      prop("resourceType", name);
46453      composeScheduleInner(element);
46454    }
46455  }
46456
46457  protected void composeScheduleInner(Schedule element) throws IOException {
46458      composeDomainResourceElements(element);
46459      if (element.hasIdentifier()) {
46460        openArray("identifier");
46461        for (Identifier e : element.getIdentifier()) 
46462          composeIdentifier(null, e);
46463        closeArray();
46464      };
46465      if (element.hasActiveElement()) {
46466        composeBooleanCore("active", element.getActiveElement(), false);
46467        composeBooleanExtras("active", element.getActiveElement(), false);
46468      }
46469      if (element.hasServiceCategory()) {
46470        openArray("serviceCategory");
46471        for (CodeableConcept e : element.getServiceCategory()) 
46472          composeCodeableConcept(null, e);
46473        closeArray();
46474      };
46475      if (element.hasServiceType()) {
46476        openArray("serviceType");
46477        for (CodeableConcept e : element.getServiceType()) 
46478          composeCodeableConcept(null, e);
46479        closeArray();
46480      };
46481      if (element.hasSpecialty()) {
46482        openArray("specialty");
46483        for (CodeableConcept e : element.getSpecialty()) 
46484          composeCodeableConcept(null, e);
46485        closeArray();
46486      };
46487      if (element.hasActor()) {
46488        openArray("actor");
46489        for (Reference e : element.getActor()) 
46490          composeReference(null, e);
46491        closeArray();
46492      };
46493      if (element.hasPlanningHorizon()) {
46494        composePeriod("planningHorizon", element.getPlanningHorizon());
46495      }
46496      if (element.hasCommentElement()) {
46497        composeStringCore("comment", element.getCommentElement(), false);
46498        composeStringExtras("comment", element.getCommentElement(), false);
46499      }
46500  }
46501
46502  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
46503    if (element != null) {
46504      prop("resourceType", name);
46505      composeSearchParameterInner(element);
46506    }
46507  }
46508
46509  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
46510      composeDomainResourceElements(element);
46511      if (element.hasUrlElement()) {
46512        composeUriCore("url", element.getUrlElement(), false);
46513        composeUriExtras("url", element.getUrlElement(), false);
46514      }
46515      if (element.hasVersionElement()) {
46516        composeStringCore("version", element.getVersionElement(), false);
46517        composeStringExtras("version", element.getVersionElement(), false);
46518      }
46519      if (element.hasNameElement()) {
46520        composeStringCore("name", element.getNameElement(), false);
46521        composeStringExtras("name", element.getNameElement(), false);
46522      }
46523      if (element.hasDerivedFromElement()) {
46524        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
46525        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
46526      }
46527      if (element.hasStatusElement()) {
46528        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46529        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46530      }
46531      if (element.hasExperimentalElement()) {
46532        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46533        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46534      }
46535      if (element.hasDateElement()) {
46536        composeDateTimeCore("date", element.getDateElement(), false);
46537        composeDateTimeExtras("date", element.getDateElement(), false);
46538      }
46539      if (element.hasPublisherElement()) {
46540        composeStringCore("publisher", element.getPublisherElement(), false);
46541        composeStringExtras("publisher", element.getPublisherElement(), false);
46542      }
46543      if (element.hasContact()) {
46544        openArray("contact");
46545        for (ContactDetail e : element.getContact()) 
46546          composeContactDetail(null, e);
46547        closeArray();
46548      };
46549      if (element.hasDescriptionElement()) {
46550        composeMarkdownCore("description", element.getDescriptionElement(), false);
46551        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46552      }
46553      if (element.hasUseContext()) {
46554        openArray("useContext");
46555        for (UsageContext e : element.getUseContext()) 
46556          composeUsageContext(null, e);
46557        closeArray();
46558      };
46559      if (element.hasJurisdiction()) {
46560        openArray("jurisdiction");
46561        for (CodeableConcept e : element.getJurisdiction()) 
46562          composeCodeableConcept(null, e);
46563        closeArray();
46564      };
46565      if (element.hasPurposeElement()) {
46566        composeMarkdownCore("purpose", element.getPurposeElement(), false);
46567        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
46568      }
46569      if (element.hasCodeElement()) {
46570        composeCodeCore("code", element.getCodeElement(), false);
46571        composeCodeExtras("code", element.getCodeElement(), false);
46572      }
46573      if (element.hasBase()) {
46574        openArray("base");
46575        for (CodeType e : element.getBase()) 
46576          composeCodeCore(null, e, true);
46577        closeArray();
46578        if (anyHasExtras(element.getBase())) {
46579          openArray("_base");
46580          for (CodeType e : element.getBase()) 
46581            composeCodeExtras(null, e, true);
46582          closeArray();
46583        }
46584      };
46585      if (element.hasTypeElement()) {
46586        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
46587        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
46588      }
46589      if (element.hasExpressionElement()) {
46590        composeStringCore("expression", element.getExpressionElement(), false);
46591        composeStringExtras("expression", element.getExpressionElement(), false);
46592      }
46593      if (element.hasXpathElement()) {
46594        composeStringCore("xpath", element.getXpathElement(), false);
46595        composeStringExtras("xpath", element.getXpathElement(), false);
46596      }
46597      if (element.hasXpathUsageElement()) {
46598        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
46599        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
46600      }
46601      if (element.hasTarget()) {
46602        openArray("target");
46603        for (CodeType e : element.getTarget()) 
46604          composeCodeCore(null, e, true);
46605        closeArray();
46606        if (anyHasExtras(element.getTarget())) {
46607          openArray("_target");
46608          for (CodeType e : element.getTarget()) 
46609            composeCodeExtras(null, e, true);
46610          closeArray();
46611        }
46612      };
46613      if (element.hasMultipleOrElement()) {
46614        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
46615        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
46616      }
46617      if (element.hasMultipleAndElement()) {
46618        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
46619        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
46620      }
46621      if (element.hasComparator()) {
46622        openArray("comparator");
46623        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
46624          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
46625        closeArray();
46626        if (anyHasExtras(element.getComparator())) {
46627          openArray("_comparator");
46628          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
46629            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
46630          closeArray();
46631        }
46632      };
46633      if (element.hasModifier()) {
46634        openArray("modifier");
46635        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
46636          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
46637        closeArray();
46638        if (anyHasExtras(element.getModifier())) {
46639          openArray("_modifier");
46640          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
46641            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
46642          closeArray();
46643        }
46644      };
46645      if (element.hasChain()) {
46646        openArray("chain");
46647        for (StringType e : element.getChain()) 
46648          composeStringCore(null, e, true);
46649        closeArray();
46650        if (anyHasExtras(element.getChain())) {
46651          openArray("_chain");
46652          for (StringType e : element.getChain()) 
46653            composeStringExtras(null, e, true);
46654          closeArray();
46655        }
46656      };
46657      if (element.hasComponent()) {
46658        openArray("component");
46659        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
46660          composeSearchParameterSearchParameterComponentComponent(null, e);
46661        closeArray();
46662      };
46663  }
46664
46665  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
46666    if (element != null) {
46667      open(name);
46668      composeSearchParameterSearchParameterComponentComponentInner(element);
46669      close();
46670    }
46671  }
46672
46673  protected void composeSearchParameterSearchParameterComponentComponentInner(SearchParameter.SearchParameterComponentComponent element) throws IOException {
46674      composeBackbone(element);
46675      if (element.hasDefinitionElement()) {
46676        composeCanonicalCore("definition", element.getDefinitionElement(), false);
46677        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
46678      }
46679      if (element.hasExpressionElement()) {
46680        composeStringCore("expression", element.getExpressionElement(), false);
46681        composeStringExtras("expression", element.getExpressionElement(), false);
46682      }
46683  }
46684
46685  protected void composeSequence(String name, Sequence element) throws IOException {
46686    if (element != null) {
46687      prop("resourceType", name);
46688      composeSequenceInner(element);
46689    }
46690  }
46691
46692  protected void composeSequenceInner(Sequence element) throws IOException {
46693      composeDomainResourceElements(element);
46694      if (element.hasIdentifier()) {
46695        openArray("identifier");
46696        for (Identifier e : element.getIdentifier()) 
46697          composeIdentifier(null, e);
46698        closeArray();
46699      };
46700      if (element.hasTypeElement()) {
46701        composeEnumerationCore("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
46702        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
46703      }
46704      if (element.hasCoordinateSystemElement()) {
46705        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
46706        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
46707      }
46708      if (element.hasPatient()) {
46709        composeReference("patient", element.getPatient());
46710      }
46711      if (element.hasSpecimen()) {
46712        composeReference("specimen", element.getSpecimen());
46713      }
46714      if (element.hasDevice()) {
46715        composeReference("device", element.getDevice());
46716      }
46717      if (element.hasPerformer()) {
46718        composeReference("performer", element.getPerformer());
46719      }
46720      if (element.hasQuantity()) {
46721        composeQuantity("quantity", element.getQuantity());
46722      }
46723      if (element.hasReferenceSeq()) {
46724        composeSequenceSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
46725      }
46726      if (element.hasVariant()) {
46727        openArray("variant");
46728        for (Sequence.SequenceVariantComponent e : element.getVariant()) 
46729          composeSequenceSequenceVariantComponent(null, e);
46730        closeArray();
46731      };
46732      if (element.hasObservedSeqElement()) {
46733        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
46734        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
46735      }
46736      if (element.hasQuality()) {
46737        openArray("quality");
46738        for (Sequence.SequenceQualityComponent e : element.getQuality()) 
46739          composeSequenceSequenceQualityComponent(null, e);
46740        closeArray();
46741      };
46742      if (element.hasReadCoverageElement()) {
46743        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
46744        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
46745      }
46746      if (element.hasRepository()) {
46747        openArray("repository");
46748        for (Sequence.SequenceRepositoryComponent e : element.getRepository()) 
46749          composeSequenceSequenceRepositoryComponent(null, e);
46750        closeArray();
46751      };
46752      if (element.hasPointer()) {
46753        openArray("pointer");
46754        for (Reference e : element.getPointer()) 
46755          composeReference(null, e);
46756        closeArray();
46757      };
46758      if (element.hasStructureVariant()) {
46759        openArray("structureVariant");
46760        for (Sequence.SequenceStructureVariantComponent e : element.getStructureVariant()) 
46761          composeSequenceSequenceStructureVariantComponent(null, e);
46762        closeArray();
46763      };
46764  }
46765
46766  protected void composeSequenceSequenceReferenceSeqComponent(String name, Sequence.SequenceReferenceSeqComponent element) throws IOException {
46767    if (element != null) {
46768      open(name);
46769      composeSequenceSequenceReferenceSeqComponentInner(element);
46770      close();
46771    }
46772  }
46773
46774  protected void composeSequenceSequenceReferenceSeqComponentInner(Sequence.SequenceReferenceSeqComponent element) throws IOException {
46775      composeBackbone(element);
46776      if (element.hasChromosome()) {
46777        composeCodeableConcept("chromosome", element.getChromosome());
46778      }
46779      if (element.hasGenomeBuildElement()) {
46780        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
46781        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
46782      }
46783      if (element.hasOrientationElement()) {
46784        composeEnumerationCore("orientation", element.getOrientationElement(), new Sequence.OrientationTypeEnumFactory(), false);
46785        composeEnumerationExtras("orientation", element.getOrientationElement(), new Sequence.OrientationTypeEnumFactory(), false);
46786      }
46787      if (element.hasReferenceSeqId()) {
46788        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
46789      }
46790      if (element.hasReferenceSeqPointer()) {
46791        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
46792      }
46793      if (element.hasReferenceSeqStringElement()) {
46794        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
46795        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
46796      }
46797      if (element.hasStrandElement()) {
46798        composeEnumerationCore("strand", element.getStrandElement(), new Sequence.StrandTypeEnumFactory(), false);
46799        composeEnumerationExtras("strand", element.getStrandElement(), new Sequence.StrandTypeEnumFactory(), false);
46800      }
46801      if (element.hasWindowStartElement()) {
46802        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
46803        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
46804      }
46805      if (element.hasWindowEndElement()) {
46806        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
46807        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
46808      }
46809  }
46810
46811  protected void composeSequenceSequenceVariantComponent(String name, Sequence.SequenceVariantComponent element) throws IOException {
46812    if (element != null) {
46813      open(name);
46814      composeSequenceSequenceVariantComponentInner(element);
46815      close();
46816    }
46817  }
46818
46819  protected void composeSequenceSequenceVariantComponentInner(Sequence.SequenceVariantComponent element) throws IOException {
46820      composeBackbone(element);
46821      if (element.hasStartElement()) {
46822        composeIntegerCore("start", element.getStartElement(), false);
46823        composeIntegerExtras("start", element.getStartElement(), false);
46824      }
46825      if (element.hasEndElement()) {
46826        composeIntegerCore("end", element.getEndElement(), false);
46827        composeIntegerExtras("end", element.getEndElement(), false);
46828      }
46829      if (element.hasObservedAlleleElement()) {
46830        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
46831        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
46832      }
46833      if (element.hasReferenceAlleleElement()) {
46834        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
46835        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
46836      }
46837      if (element.hasCigarElement()) {
46838        composeStringCore("cigar", element.getCigarElement(), false);
46839        composeStringExtras("cigar", element.getCigarElement(), false);
46840      }
46841      if (element.hasVariantPointer()) {
46842        composeReference("variantPointer", element.getVariantPointer());
46843      }
46844  }
46845
46846  protected void composeSequenceSequenceQualityComponent(String name, Sequence.SequenceQualityComponent element) throws IOException {
46847    if (element != null) {
46848      open(name);
46849      composeSequenceSequenceQualityComponentInner(element);
46850      close();
46851    }
46852  }
46853
46854  protected void composeSequenceSequenceQualityComponentInner(Sequence.SequenceQualityComponent element) throws IOException {
46855      composeBackbone(element);
46856      if (element.hasTypeElement()) {
46857        composeEnumerationCore("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory(), false);
46858        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory(), false);
46859      }
46860      if (element.hasStandardSequence()) {
46861        composeCodeableConcept("standardSequence", element.getStandardSequence());
46862      }
46863      if (element.hasStartElement()) {
46864        composeIntegerCore("start", element.getStartElement(), false);
46865        composeIntegerExtras("start", element.getStartElement(), false);
46866      }
46867      if (element.hasEndElement()) {
46868        composeIntegerCore("end", element.getEndElement(), false);
46869        composeIntegerExtras("end", element.getEndElement(), false);
46870      }
46871      if (element.hasScore()) {
46872        composeQuantity("score", element.getScore());
46873      }
46874      if (element.hasMethod()) {
46875        composeCodeableConcept("method", element.getMethod());
46876      }
46877      if (element.hasTruthTPElement()) {
46878        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
46879        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
46880      }
46881      if (element.hasQueryTPElement()) {
46882        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
46883        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
46884      }
46885      if (element.hasTruthFNElement()) {
46886        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
46887        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
46888      }
46889      if (element.hasQueryFPElement()) {
46890        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
46891        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
46892      }
46893      if (element.hasGtFPElement()) {
46894        composeDecimalCore("gtFP", element.getGtFPElement(), false);
46895        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
46896      }
46897      if (element.hasPrecisionElement()) {
46898        composeDecimalCore("precision", element.getPrecisionElement(), false);
46899        composeDecimalExtras("precision", element.getPrecisionElement(), false);
46900      }
46901      if (element.hasRecallElement()) {
46902        composeDecimalCore("recall", element.getRecallElement(), false);
46903        composeDecimalExtras("recall", element.getRecallElement(), false);
46904      }
46905      if (element.hasFScoreElement()) {
46906        composeDecimalCore("fScore", element.getFScoreElement(), false);
46907        composeDecimalExtras("fScore", element.getFScoreElement(), false);
46908      }
46909      if (element.hasRoc()) {
46910        composeSequenceSequenceQualityRocComponent("roc", element.getRoc());
46911      }
46912  }
46913
46914  protected void composeSequenceSequenceQualityRocComponent(String name, Sequence.SequenceQualityRocComponent element) throws IOException {
46915    if (element != null) {
46916      open(name);
46917      composeSequenceSequenceQualityRocComponentInner(element);
46918      close();
46919    }
46920  }
46921
46922  protected void composeSequenceSequenceQualityRocComponentInner(Sequence.SequenceQualityRocComponent element) throws IOException {
46923      composeBackbone(element);
46924      if (element.hasScore()) {
46925        openArray("score");
46926        for (IntegerType e : element.getScore()) 
46927          composeIntegerCore(null, e, true);
46928        closeArray();
46929        if (anyHasExtras(element.getScore())) {
46930          openArray("_score");
46931          for (IntegerType e : element.getScore()) 
46932            composeIntegerExtras(null, e, true);
46933          closeArray();
46934        }
46935      };
46936      if (element.hasNumTP()) {
46937        openArray("numTP");
46938        for (IntegerType e : element.getNumTP()) 
46939          composeIntegerCore(null, e, true);
46940        closeArray();
46941        if (anyHasExtras(element.getNumTP())) {
46942          openArray("_numTP");
46943          for (IntegerType e : element.getNumTP()) 
46944            composeIntegerExtras(null, e, true);
46945          closeArray();
46946        }
46947      };
46948      if (element.hasNumFP()) {
46949        openArray("numFP");
46950        for (IntegerType e : element.getNumFP()) 
46951          composeIntegerCore(null, e, true);
46952        closeArray();
46953        if (anyHasExtras(element.getNumFP())) {
46954          openArray("_numFP");
46955          for (IntegerType e : element.getNumFP()) 
46956            composeIntegerExtras(null, e, true);
46957          closeArray();
46958        }
46959      };
46960      if (element.hasNumFN()) {
46961        openArray("numFN");
46962        for (IntegerType e : element.getNumFN()) 
46963          composeIntegerCore(null, e, true);
46964        closeArray();
46965        if (anyHasExtras(element.getNumFN())) {
46966          openArray("_numFN");
46967          for (IntegerType e : element.getNumFN()) 
46968            composeIntegerExtras(null, e, true);
46969          closeArray();
46970        }
46971      };
46972      if (element.hasPrecision()) {
46973        openArray("precision");
46974        for (DecimalType e : element.getPrecision()) 
46975          composeDecimalCore(null, e, true);
46976        closeArray();
46977        if (anyHasExtras(element.getPrecision())) {
46978          openArray("_precision");
46979          for (DecimalType e : element.getPrecision()) 
46980            composeDecimalExtras(null, e, true);
46981          closeArray();
46982        }
46983      };
46984      if (element.hasSensitivity()) {
46985        openArray("sensitivity");
46986        for (DecimalType e : element.getSensitivity()) 
46987          composeDecimalCore(null, e, true);
46988        closeArray();
46989        if (anyHasExtras(element.getSensitivity())) {
46990          openArray("_sensitivity");
46991          for (DecimalType e : element.getSensitivity()) 
46992            composeDecimalExtras(null, e, true);
46993          closeArray();
46994        }
46995      };
46996      if (element.hasFMeasure()) {
46997        openArray("fMeasure");
46998        for (DecimalType e : element.getFMeasure()) 
46999          composeDecimalCore(null, e, true);
47000        closeArray();
47001        if (anyHasExtras(element.getFMeasure())) {
47002          openArray("_fMeasure");
47003          for (DecimalType e : element.getFMeasure()) 
47004            composeDecimalExtras(null, e, true);
47005          closeArray();
47006        }
47007      };
47008  }
47009
47010  protected void composeSequenceSequenceRepositoryComponent(String name, Sequence.SequenceRepositoryComponent element) throws IOException {
47011    if (element != null) {
47012      open(name);
47013      composeSequenceSequenceRepositoryComponentInner(element);
47014      close();
47015    }
47016  }
47017
47018  protected void composeSequenceSequenceRepositoryComponentInner(Sequence.SequenceRepositoryComponent element) throws IOException {
47019      composeBackbone(element);
47020      if (element.hasTypeElement()) {
47021        composeEnumerationCore("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory(), false);
47022        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory(), false);
47023      }
47024      if (element.hasUrlElement()) {
47025        composeUriCore("url", element.getUrlElement(), false);
47026        composeUriExtras("url", element.getUrlElement(), false);
47027      }
47028      if (element.hasNameElement()) {
47029        composeStringCore("name", element.getNameElement(), false);
47030        composeStringExtras("name", element.getNameElement(), false);
47031      }
47032      if (element.hasDatasetIdElement()) {
47033        composeStringCore("datasetId", element.getDatasetIdElement(), false);
47034        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
47035      }
47036      if (element.hasVariantsetIdElement()) {
47037        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
47038        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
47039      }
47040      if (element.hasReadsetIdElement()) {
47041        composeStringCore("readsetId", element.getReadsetIdElement(), false);
47042        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
47043      }
47044  }
47045
47046  protected void composeSequenceSequenceStructureVariantComponent(String name, Sequence.SequenceStructureVariantComponent element) throws IOException {
47047    if (element != null) {
47048      open(name);
47049      composeSequenceSequenceStructureVariantComponentInner(element);
47050      close();
47051    }
47052  }
47053
47054  protected void composeSequenceSequenceStructureVariantComponentInner(Sequence.SequenceStructureVariantComponent element) throws IOException {
47055      composeBackbone(element);
47056      if (element.hasPrecisionElement()) {
47057        composeStringCore("precision", element.getPrecisionElement(), false);
47058        composeStringExtras("precision", element.getPrecisionElement(), false);
47059      }
47060      if (element.hasReportedaCGHRatioElement()) {
47061        composeDecimalCore("reportedaCGHRatio", element.getReportedaCGHRatioElement(), false);
47062        composeDecimalExtras("reportedaCGHRatio", element.getReportedaCGHRatioElement(), false);
47063      }
47064      if (element.hasLengthElement()) {
47065        composeIntegerCore("length", element.getLengthElement(), false);
47066        composeIntegerExtras("length", element.getLengthElement(), false);
47067      }
47068      if (element.hasOuter()) {
47069        composeSequenceSequenceStructureVariantOuterComponent("outer", element.getOuter());
47070      }
47071      if (element.hasInner()) {
47072        composeSequenceSequenceStructureVariantInnerComponent("inner", element.getInner());
47073      }
47074  }
47075
47076  protected void composeSequenceSequenceStructureVariantOuterComponent(String name, Sequence.SequenceStructureVariantOuterComponent element) throws IOException {
47077    if (element != null) {
47078      open(name);
47079      composeSequenceSequenceStructureVariantOuterComponentInner(element);
47080      close();
47081    }
47082  }
47083
47084  protected void composeSequenceSequenceStructureVariantOuterComponentInner(Sequence.SequenceStructureVariantOuterComponent element) throws IOException {
47085      composeBackbone(element);
47086      if (element.hasStartElement()) {
47087        composeIntegerCore("start", element.getStartElement(), false);
47088        composeIntegerExtras("start", element.getStartElement(), false);
47089      }
47090      if (element.hasEndElement()) {
47091        composeIntegerCore("end", element.getEndElement(), false);
47092        composeIntegerExtras("end", element.getEndElement(), false);
47093      }
47094  }
47095
47096  protected void composeSequenceSequenceStructureVariantInnerComponent(String name, Sequence.SequenceStructureVariantInnerComponent element) throws IOException {
47097    if (element != null) {
47098      open(name);
47099      composeSequenceSequenceStructureVariantInnerComponentInner(element);
47100      close();
47101    }
47102  }
47103
47104  protected void composeSequenceSequenceStructureVariantInnerComponentInner(Sequence.SequenceStructureVariantInnerComponent element) throws IOException {
47105      composeBackbone(element);
47106      if (element.hasStartElement()) {
47107        composeIntegerCore("start", element.getStartElement(), false);
47108        composeIntegerExtras("start", element.getStartElement(), false);
47109      }
47110      if (element.hasEndElement()) {
47111        composeIntegerCore("end", element.getEndElement(), false);
47112        composeIntegerExtras("end", element.getEndElement(), false);
47113      }
47114  }
47115
47116  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
47117    if (element != null) {
47118      prop("resourceType", name);
47119      composeServiceRequestInner(element);
47120    }
47121  }
47122
47123  protected void composeServiceRequestInner(ServiceRequest element) throws IOException {
47124      composeDomainResourceElements(element);
47125      if (element.hasIdentifier()) {
47126        openArray("identifier");
47127        for (Identifier e : element.getIdentifier()) 
47128          composeIdentifier(null, e);
47129        closeArray();
47130      };
47131      if (element.hasInstantiates()) {
47132        openArray("instantiates");
47133        for (UriType e : element.getInstantiates()) 
47134          composeUriCore(null, e, true);
47135        closeArray();
47136        if (anyHasExtras(element.getInstantiates())) {
47137          openArray("_instantiates");
47138          for (UriType e : element.getInstantiates()) 
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.hasReplaces()) {
47150        openArray("replaces");
47151        for (Reference e : element.getReplaces()) 
47152          composeReference(null, e);
47153        closeArray();
47154      };
47155      if (element.hasRequisition()) {
47156        composeIdentifier("requisition", element.getRequisition());
47157      }
47158      if (element.hasStatusElement()) {
47159        composeEnumerationCore("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
47160        composeEnumerationExtras("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
47161      }
47162      if (element.hasIntentElement()) {
47163        composeEnumerationCore("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
47164        composeEnumerationExtras("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
47165      }
47166      if (element.hasCategory()) {
47167        openArray("category");
47168        for (CodeableConcept e : element.getCategory()) 
47169          composeCodeableConcept(null, e);
47170        closeArray();
47171      };
47172      if (element.hasPriorityElement()) {
47173        composeEnumerationCore("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
47174        composeEnumerationExtras("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
47175      }
47176      if (element.hasDoNotPerformElement()) {
47177        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
47178        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
47179      }
47180      if (element.hasCode()) {
47181        composeCodeableConcept("code", element.getCode());
47182      }
47183      if (element.hasOrderDetail()) {
47184        openArray("orderDetail");
47185        for (CodeableConcept e : element.getOrderDetail()) 
47186          composeCodeableConcept(null, e);
47187        closeArray();
47188      };
47189      if (element.hasSubject()) {
47190        composeReference("subject", element.getSubject());
47191      }
47192      if (element.hasContext()) {
47193        composeReference("context", element.getContext());
47194      }
47195      if (element.hasOccurrence()) {
47196        composeType("occurrence", element.getOccurrence());
47197      }
47198      if (element.hasAsNeeded()) {
47199        composeType("asNeeded", element.getAsNeeded());
47200      }
47201      if (element.hasAuthoredOnElement()) {
47202        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
47203        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
47204      }
47205      if (element.hasRequester()) {
47206        composeReference("requester", element.getRequester());
47207      }
47208      if (element.hasPerformerType()) {
47209        composeCodeableConcept("performerType", element.getPerformerType());
47210      }
47211      if (element.hasPerformer()) {
47212        openArray("performer");
47213        for (Reference e : element.getPerformer()) 
47214          composeReference(null, e);
47215        closeArray();
47216      };
47217      if (element.hasReasonCode()) {
47218        openArray("reasonCode");
47219        for (CodeableConcept e : element.getReasonCode()) 
47220          composeCodeableConcept(null, e);
47221        closeArray();
47222      };
47223      if (element.hasReasonReference()) {
47224        openArray("reasonReference");
47225        for (Reference e : element.getReasonReference()) 
47226          composeReference(null, e);
47227        closeArray();
47228      };
47229      if (element.hasInsurance()) {
47230        openArray("insurance");
47231        for (Reference e : element.getInsurance()) 
47232          composeReference(null, e);
47233        closeArray();
47234      };
47235      if (element.hasSupportingInfo()) {
47236        openArray("supportingInfo");
47237        for (Reference e : element.getSupportingInfo()) 
47238          composeReference(null, e);
47239        closeArray();
47240      };
47241      if (element.hasSpecimen()) {
47242        openArray("specimen");
47243        for (Reference e : element.getSpecimen()) 
47244          composeReference(null, e);
47245        closeArray();
47246      };
47247      if (element.hasBodySite()) {
47248        openArray("bodySite");
47249        for (CodeableConcept e : element.getBodySite()) 
47250          composeCodeableConcept(null, e);
47251        closeArray();
47252      };
47253      if (element.hasNote()) {
47254        openArray("note");
47255        for (Annotation e : element.getNote()) 
47256          composeAnnotation(null, e);
47257        closeArray();
47258      };
47259      if (element.hasPatientInstructionElement()) {
47260        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
47261        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
47262      }
47263      if (element.hasRelevantHistory()) {
47264        openArray("relevantHistory");
47265        for (Reference e : element.getRelevantHistory()) 
47266          composeReference(null, e);
47267        closeArray();
47268      };
47269  }
47270
47271  protected void composeSlot(String name, Slot element) throws IOException {
47272    if (element != null) {
47273      prop("resourceType", name);
47274      composeSlotInner(element);
47275    }
47276  }
47277
47278  protected void composeSlotInner(Slot element) throws IOException {
47279      composeDomainResourceElements(element);
47280      if (element.hasIdentifier()) {
47281        openArray("identifier");
47282        for (Identifier e : element.getIdentifier()) 
47283          composeIdentifier(null, e);
47284        closeArray();
47285      };
47286      if (element.hasServiceCategory()) {
47287        openArray("serviceCategory");
47288        for (CodeableConcept e : element.getServiceCategory()) 
47289          composeCodeableConcept(null, e);
47290        closeArray();
47291      };
47292      if (element.hasServiceType()) {
47293        openArray("serviceType");
47294        for (CodeableConcept e : element.getServiceType()) 
47295          composeCodeableConcept(null, e);
47296        closeArray();
47297      };
47298      if (element.hasSpecialty()) {
47299        openArray("specialty");
47300        for (CodeableConcept e : element.getSpecialty()) 
47301          composeCodeableConcept(null, e);
47302        closeArray();
47303      };
47304      if (element.hasAppointmentType()) {
47305        composeCodeableConcept("appointmentType", element.getAppointmentType());
47306      }
47307      if (element.hasSchedule()) {
47308        composeReference("schedule", element.getSchedule());
47309      }
47310      if (element.hasStatusElement()) {
47311        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
47312        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
47313      }
47314      if (element.hasStartElement()) {
47315        composeInstantCore("start", element.getStartElement(), false);
47316        composeInstantExtras("start", element.getStartElement(), false);
47317      }
47318      if (element.hasEndElement()) {
47319        composeInstantCore("end", element.getEndElement(), false);
47320        composeInstantExtras("end", element.getEndElement(), false);
47321      }
47322      if (element.hasOverbookedElement()) {
47323        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
47324        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
47325      }
47326      if (element.hasCommentElement()) {
47327        composeStringCore("comment", element.getCommentElement(), false);
47328        composeStringExtras("comment", element.getCommentElement(), false);
47329      }
47330  }
47331
47332  protected void composeSpecimen(String name, Specimen element) throws IOException {
47333    if (element != null) {
47334      prop("resourceType", name);
47335      composeSpecimenInner(element);
47336    }
47337  }
47338
47339  protected void composeSpecimenInner(Specimen element) throws IOException {
47340      composeDomainResourceElements(element);
47341      if (element.hasIdentifier()) {
47342        openArray("identifier");
47343        for (Identifier e : element.getIdentifier()) 
47344          composeIdentifier(null, e);
47345        closeArray();
47346      };
47347      if (element.hasAccessionIdentifier()) {
47348        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
47349      }
47350      if (element.hasStatusElement()) {
47351        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
47352        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
47353      }
47354      if (element.hasType()) {
47355        composeCodeableConcept("type", element.getType());
47356      }
47357      if (element.hasSubject()) {
47358        composeReference("subject", element.getSubject());
47359      }
47360      if (element.hasReceivedTimeElement()) {
47361        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
47362        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
47363      }
47364      if (element.hasParent()) {
47365        openArray("parent");
47366        for (Reference e : element.getParent()) 
47367          composeReference(null, e);
47368        closeArray();
47369      };
47370      if (element.hasRequest()) {
47371        openArray("request");
47372        for (Reference e : element.getRequest()) 
47373          composeReference(null, e);
47374        closeArray();
47375      };
47376      if (element.hasCollection()) {
47377        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
47378      }
47379      if (element.hasProcessing()) {
47380        openArray("processing");
47381        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
47382          composeSpecimenSpecimenProcessingComponent(null, e);
47383        closeArray();
47384      };
47385      if (element.hasContainer()) {
47386        openArray("container");
47387        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
47388          composeSpecimenSpecimenContainerComponent(null, e);
47389        closeArray();
47390      };
47391      if (element.hasNote()) {
47392        openArray("note");
47393        for (Annotation e : element.getNote()) 
47394          composeAnnotation(null, e);
47395        closeArray();
47396      };
47397  }
47398
47399  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
47400    if (element != null) {
47401      open(name);
47402      composeSpecimenSpecimenCollectionComponentInner(element);
47403      close();
47404    }
47405  }
47406
47407  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
47408      composeBackbone(element);
47409      if (element.hasCollector()) {
47410        composeReference("collector", element.getCollector());
47411      }
47412      if (element.hasCollected()) {
47413        composeType("collected", element.getCollected());
47414      }
47415      if (element.hasQuantity()) {
47416        composeSimpleQuantity("quantity", element.getQuantity());
47417      }
47418      if (element.hasMethod()) {
47419        composeCodeableConcept("method", element.getMethod());
47420      }
47421      if (element.hasBodySite()) {
47422        composeCodeableConcept("bodySite", element.getBodySite());
47423      }
47424  }
47425
47426  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
47427    if (element != null) {
47428      open(name);
47429      composeSpecimenSpecimenProcessingComponentInner(element);
47430      close();
47431    }
47432  }
47433
47434  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element) throws IOException {
47435      composeBackbone(element);
47436      if (element.hasDescriptionElement()) {
47437        composeStringCore("description", element.getDescriptionElement(), false);
47438        composeStringExtras("description", element.getDescriptionElement(), false);
47439      }
47440      if (element.hasProcedure()) {
47441        composeCodeableConcept("procedure", element.getProcedure());
47442      }
47443      if (element.hasAdditive()) {
47444        openArray("additive");
47445        for (Reference e : element.getAdditive()) 
47446          composeReference(null, e);
47447        closeArray();
47448      };
47449      if (element.hasTime()) {
47450        composeType("time", element.getTime());
47451      }
47452  }
47453
47454  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
47455    if (element != null) {
47456      open(name);
47457      composeSpecimenSpecimenContainerComponentInner(element);
47458      close();
47459    }
47460  }
47461
47462  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
47463      composeBackbone(element);
47464      if (element.hasIdentifier()) {
47465        openArray("identifier");
47466        for (Identifier e : element.getIdentifier()) 
47467          composeIdentifier(null, e);
47468        closeArray();
47469      };
47470      if (element.hasDescriptionElement()) {
47471        composeStringCore("description", element.getDescriptionElement(), false);
47472        composeStringExtras("description", element.getDescriptionElement(), false);
47473      }
47474      if (element.hasType()) {
47475        composeCodeableConcept("type", element.getType());
47476      }
47477      if (element.hasCapacity()) {
47478        composeSimpleQuantity("capacity", element.getCapacity());
47479      }
47480      if (element.hasSpecimenQuantity()) {
47481        composeSimpleQuantity("specimenQuantity", element.getSpecimenQuantity());
47482      }
47483      if (element.hasAdditive()) {
47484        composeType("additive", element.getAdditive());
47485      }
47486  }
47487
47488  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
47489    if (element != null) {
47490      prop("resourceType", name);
47491      composeSpecimenDefinitionInner(element);
47492    }
47493  }
47494
47495  protected void composeSpecimenDefinitionInner(SpecimenDefinition element) throws IOException {
47496      composeDomainResourceElements(element);
47497      if (element.hasIdentifier()) {
47498        composeIdentifier("identifier", element.getIdentifier());
47499      }
47500      if (element.hasTypeCollected()) {
47501        composeCodeableConcept("typeCollected", element.getTypeCollected());
47502      }
47503      if (element.hasPatientPreparationElement()) {
47504        composeStringCore("patientPreparation", element.getPatientPreparationElement(), false);
47505        composeStringExtras("patientPreparation", element.getPatientPreparationElement(), false);
47506      }
47507      if (element.hasTimeAspectElement()) {
47508        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
47509        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
47510      }
47511      if (element.hasCollection()) {
47512        openArray("collection");
47513        for (CodeableConcept e : element.getCollection()) 
47514          composeCodeableConcept(null, e);
47515        closeArray();
47516      };
47517      if (element.hasSpecimenToLab()) {
47518        openArray("specimenToLab");
47519        for (SpecimenDefinition.SpecimenDefinitionSpecimenToLabComponent e : element.getSpecimenToLab()) 
47520          composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabComponent(null, e);
47521        closeArray();
47522      };
47523  }
47524
47525  protected void composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabComponent(String name, SpecimenDefinition.SpecimenDefinitionSpecimenToLabComponent element) throws IOException {
47526    if (element != null) {
47527      open(name);
47528      composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabComponentInner(element);
47529      close();
47530    }
47531  }
47532
47533  protected void composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabComponentInner(SpecimenDefinition.SpecimenDefinitionSpecimenToLabComponent element) throws IOException {
47534      composeBackbone(element);
47535      if (element.hasIsDerivedElement()) {
47536        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
47537        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
47538      }
47539      if (element.hasType()) {
47540        composeCodeableConcept("type", element.getType());
47541      }
47542      if (element.hasPreferenceElement()) {
47543        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
47544        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
47545      }
47546      if (element.hasContainerMaterial()) {
47547        composeCodeableConcept("containerMaterial", element.getContainerMaterial());
47548      }
47549      if (element.hasContainerType()) {
47550        composeCodeableConcept("containerType", element.getContainerType());
47551      }
47552      if (element.hasContainerCap()) {
47553        composeCodeableConcept("containerCap", element.getContainerCap());
47554      }
47555      if (element.hasContainerDescriptionElement()) {
47556        composeStringCore("containerDescription", element.getContainerDescriptionElement(), false);
47557        composeStringExtras("containerDescription", element.getContainerDescriptionElement(), false);
47558      }
47559      if (element.hasContainerCapacity()) {
47560        composeSimpleQuantity("containerCapacity", element.getContainerCapacity());
47561      }
47562      if (element.hasContainerMinimumVolume()) {
47563        composeSimpleQuantity("containerMinimumVolume", element.getContainerMinimumVolume());
47564      }
47565      if (element.hasContainerAdditive()) {
47566        openArray("containerAdditive");
47567        for (SpecimenDefinition.SpecimenDefinitionSpecimenToLabContainerAdditiveComponent e : element.getContainerAdditive()) 
47568          composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabContainerAdditiveComponent(null, e);
47569        closeArray();
47570      };
47571      if (element.hasContainerPreparationElement()) {
47572        composeStringCore("containerPreparation", element.getContainerPreparationElement(), false);
47573        composeStringExtras("containerPreparation", element.getContainerPreparationElement(), false);
47574      }
47575      if (element.hasRequirementElement()) {
47576        composeStringCore("requirement", element.getRequirementElement(), false);
47577        composeStringExtras("requirement", element.getRequirementElement(), false);
47578      }
47579      if (element.hasRetentionTime()) {
47580        composeDuration("retentionTime", element.getRetentionTime());
47581      }
47582      if (element.hasRejectionCriterion()) {
47583        openArray("rejectionCriterion");
47584        for (CodeableConcept e : element.getRejectionCriterion()) 
47585          composeCodeableConcept(null, e);
47586        closeArray();
47587      };
47588      if (element.hasHandling()) {
47589        openArray("handling");
47590        for (SpecimenDefinition.SpecimenDefinitionSpecimenToLabHandlingComponent e : element.getHandling()) 
47591          composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabHandlingComponent(null, e);
47592        closeArray();
47593      };
47594  }
47595
47596  protected void composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionSpecimenToLabContainerAdditiveComponent element) throws IOException {
47597    if (element != null) {
47598      open(name);
47599      composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabContainerAdditiveComponentInner(element);
47600      close();
47601    }
47602  }
47603
47604  protected void composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabContainerAdditiveComponentInner(SpecimenDefinition.SpecimenDefinitionSpecimenToLabContainerAdditiveComponent element) throws IOException {
47605      composeBackbone(element);
47606      if (element.hasAdditive()) {
47607        composeType("additive", element.getAdditive());
47608      }
47609  }
47610
47611  protected void composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionSpecimenToLabHandlingComponent element) throws IOException {
47612    if (element != null) {
47613      open(name);
47614      composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabHandlingComponentInner(element);
47615      close();
47616    }
47617  }
47618
47619  protected void composeSpecimenDefinitionSpecimenDefinitionSpecimenToLabHandlingComponentInner(SpecimenDefinition.SpecimenDefinitionSpecimenToLabHandlingComponent element) throws IOException {
47620      composeBackbone(element);
47621      if (element.hasConditionSet()) {
47622        composeCodeableConcept("conditionSet", element.getConditionSet());
47623      }
47624      if (element.hasTempRange()) {
47625        composeRange("tempRange", element.getTempRange());
47626      }
47627      if (element.hasMaxDuration()) {
47628        composeDuration("maxDuration", element.getMaxDuration());
47629      }
47630      if (element.hasLightExposureElement()) {
47631        composeStringCore("lightExposure", element.getLightExposureElement(), false);
47632        composeStringExtras("lightExposure", element.getLightExposureElement(), false);
47633      }
47634      if (element.hasInstructionElement()) {
47635        composeStringCore("instruction", element.getInstructionElement(), false);
47636        composeStringExtras("instruction", element.getInstructionElement(), false);
47637      }
47638  }
47639
47640  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
47641    if (element != null) {
47642      prop("resourceType", name);
47643      composeStructureDefinitionInner(element);
47644    }
47645  }
47646
47647  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
47648      composeDomainResourceElements(element);
47649      if (element.hasUrlElement()) {
47650        composeUriCore("url", element.getUrlElement(), false);
47651        composeUriExtras("url", element.getUrlElement(), false);
47652      }
47653      if (element.hasIdentifier()) {
47654        openArray("identifier");
47655        for (Identifier e : element.getIdentifier()) 
47656          composeIdentifier(null, e);
47657        closeArray();
47658      };
47659      if (element.hasVersionElement()) {
47660        composeStringCore("version", element.getVersionElement(), false);
47661        composeStringExtras("version", element.getVersionElement(), false);
47662      }
47663      if (element.hasNameElement()) {
47664        composeStringCore("name", element.getNameElement(), false);
47665        composeStringExtras("name", element.getNameElement(), false);
47666      }
47667      if (element.hasTitleElement()) {
47668        composeStringCore("title", element.getTitleElement(), false);
47669        composeStringExtras("title", element.getTitleElement(), false);
47670      }
47671      if (element.hasStatusElement()) {
47672        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47673        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47674      }
47675      if (element.hasExperimentalElement()) {
47676        composeBooleanCore("experimental", element.getExperimentalElement(), false);
47677        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
47678      }
47679      if (element.hasDateElement()) {
47680        composeDateTimeCore("date", element.getDateElement(), false);
47681        composeDateTimeExtras("date", element.getDateElement(), false);
47682      }
47683      if (element.hasPublisherElement()) {
47684        composeStringCore("publisher", element.getPublisherElement(), false);
47685        composeStringExtras("publisher", element.getPublisherElement(), false);
47686      }
47687      if (element.hasContact()) {
47688        openArray("contact");
47689        for (ContactDetail e : element.getContact()) 
47690          composeContactDetail(null, e);
47691        closeArray();
47692      };
47693      if (element.hasDescriptionElement()) {
47694        composeMarkdownCore("description", element.getDescriptionElement(), false);
47695        composeMarkdownExtras("description", element.getDescriptionElement(), false);
47696      }
47697      if (element.hasUseContext()) {
47698        openArray("useContext");
47699        for (UsageContext e : element.getUseContext()) 
47700          composeUsageContext(null, e);
47701        closeArray();
47702      };
47703      if (element.hasJurisdiction()) {
47704        openArray("jurisdiction");
47705        for (CodeableConcept e : element.getJurisdiction()) 
47706          composeCodeableConcept(null, e);
47707        closeArray();
47708      };
47709      if (element.hasPurposeElement()) {
47710        composeMarkdownCore("purpose", element.getPurposeElement(), false);
47711        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
47712      }
47713      if (element.hasCopyrightElement()) {
47714        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
47715        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
47716      }
47717      if (element.hasKeyword()) {
47718        openArray("keyword");
47719        for (Coding e : element.getKeyword()) 
47720          composeCoding(null, e);
47721        closeArray();
47722      };
47723      if (element.hasFhirVersionElement()) {
47724        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
47725        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
47726      }
47727      if (element.hasMapping()) {
47728        openArray("mapping");
47729        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
47730          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
47731        closeArray();
47732      };
47733      if (element.hasKindElement()) {
47734        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
47735        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
47736      }
47737      if (element.hasAbstractElement()) {
47738        composeBooleanCore("abstract", element.getAbstractElement(), false);
47739        composeBooleanExtras("abstract", element.getAbstractElement(), false);
47740      }
47741      if (element.hasContext()) {
47742        openArray("context");
47743        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
47744          composeStructureDefinitionStructureDefinitionContextComponent(null, e);
47745        closeArray();
47746      };
47747      if (element.hasContextInvariant()) {
47748        openArray("contextInvariant");
47749        for (StringType e : element.getContextInvariant()) 
47750          composeStringCore(null, e, true);
47751        closeArray();
47752        if (anyHasExtras(element.getContextInvariant())) {
47753          openArray("_contextInvariant");
47754          for (StringType e : element.getContextInvariant()) 
47755            composeStringExtras(null, e, true);
47756          closeArray();
47757        }
47758      };
47759      if (element.hasTypeElement()) {
47760        composeUriCore("type", element.getTypeElement(), false);
47761        composeUriExtras("type", element.getTypeElement(), false);
47762      }
47763      if (element.hasBaseDefinitionElement()) {
47764        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
47765        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
47766      }
47767      if (element.hasDerivationElement()) {
47768        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
47769        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
47770      }
47771      if (element.hasSnapshot()) {
47772        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
47773      }
47774      if (element.hasDifferential()) {
47775        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
47776      }
47777  }
47778
47779  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
47780    if (element != null) {
47781      open(name);
47782      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
47783      close();
47784    }
47785  }
47786
47787  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
47788      composeBackbone(element);
47789      if (element.hasIdentityElement()) {
47790        composeIdCore("identity", element.getIdentityElement(), false);
47791        composeIdExtras("identity", element.getIdentityElement(), false);
47792      }
47793      if (element.hasUriElement()) {
47794        composeUriCore("uri", element.getUriElement(), false);
47795        composeUriExtras("uri", element.getUriElement(), false);
47796      }
47797      if (element.hasNameElement()) {
47798        composeStringCore("name", element.getNameElement(), false);
47799        composeStringExtras("name", element.getNameElement(), false);
47800      }
47801      if (element.hasCommentElement()) {
47802        composeStringCore("comment", element.getCommentElement(), false);
47803        composeStringExtras("comment", element.getCommentElement(), false);
47804      }
47805  }
47806
47807  protected void composeStructureDefinitionStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
47808    if (element != null) {
47809      open(name);
47810      composeStructureDefinitionStructureDefinitionContextComponentInner(element);
47811      close();
47812    }
47813  }
47814
47815  protected void composeStructureDefinitionStructureDefinitionContextComponentInner(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
47816      composeBackbone(element);
47817      if (element.hasTypeElement()) {
47818        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
47819        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
47820      }
47821      if (element.hasExpressionElement()) {
47822        composeStringCore("expression", element.getExpressionElement(), false);
47823        composeStringExtras("expression", element.getExpressionElement(), false);
47824      }
47825  }
47826
47827  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
47828    if (element != null) {
47829      open(name);
47830      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
47831      close();
47832    }
47833  }
47834
47835  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
47836      composeBackbone(element);
47837      if (element.hasElement()) {
47838        openArray("element");
47839        for (ElementDefinition e : element.getElement()) 
47840          composeElementDefinition(null, e);
47841        closeArray();
47842      };
47843  }
47844
47845  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
47846    if (element != null) {
47847      open(name);
47848      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
47849      close();
47850    }
47851  }
47852
47853  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
47854      composeBackbone(element);
47855      if (element.hasElement()) {
47856        openArray("element");
47857        for (ElementDefinition e : element.getElement()) 
47858          composeElementDefinition(null, e);
47859        closeArray();
47860      };
47861  }
47862
47863  protected void composeStructureMap(String name, StructureMap element) throws IOException {
47864    if (element != null) {
47865      prop("resourceType", name);
47866      composeStructureMapInner(element);
47867    }
47868  }
47869
47870  protected void composeStructureMapInner(StructureMap element) throws IOException {
47871      composeDomainResourceElements(element);
47872      if (element.hasUrlElement()) {
47873        composeUriCore("url", element.getUrlElement(), false);
47874        composeUriExtras("url", element.getUrlElement(), false);
47875      }
47876      if (element.hasIdentifier()) {
47877        openArray("identifier");
47878        for (Identifier e : element.getIdentifier()) 
47879          composeIdentifier(null, e);
47880        closeArray();
47881      };
47882      if (element.hasVersionElement()) {
47883        composeStringCore("version", element.getVersionElement(), false);
47884        composeStringExtras("version", element.getVersionElement(), false);
47885      }
47886      if (element.hasNameElement()) {
47887        composeStringCore("name", element.getNameElement(), false);
47888        composeStringExtras("name", element.getNameElement(), false);
47889      }
47890      if (element.hasTitleElement()) {
47891        composeStringCore("title", element.getTitleElement(), false);
47892        composeStringExtras("title", element.getTitleElement(), false);
47893      }
47894      if (element.hasStatusElement()) {
47895        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47896        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47897      }
47898      if (element.hasExperimentalElement()) {
47899        composeBooleanCore("experimental", element.getExperimentalElement(), false);
47900        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
47901      }
47902      if (element.hasDateElement()) {
47903        composeDateTimeCore("date", element.getDateElement(), false);
47904        composeDateTimeExtras("date", element.getDateElement(), false);
47905      }
47906      if (element.hasPublisherElement()) {
47907        composeStringCore("publisher", element.getPublisherElement(), false);
47908        composeStringExtras("publisher", element.getPublisherElement(), false);
47909      }
47910      if (element.hasContact()) {
47911        openArray("contact");
47912        for (ContactDetail e : element.getContact()) 
47913          composeContactDetail(null, e);
47914        closeArray();
47915      };
47916      if (element.hasDescriptionElement()) {
47917        composeMarkdownCore("description", element.getDescriptionElement(), false);
47918        composeMarkdownExtras("description", element.getDescriptionElement(), false);
47919      }
47920      if (element.hasUseContext()) {
47921        openArray("useContext");
47922        for (UsageContext e : element.getUseContext()) 
47923          composeUsageContext(null, e);
47924        closeArray();
47925      };
47926      if (element.hasJurisdiction()) {
47927        openArray("jurisdiction");
47928        for (CodeableConcept e : element.getJurisdiction()) 
47929          composeCodeableConcept(null, e);
47930        closeArray();
47931      };
47932      if (element.hasPurposeElement()) {
47933        composeMarkdownCore("purpose", element.getPurposeElement(), false);
47934        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
47935      }
47936      if (element.hasCopyrightElement()) {
47937        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
47938        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
47939      }
47940      if (element.hasStructure()) {
47941        openArray("structure");
47942        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
47943          composeStructureMapStructureMapStructureComponent(null, e);
47944        closeArray();
47945      };
47946      if (element.hasImport()) {
47947        openArray("import");
47948        for (CanonicalType e : element.getImport()) 
47949          composeCanonicalCore(null, e, true);
47950        closeArray();
47951        if (anyHasExtras(element.getImport())) {
47952          openArray("_import");
47953          for (CanonicalType e : element.getImport()) 
47954            composeCanonicalExtras(null, e, true);
47955          closeArray();
47956        }
47957      };
47958      if (element.hasGroup()) {
47959        openArray("group");
47960        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
47961          composeStructureMapStructureMapGroupComponent(null, e);
47962        closeArray();
47963      };
47964  }
47965
47966  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
47967    if (element != null) {
47968      open(name);
47969      composeStructureMapStructureMapStructureComponentInner(element);
47970      close();
47971    }
47972  }
47973
47974  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
47975      composeBackbone(element);
47976      if (element.hasUrlElement()) {
47977        composeCanonicalCore("url", element.getUrlElement(), false);
47978        composeCanonicalExtras("url", element.getUrlElement(), false);
47979      }
47980      if (element.hasModeElement()) {
47981        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
47982        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
47983      }
47984      if (element.hasAliasElement()) {
47985        composeStringCore("alias", element.getAliasElement(), false);
47986        composeStringExtras("alias", element.getAliasElement(), false);
47987      }
47988      if (element.hasDocumentationElement()) {
47989        composeStringCore("documentation", element.getDocumentationElement(), false);
47990        composeStringExtras("documentation", element.getDocumentationElement(), false);
47991      }
47992  }
47993
47994  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
47995    if (element != null) {
47996      open(name);
47997      composeStructureMapStructureMapGroupComponentInner(element);
47998      close();
47999    }
48000  }
48001
48002  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
48003      composeBackbone(element);
48004      if (element.hasNameElement()) {
48005        composeIdCore("name", element.getNameElement(), false);
48006        composeIdExtras("name", element.getNameElement(), false);
48007      }
48008      if (element.hasExtendsElement()) {
48009        composeIdCore("extends", element.getExtendsElement(), false);
48010        composeIdExtras("extends", element.getExtendsElement(), false);
48011      }
48012      if (element.hasTypeModeElement()) {
48013        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
48014        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
48015      }
48016      if (element.hasDocumentationElement()) {
48017        composeStringCore("documentation", element.getDocumentationElement(), false);
48018        composeStringExtras("documentation", element.getDocumentationElement(), false);
48019      }
48020      if (element.hasInput()) {
48021        openArray("input");
48022        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
48023          composeStructureMapStructureMapGroupInputComponent(null, e);
48024        closeArray();
48025      };
48026      if (element.hasRule()) {
48027        openArray("rule");
48028        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
48029          composeStructureMapStructureMapGroupRuleComponent(null, e);
48030        closeArray();
48031      };
48032  }
48033
48034  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
48035    if (element != null) {
48036      open(name);
48037      composeStructureMapStructureMapGroupInputComponentInner(element);
48038      close();
48039    }
48040  }
48041
48042  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
48043      composeBackbone(element);
48044      if (element.hasNameElement()) {
48045        composeIdCore("name", element.getNameElement(), false);
48046        composeIdExtras("name", element.getNameElement(), false);
48047      }
48048      if (element.hasTypeElement()) {
48049        composeStringCore("type", element.getTypeElement(), false);
48050        composeStringExtras("type", element.getTypeElement(), false);
48051      }
48052      if (element.hasModeElement()) {
48053        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
48054        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
48055      }
48056      if (element.hasDocumentationElement()) {
48057        composeStringCore("documentation", element.getDocumentationElement(), false);
48058        composeStringExtras("documentation", element.getDocumentationElement(), false);
48059      }
48060  }
48061
48062  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
48063    if (element != null) {
48064      open(name);
48065      composeStructureMapStructureMapGroupRuleComponentInner(element);
48066      close();
48067    }
48068  }
48069
48070  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
48071      composeBackbone(element);
48072      if (element.hasNameElement()) {
48073        composeIdCore("name", element.getNameElement(), false);
48074        composeIdExtras("name", element.getNameElement(), false);
48075      }
48076      if (element.hasSource()) {
48077        openArray("source");
48078        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
48079          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
48080        closeArray();
48081      };
48082      if (element.hasTarget()) {
48083        openArray("target");
48084        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
48085          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
48086        closeArray();
48087      };
48088      if (element.hasRule()) {
48089        openArray("rule");
48090        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
48091          composeStructureMapStructureMapGroupRuleComponent(null, e);
48092        closeArray();
48093      };
48094      if (element.hasDependent()) {
48095        openArray("dependent");
48096        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
48097          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
48098        closeArray();
48099      };
48100      if (element.hasDocumentationElement()) {
48101        composeStringCore("documentation", element.getDocumentationElement(), false);
48102        composeStringExtras("documentation", element.getDocumentationElement(), false);
48103      }
48104  }
48105
48106  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
48107    if (element != null) {
48108      open(name);
48109      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
48110      close();
48111    }
48112  }
48113
48114  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
48115      composeBackbone(element);
48116      if (element.hasContextElement()) {
48117        composeIdCore("context", element.getContextElement(), false);
48118        composeIdExtras("context", element.getContextElement(), false);
48119      }
48120      if (element.hasMinElement()) {
48121        composeIntegerCore("min", element.getMinElement(), false);
48122        composeIntegerExtras("min", element.getMinElement(), false);
48123      }
48124      if (element.hasMaxElement()) {
48125        composeStringCore("max", element.getMaxElement(), false);
48126        composeStringExtras("max", element.getMaxElement(), false);
48127      }
48128      if (element.hasTypeElement()) {
48129        composeStringCore("type", element.getTypeElement(), false);
48130        composeStringExtras("type", element.getTypeElement(), false);
48131      }
48132      if (element.hasDefaultValue()) {
48133        composeType("defaultValue", element.getDefaultValue());
48134      }
48135      if (element.hasElementElement()) {
48136        composeStringCore("element", element.getElementElement(), false);
48137        composeStringExtras("element", element.getElementElement(), false);
48138      }
48139      if (element.hasListModeElement()) {
48140        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
48141        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
48142      }
48143      if (element.hasVariableElement()) {
48144        composeIdCore("variable", element.getVariableElement(), false);
48145        composeIdExtras("variable", element.getVariableElement(), false);
48146      }
48147      if (element.hasConditionElement()) {
48148        composeStringCore("condition", element.getConditionElement(), false);
48149        composeStringExtras("condition", element.getConditionElement(), false);
48150      }
48151      if (element.hasCheckElement()) {
48152        composeStringCore("check", element.getCheckElement(), false);
48153        composeStringExtras("check", element.getCheckElement(), false);
48154      }
48155  }
48156
48157  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
48158    if (element != null) {
48159      open(name);
48160      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
48161      close();
48162    }
48163  }
48164
48165  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
48166      composeBackbone(element);
48167      if (element.hasContextElement()) {
48168        composeIdCore("context", element.getContextElement(), false);
48169        composeIdExtras("context", element.getContextElement(), false);
48170      }
48171      if (element.hasContextTypeElement()) {
48172        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
48173        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
48174      }
48175      if (element.hasElementElement()) {
48176        composeStringCore("element", element.getElementElement(), false);
48177        composeStringExtras("element", element.getElementElement(), false);
48178      }
48179      if (element.hasVariableElement()) {
48180        composeIdCore("variable", element.getVariableElement(), false);
48181        composeIdExtras("variable", element.getVariableElement(), false);
48182      }
48183      if (element.hasListMode()) {
48184        openArray("listMode");
48185        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
48186          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
48187        closeArray();
48188        if (anyHasExtras(element.getListMode())) {
48189          openArray("_listMode");
48190          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
48191            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
48192          closeArray();
48193        }
48194      };
48195      if (element.hasListRuleIdElement()) {
48196        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
48197        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
48198      }
48199      if (element.hasTransformElement()) {
48200        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
48201        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
48202      }
48203      if (element.hasParameter()) {
48204        openArray("parameter");
48205        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
48206          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
48207        closeArray();
48208      };
48209  }
48210
48211  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
48212    if (element != null) {
48213      open(name);
48214      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
48215      close();
48216    }
48217  }
48218
48219  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
48220      composeBackbone(element);
48221      if (element.hasValue()) {
48222        composeType("value", element.getValue());
48223      }
48224  }
48225
48226  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
48227    if (element != null) {
48228      open(name);
48229      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
48230      close();
48231    }
48232  }
48233
48234  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
48235      composeBackbone(element);
48236      if (element.hasNameElement()) {
48237        composeIdCore("name", element.getNameElement(), false);
48238        composeIdExtras("name", element.getNameElement(), false);
48239      }
48240      if (element.hasVariable()) {
48241        openArray("variable");
48242        for (StringType e : element.getVariable()) 
48243          composeStringCore(null, e, true);
48244        closeArray();
48245        if (anyHasExtras(element.getVariable())) {
48246          openArray("_variable");
48247          for (StringType e : element.getVariable()) 
48248            composeStringExtras(null, e, true);
48249          closeArray();
48250        }
48251      };
48252  }
48253
48254  protected void composeSubscription(String name, Subscription element) throws IOException {
48255    if (element != null) {
48256      prop("resourceType", name);
48257      composeSubscriptionInner(element);
48258    }
48259  }
48260
48261  protected void composeSubscriptionInner(Subscription element) throws IOException {
48262      composeDomainResourceElements(element);
48263      if (element.hasStatusElement()) {
48264        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
48265        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
48266      }
48267      if (element.hasContact()) {
48268        openArray("contact");
48269        for (ContactPoint e : element.getContact()) 
48270          composeContactPoint(null, e);
48271        closeArray();
48272      };
48273      if (element.hasEndElement()) {
48274        composeInstantCore("end", element.getEndElement(), false);
48275        composeInstantExtras("end", element.getEndElement(), false);
48276      }
48277      if (element.hasReasonElement()) {
48278        composeStringCore("reason", element.getReasonElement(), false);
48279        composeStringExtras("reason", element.getReasonElement(), false);
48280      }
48281      if (element.hasCriteriaElement()) {
48282        composeStringCore("criteria", element.getCriteriaElement(), false);
48283        composeStringExtras("criteria", element.getCriteriaElement(), false);
48284      }
48285      if (element.hasErrorElement()) {
48286        composeStringCore("error", element.getErrorElement(), false);
48287        composeStringExtras("error", element.getErrorElement(), false);
48288      }
48289      if (element.hasChannel()) {
48290        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
48291      }
48292      if (element.hasTag()) {
48293        openArray("tag");
48294        for (Coding e : element.getTag()) 
48295          composeCoding(null, e);
48296        closeArray();
48297      };
48298  }
48299
48300  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
48301    if (element != null) {
48302      open(name);
48303      composeSubscriptionSubscriptionChannelComponentInner(element);
48304      close();
48305    }
48306  }
48307
48308  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
48309      composeBackbone(element);
48310      if (element.hasTypeElement()) {
48311        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
48312        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
48313      }
48314      if (element.hasEndpointElement()) {
48315        composeUrlCore("endpoint", element.getEndpointElement(), false);
48316        composeUrlExtras("endpoint", element.getEndpointElement(), false);
48317      }
48318      if (element.hasPayloadElement()) {
48319        composeStringCore("payload", element.getPayloadElement(), false);
48320        composeStringExtras("payload", element.getPayloadElement(), false);
48321      }
48322      if (element.hasHeader()) {
48323        openArray("header");
48324        for (StringType e : element.getHeader()) 
48325          composeStringCore(null, e, true);
48326        closeArray();
48327        if (anyHasExtras(element.getHeader())) {
48328          openArray("_header");
48329          for (StringType e : element.getHeader()) 
48330            composeStringExtras(null, e, true);
48331          closeArray();
48332        }
48333      };
48334  }
48335
48336  protected void composeSubstance(String name, Substance element) throws IOException {
48337    if (element != null) {
48338      prop("resourceType", name);
48339      composeSubstanceInner(element);
48340    }
48341  }
48342
48343  protected void composeSubstanceInner(Substance element) throws IOException {
48344      composeDomainResourceElements(element);
48345      if (element.hasIdentifier()) {
48346        openArray("identifier");
48347        for (Identifier e : element.getIdentifier()) 
48348          composeIdentifier(null, e);
48349        closeArray();
48350      };
48351      if (element.hasStatusElement()) {
48352        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
48353        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
48354      }
48355      if (element.hasCategory()) {
48356        openArray("category");
48357        for (CodeableConcept e : element.getCategory()) 
48358          composeCodeableConcept(null, e);
48359        closeArray();
48360      };
48361      if (element.hasCode()) {
48362        composeCodeableConcept("code", element.getCode());
48363      }
48364      if (element.hasDescriptionElement()) {
48365        composeStringCore("description", element.getDescriptionElement(), false);
48366        composeStringExtras("description", element.getDescriptionElement(), false);
48367      }
48368      if (element.hasInstance()) {
48369        openArray("instance");
48370        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
48371          composeSubstanceSubstanceInstanceComponent(null, e);
48372        closeArray();
48373      };
48374      if (element.hasIngredient()) {
48375        openArray("ingredient");
48376        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
48377          composeSubstanceSubstanceIngredientComponent(null, e);
48378        closeArray();
48379      };
48380  }
48381
48382  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
48383    if (element != null) {
48384      open(name);
48385      composeSubstanceSubstanceInstanceComponentInner(element);
48386      close();
48387    }
48388  }
48389
48390  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
48391      composeBackbone(element);
48392      if (element.hasIdentifier()) {
48393        composeIdentifier("identifier", element.getIdentifier());
48394      }
48395      if (element.hasExpiryElement()) {
48396        composeDateTimeCore("expiry", element.getExpiryElement(), false);
48397        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
48398      }
48399      if (element.hasQuantity()) {
48400        composeSimpleQuantity("quantity", element.getQuantity());
48401      }
48402  }
48403
48404  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
48405    if (element != null) {
48406      open(name);
48407      composeSubstanceSubstanceIngredientComponentInner(element);
48408      close();
48409    }
48410  }
48411
48412  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
48413      composeBackbone(element);
48414      if (element.hasQuantity()) {
48415        composeRatio("quantity", element.getQuantity());
48416      }
48417      if (element.hasSubstance()) {
48418        composeType("substance", element.getSubstance());
48419      }
48420  }
48421
48422  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
48423    if (element != null) {
48424      prop("resourceType", name);
48425      composeSubstancePolymerInner(element);
48426    }
48427  }
48428
48429  protected void composeSubstancePolymerInner(SubstancePolymer element) throws IOException {
48430      composeDomainResourceElements(element);
48431      if (element.hasClass_()) {
48432        composeCodeableConcept("class", element.getClass_());
48433      }
48434      if (element.hasGeometry()) {
48435        composeCodeableConcept("geometry", element.getGeometry());
48436      }
48437      if (element.hasCopolymerConnectivity()) {
48438        openArray("copolymerConnectivity");
48439        for (CodeableConcept e : element.getCopolymerConnectivity()) 
48440          composeCodeableConcept(null, e);
48441        closeArray();
48442      };
48443      if (element.hasModification()) {
48444        openArray("modification");
48445        for (StringType e : element.getModification()) 
48446          composeStringCore(null, e, true);
48447        closeArray();
48448        if (anyHasExtras(element.getModification())) {
48449          openArray("_modification");
48450          for (StringType e : element.getModification()) 
48451            composeStringExtras(null, e, true);
48452          closeArray();
48453        }
48454      };
48455      if (element.hasMonomerSet()) {
48456        openArray("monomerSet");
48457        for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
48458          composeSubstancePolymerSubstancePolymerMonomerSetComponent(null, e);
48459        closeArray();
48460      };
48461      if (element.hasRepeat()) {
48462        openArray("repeat");
48463        for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
48464          composeSubstancePolymerSubstancePolymerRepeatComponent(null, e);
48465        closeArray();
48466      };
48467  }
48468
48469  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
48470    if (element != null) {
48471      open(name);
48472      composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(element);
48473      close();
48474    }
48475  }
48476
48477  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
48478      composeBackbone(element);
48479      if (element.hasRatioType()) {
48480        composeCodeableConcept("ratioType", element.getRatioType());
48481      }
48482      if (element.hasStartingMaterial()) {
48483        openArray("startingMaterial");
48484        for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
48485          composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
48486        closeArray();
48487      };
48488  }
48489
48490  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
48491    if (element != null) {
48492      open(name);
48493      composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(element);
48494      close();
48495    }
48496  }
48497
48498  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
48499      composeBackbone(element);
48500      if (element.hasMaterial()) {
48501        composeCodeableConcept("material", element.getMaterial());
48502      }
48503      if (element.hasType()) {
48504        composeCodeableConcept("type", element.getType());
48505      }
48506      if (element.hasIsDefiningElement()) {
48507        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
48508        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
48509      }
48510      if (element.hasAmount()) {
48511        composeSubstanceAmount("amount", element.getAmount());
48512      }
48513  }
48514
48515  protected void composeSubstancePolymerSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
48516    if (element != null) {
48517      open(name);
48518      composeSubstancePolymerSubstancePolymerRepeatComponentInner(element);
48519      close();
48520    }
48521  }
48522
48523  protected void composeSubstancePolymerSubstancePolymerRepeatComponentInner(SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
48524      composeBackbone(element);
48525      if (element.hasNumberOfUnitsElement()) {
48526        composeIntegerCore("numberOfUnits", element.getNumberOfUnitsElement(), false);
48527        composeIntegerExtras("numberOfUnits", element.getNumberOfUnitsElement(), false);
48528      }
48529      if (element.hasAverageMolecularFormulaElement()) {
48530        composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
48531        composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
48532      }
48533      if (element.hasRepeatUnitAmountType()) {
48534        composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
48535      }
48536      if (element.hasRepeatUnit()) {
48537        openArray("repeatUnit");
48538        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit()) 
48539          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(null, e);
48540        closeArray();
48541      };
48542  }
48543
48544  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
48545    if (element != null) {
48546      open(name);
48547      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(element);
48548      close();
48549    }
48550  }
48551
48552  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
48553      composeBackbone(element);
48554      if (element.hasOrientationOfPolymerisation()) {
48555        composeCodeableConcept("orientationOfPolymerisation", element.getOrientationOfPolymerisation());
48556      }
48557      if (element.hasRepeatUnitElement()) {
48558        composeStringCore("repeatUnit", element.getRepeatUnitElement(), false);
48559        composeStringExtras("repeatUnit", element.getRepeatUnitElement(), false);
48560      }
48561      if (element.hasAmount()) {
48562        composeSubstanceAmount("amount", element.getAmount());
48563      }
48564      if (element.hasDegreeOfPolymerisation()) {
48565        openArray("degreeOfPolymerisation");
48566        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
48567          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
48568        closeArray();
48569      };
48570      if (element.hasStructuralRepresentation()) {
48571        openArray("structuralRepresentation");
48572        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
48573          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
48574        closeArray();
48575      };
48576  }
48577
48578  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
48579    if (element != null) {
48580      open(name);
48581      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(element);
48582      close();
48583    }
48584  }
48585
48586  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
48587      composeBackbone(element);
48588      if (element.hasDegree()) {
48589        composeCodeableConcept("degree", element.getDegree());
48590      }
48591      if (element.hasAmount()) {
48592        composeSubstanceAmount("amount", element.getAmount());
48593      }
48594  }
48595
48596  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
48597    if (element != null) {
48598      open(name);
48599      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(element);
48600      close();
48601    }
48602  }
48603
48604  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
48605      composeBackbone(element);
48606      if (element.hasType()) {
48607        composeCodeableConcept("type", element.getType());
48608      }
48609      if (element.hasRepresentationElement()) {
48610        composeStringCore("representation", element.getRepresentationElement(), false);
48611        composeStringExtras("representation", element.getRepresentationElement(), false);
48612      }
48613      if (element.hasAttachment()) {
48614        composeAttachment("attachment", element.getAttachment());
48615      }
48616  }
48617
48618  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element) throws IOException {
48619    if (element != null) {
48620      prop("resourceType", name);
48621      composeSubstanceReferenceInformationInner(element);
48622    }
48623  }
48624
48625  protected void composeSubstanceReferenceInformationInner(SubstanceReferenceInformation element) throws IOException {
48626      composeDomainResourceElements(element);
48627      if (element.hasCommentElement()) {
48628        composeStringCore("comment", element.getCommentElement(), false);
48629        composeStringExtras("comment", element.getCommentElement(), false);
48630      }
48631      if (element.hasGene()) {
48632        openArray("gene");
48633        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene()) 
48634          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(null, e);
48635        closeArray();
48636      };
48637      if (element.hasGeneElement()) {
48638        openArray("geneElement");
48639        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
48640          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(null, e);
48641        closeArray();
48642      };
48643      if (element.hasClassification()) {
48644        openArray("classification");
48645        for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element.getClassification()) 
48646          composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(null, e);
48647        closeArray();
48648      };
48649      if (element.hasRelationship()) {
48650        openArray("relationship");
48651        for (SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent e : element.getRelationship()) 
48652          composeSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponent(null, e);
48653        closeArray();
48654      };
48655      if (element.hasTarget()) {
48656        openArray("target");
48657        for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
48658          composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(null, e);
48659        closeArray();
48660      };
48661  }
48662
48663  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
48664    if (element != null) {
48665      open(name);
48666      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(element);
48667      close();
48668    }
48669  }
48670
48671  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
48672      composeBackbone(element);
48673      if (element.hasGeneSequenceOrigin()) {
48674        composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
48675      }
48676      if (element.hasGene()) {
48677        composeCodeableConcept("gene", element.getGene());
48678      }
48679      if (element.hasSource()) {
48680        openArray("source");
48681        for (Reference e : element.getSource()) 
48682          composeReference(null, e);
48683        closeArray();
48684      };
48685  }
48686
48687  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
48688    if (element != null) {
48689      open(name);
48690      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(element);
48691      close();
48692    }
48693  }
48694
48695  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
48696      composeBackbone(element);
48697      if (element.hasType()) {
48698        composeCodeableConcept("type", element.getType());
48699      }
48700      if (element.hasElement()) {
48701        composeIdentifier("element", element.getElement());
48702      }
48703      if (element.hasSource()) {
48704        openArray("source");
48705        for (Reference e : element.getSource()) 
48706          composeReference(null, e);
48707        closeArray();
48708      };
48709  }
48710
48711  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
48712    if (element != null) {
48713      open(name);
48714      composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(element);
48715      close();
48716    }
48717  }
48718
48719  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
48720      composeBackbone(element);
48721      if (element.hasDomain()) {
48722        composeCodeableConcept("domain", element.getDomain());
48723      }
48724      if (element.hasClassification()) {
48725        composeCodeableConcept("classification", element.getClassification());
48726      }
48727      if (element.hasSubtype()) {
48728        openArray("subtype");
48729        for (CodeableConcept e : element.getSubtype()) 
48730          composeCodeableConcept(null, e);
48731        closeArray();
48732      };
48733      if (element.hasSource()) {
48734        openArray("source");
48735        for (Reference e : element.getSource()) 
48736          composeReference(null, e);
48737        closeArray();
48738      };
48739  }
48740
48741  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent element) throws IOException {
48742    if (element != null) {
48743      open(name);
48744      composeSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponentInner(element);
48745      close();
48746    }
48747  }
48748
48749  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent element) throws IOException {
48750      composeBackbone(element);
48751      if (element.hasSubstance()) {
48752        composeType("substance", element.getSubstance());
48753      }
48754      if (element.hasRelationship()) {
48755        composeCodeableConcept("relationship", element.getRelationship());
48756      }
48757      if (element.hasInteraction()) {
48758        composeCodeableConcept("interaction", element.getInteraction());
48759      }
48760      if (element.hasIsDefiningElement()) {
48761        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
48762        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
48763      }
48764      if (element.hasAmount()) {
48765        composeType("amount", element.getAmount());
48766      }
48767      if (element.hasAmountType()) {
48768        composeCodeableConcept("amountType", element.getAmountType());
48769      }
48770      if (element.hasAmountTextElement()) {
48771        composeStringCore("amountText", element.getAmountTextElement(), false);
48772        composeStringExtras("amountText", element.getAmountTextElement(), false);
48773      }
48774      if (element.hasSource()) {
48775        openArray("source");
48776        for (Reference e : element.getSource()) 
48777          composeReference(null, e);
48778        closeArray();
48779      };
48780  }
48781
48782  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
48783    if (element != null) {
48784      open(name);
48785      composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(element);
48786      close();
48787    }
48788  }
48789
48790  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
48791      composeBackbone(element);
48792      if (element.hasTarget()) {
48793        composeIdentifier("target", element.getTarget());
48794      }
48795      if (element.hasType()) {
48796        composeCodeableConcept("type", element.getType());
48797      }
48798      if (element.hasInteraction()) {
48799        composeCodeableConcept("interaction", element.getInteraction());
48800      }
48801      if (element.hasOrganism()) {
48802        composeCodeableConcept("organism", element.getOrganism());
48803      }
48804      if (element.hasOrganismType()) {
48805        composeCodeableConcept("organismType", element.getOrganismType());
48806      }
48807      if (element.hasSource()) {
48808        openArray("source");
48809        for (Reference e : element.getSource()) 
48810          composeReference(null, e);
48811        closeArray();
48812      };
48813      if (element.hasAmount()) {
48814        composeType("amount", element.getAmount());
48815      }
48816      if (element.hasAmountType()) {
48817        composeCodeableConcept("amountType", element.getAmountType());
48818      }
48819  }
48820
48821  protected void composeSubstanceSpecification(String name, SubstanceSpecification element) throws IOException {
48822    if (element != null) {
48823      prop("resourceType", name);
48824      composeSubstanceSpecificationInner(element);
48825    }
48826  }
48827
48828  protected void composeSubstanceSpecificationInner(SubstanceSpecification element) throws IOException {
48829      composeDomainResourceElements(element);
48830      if (element.hasCommentElement()) {
48831        composeStringCore("comment", element.getCommentElement(), false);
48832        composeStringExtras("comment", element.getCommentElement(), false);
48833      }
48834      if (element.hasStoichiometricElement()) {
48835        composeBooleanCore("stoichiometric", element.getStoichiometricElement(), false);
48836        composeBooleanExtras("stoichiometric", element.getStoichiometricElement(), false);
48837      }
48838      if (element.hasIdentifier()) {
48839        composeIdentifier("identifier", element.getIdentifier());
48840      }
48841      if (element.hasType()) {
48842        composeCodeableConcept("type", element.getType());
48843      }
48844      if (element.hasReferenceSource()) {
48845        openArray("referenceSource");
48846        for (StringType e : element.getReferenceSource()) 
48847          composeStringCore(null, e, true);
48848        closeArray();
48849        if (anyHasExtras(element.getReferenceSource())) {
48850          openArray("_referenceSource");
48851          for (StringType e : element.getReferenceSource()) 
48852            composeStringExtras(null, e, true);
48853          closeArray();
48854        }
48855      };
48856      if (element.hasMoiety()) {
48857        openArray("moiety");
48858        for (SubstanceSpecification.SubstanceSpecificationMoietyComponent e : element.getMoiety()) 
48859          composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(null, e);
48860        closeArray();
48861      };
48862      if (element.hasProperty()) {
48863        openArray("property");
48864        for (SubstanceSpecification.SubstanceSpecificationPropertyComponent e : element.getProperty()) 
48865          composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(null, e);
48866        closeArray();
48867      };
48868      if (element.hasReferenceInformation()) {
48869        composeReference("referenceInformation", element.getReferenceInformation());
48870      }
48871      if (element.hasStructure()) {
48872        composeSubstanceSpecificationSubstanceSpecificationStructureComponent("structure", element.getStructure());
48873      }
48874      if (element.hasSubstanceCode()) {
48875        openArray("substanceCode");
48876        for (SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent e : element.getSubstanceCode()) 
48877          composeSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponent(null, e);
48878        closeArray();
48879      };
48880      if (element.hasSubstanceName()) {
48881        openArray("substanceName");
48882        for (SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent e : element.getSubstanceName()) 
48883          composeSubstanceSpecificationSubstanceSpecificationSubstanceNameComponent(null, e);
48884        closeArray();
48885      };
48886      if (element.hasMolecularWeight()) {
48887        openArray("molecularWeight");
48888        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent e : element.getMolecularWeight()) 
48889          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(null, e);
48890        closeArray();
48891      };
48892      if (element.hasPolymer()) {
48893        composeReference("polymer", element.getPolymer());
48894      }
48895  }
48896
48897  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(String name, SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
48898    if (element != null) {
48899      open(name);
48900      composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(element);
48901      close();
48902    }
48903  }
48904
48905  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
48906      composeBackbone(element);
48907      if (element.hasRole()) {
48908        composeCodeableConcept("role", element.getRole());
48909      }
48910      if (element.hasIdentifier()) {
48911        composeIdentifier("identifier", element.getIdentifier());
48912      }
48913      if (element.hasNameElement()) {
48914        composeStringCore("name", element.getNameElement(), false);
48915        composeStringExtras("name", element.getNameElement(), false);
48916      }
48917      if (element.hasStereochemistry()) {
48918        composeCodeableConcept("stereochemistry", element.getStereochemistry());
48919      }
48920      if (element.hasOpticalActivity()) {
48921        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
48922      }
48923      if (element.hasMolecularFormulaElement()) {
48924        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
48925        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
48926      }
48927      if (element.hasAmountElement()) {
48928        composeStringCore("amount", element.getAmountElement(), false);
48929        composeStringExtras("amount", element.getAmountElement(), false);
48930      }
48931  }
48932
48933  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(String name, SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
48934    if (element != null) {
48935      open(name);
48936      composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(element);
48937      close();
48938    }
48939  }
48940
48941  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
48942      composeBackbone(element);
48943      if (element.hasType()) {
48944        composeCodeableConcept("type", element.getType());
48945      }
48946      if (element.hasName()) {
48947        composeCodeableConcept("name", element.getName());
48948      }
48949      if (element.hasParametersElement()) {
48950        composeStringCore("parameters", element.getParametersElement(), false);
48951        composeStringExtras("parameters", element.getParametersElement(), false);
48952      }
48953      if (element.hasSubstanceId()) {
48954        composeIdentifier("substanceId", element.getSubstanceId());
48955      }
48956      if (element.hasSubstanceNameElement()) {
48957        composeStringCore("substanceName", element.getSubstanceNameElement(), false);
48958        composeStringExtras("substanceName", element.getSubstanceNameElement(), false);
48959      }
48960      if (element.hasAmountElement()) {
48961        composeStringCore("amount", element.getAmountElement(), false);
48962        composeStringExtras("amount", element.getAmountElement(), false);
48963      }
48964  }
48965
48966  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
48967    if (element != null) {
48968      open(name);
48969      composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(element);
48970      close();
48971    }
48972  }
48973
48974  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
48975      composeBackbone(element);
48976      if (element.hasStereochemistry()) {
48977        composeCodeableConcept("stereochemistry", element.getStereochemistry());
48978      }
48979      if (element.hasOpticalActivity()) {
48980        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
48981      }
48982      if (element.hasMolecularFormulaElement()) {
48983        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
48984        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
48985      }
48986      if (element.hasMolecularFormulaByMoietyElement()) {
48987        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
48988        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
48989      }
48990      if (element.hasIsotope()) {
48991        openArray("isotope");
48992        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent e : element.getIsotope()) 
48993          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(null, e);
48994        closeArray();
48995      };
48996      if (element.hasMolecularWeight()) {
48997        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
48998      }
48999      if (element.hasReferenceSource()) {
49000        openArray("referenceSource");
49001        for (Reference e : element.getReferenceSource()) 
49002          composeReference(null, e);
49003        closeArray();
49004      };
49005      if (element.hasStructuralRepresentation()) {
49006        openArray("structuralRepresentation");
49007        for (SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
49008          composeSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponent(null, e);
49009        closeArray();
49010      };
49011  }
49012
49013  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
49014    if (element != null) {
49015      open(name);
49016      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(element);
49017      close();
49018    }
49019  }
49020
49021  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
49022      composeBackbone(element);
49023      if (element.hasNuclideId()) {
49024        composeIdentifier("nuclideId", element.getNuclideId());
49025      }
49026      if (element.hasNuclideName()) {
49027        composeCodeableConcept("nuclideName", element.getNuclideName());
49028      }
49029      if (element.hasSubstitutionType()) {
49030        composeCodeableConcept("substitutionType", element.getSubstitutionType());
49031      }
49032      if (element.hasNuclideHalfLife()) {
49033        composeQuantity("nuclideHalfLife", element.getNuclideHalfLife());
49034      }
49035      if (element.hasAmountElement()) {
49036        composeStringCore("amount", element.getAmountElement(), false);
49037        composeStringExtras("amount", element.getAmountElement(), false);
49038      }
49039      if (element.hasMolecularWeight()) {
49040        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
49041      }
49042  }
49043
49044  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
49045    if (element != null) {
49046      open(name);
49047      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(element);
49048      close();
49049    }
49050  }
49051
49052  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
49053      composeBackbone(element);
49054      if (element.hasMethod()) {
49055        composeCodeableConcept("method", element.getMethod());
49056      }
49057      if (element.hasType()) {
49058        composeCodeableConcept("type", element.getType());
49059      }
49060      if (element.hasAmountElement()) {
49061        composeStringCore("amount", element.getAmountElement(), false);
49062        composeStringExtras("amount", element.getAmountElement(), false);
49063      }
49064  }
49065
49066  protected void composeSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent element) throws IOException {
49067    if (element != null) {
49068      open(name);
49069      composeSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponentInner(element);
49070      close();
49071    }
49072  }
49073
49074  protected void composeSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponentInner(SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent element) throws IOException {
49075      composeBackbone(element);
49076      if (element.hasType()) {
49077        composeCodeableConcept("type", element.getType());
49078      }
49079      if (element.hasRepresentationElement()) {
49080        composeStringCore("representation", element.getRepresentationElement(), false);
49081        composeStringExtras("representation", element.getRepresentationElement(), false);
49082      }
49083      if (element.hasAttachment()) {
49084        composeAttachment("attachment", element.getAttachment());
49085      }
49086  }
49087
49088  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponent(String name, SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent element) throws IOException {
49089    if (element != null) {
49090      open(name);
49091      composeSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponentInner(element);
49092      close();
49093    }
49094  }
49095
49096  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponentInner(SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent element) throws IOException {
49097      composeBackbone(element);
49098      if (element.hasCode()) {
49099        composeCodeableConcept("code", element.getCode());
49100      }
49101      if (element.hasStatus()) {
49102        composeCodeableConcept("status", element.getStatus());
49103      }
49104      if (element.hasStatusDateElement()) {
49105        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
49106        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
49107      }
49108      if (element.hasCommentElement()) {
49109        composeStringCore("comment", element.getCommentElement(), false);
49110        composeStringExtras("comment", element.getCommentElement(), false);
49111      }
49112      if (element.hasReferenceSource()) {
49113        openArray("referenceSource");
49114        for (StringType e : element.getReferenceSource()) 
49115          composeStringCore(null, e, true);
49116        closeArray();
49117        if (anyHasExtras(element.getReferenceSource())) {
49118          openArray("_referenceSource");
49119          for (StringType e : element.getReferenceSource()) 
49120            composeStringExtras(null, e, true);
49121          closeArray();
49122        }
49123      };
49124  }
49125
49126  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceNameComponent(String name, SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent element) throws IOException {
49127    if (element != null) {
49128      open(name);
49129      composeSubstanceSpecificationSubstanceSpecificationSubstanceNameComponentInner(element);
49130      close();
49131    }
49132  }
49133
49134  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceNameComponentInner(SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent element) throws IOException {
49135      composeBackbone(element);
49136      if (element.hasNameElement()) {
49137        composeStringCore("name", element.getNameElement(), false);
49138        composeStringExtras("name", element.getNameElement(), false);
49139      }
49140      if (element.hasType()) {
49141        composeCodeableConcept("type", element.getType());
49142      }
49143      if (element.hasLanguage()) {
49144        openArray("language");
49145        for (CodeableConcept e : element.getLanguage()) 
49146          composeCodeableConcept(null, e);
49147        closeArray();
49148      };
49149      if (element.hasDomain()) {
49150        openArray("domain");
49151        for (CodeableConcept e : element.getDomain()) 
49152          composeCodeableConcept(null, e);
49153        closeArray();
49154      };
49155      if (element.hasJurisdiction()) {
49156        openArray("jurisdiction");
49157        for (CodeableConcept e : element.getJurisdiction()) 
49158          composeCodeableConcept(null, e);
49159        closeArray();
49160      };
49161      if (element.hasOfficialName()) {
49162        openArray("officialName");
49163        for (SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent e : element.getOfficialName()) 
49164          composeSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponent(null, e);
49165        closeArray();
49166      };
49167      if (element.hasReferenceSource()) {
49168        openArray("referenceSource");
49169        for (StringType e : element.getReferenceSource()) 
49170          composeStringCore(null, e, true);
49171        closeArray();
49172        if (anyHasExtras(element.getReferenceSource())) {
49173          openArray("_referenceSource");
49174          for (StringType e : element.getReferenceSource()) 
49175            composeStringExtras(null, e, true);
49176          closeArray();
49177        }
49178      };
49179  }
49180
49181  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponent(String name, SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent element) throws IOException {
49182    if (element != null) {
49183      open(name);
49184      composeSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponentInner(element);
49185      close();
49186    }
49187  }
49188
49189  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponentInner(SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent element) throws IOException {
49190      composeBackbone(element);
49191      if (element.hasAuthority()) {
49192        composeCodeableConcept("authority", element.getAuthority());
49193      }
49194      if (element.hasStatus()) {
49195        composeCodeableConcept("status", element.getStatus());
49196      }
49197      if (element.hasDateElement()) {
49198        composeDateTimeCore("date", element.getDateElement(), false);
49199        composeDateTimeExtras("date", element.getDateElement(), false);
49200      }
49201  }
49202
49203  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
49204    if (element != null) {
49205      prop("resourceType", name);
49206      composeSupplyDeliveryInner(element);
49207    }
49208  }
49209
49210  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
49211      composeDomainResourceElements(element);
49212      if (element.hasIdentifier()) {
49213        openArray("identifier");
49214        for (Identifier e : element.getIdentifier()) 
49215          composeIdentifier(null, e);
49216        closeArray();
49217      };
49218      if (element.hasBasedOn()) {
49219        openArray("basedOn");
49220        for (Reference e : element.getBasedOn()) 
49221          composeReference(null, e);
49222        closeArray();
49223      };
49224      if (element.hasPartOf()) {
49225        openArray("partOf");
49226        for (Reference e : element.getPartOf()) 
49227          composeReference(null, e);
49228        closeArray();
49229      };
49230      if (element.hasStatusElement()) {
49231        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
49232        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
49233      }
49234      if (element.hasPatient()) {
49235        composeReference("patient", element.getPatient());
49236      }
49237      if (element.hasType()) {
49238        composeCodeableConcept("type", element.getType());
49239      }
49240      if (element.hasSuppliedItem()) {
49241        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
49242      }
49243      if (element.hasOccurrence()) {
49244        composeType("occurrence", element.getOccurrence());
49245      }
49246      if (element.hasSupplier()) {
49247        composeReference("supplier", element.getSupplier());
49248      }
49249      if (element.hasDestination()) {
49250        composeReference("destination", element.getDestination());
49251      }
49252      if (element.hasReceiver()) {
49253        openArray("receiver");
49254        for (Reference e : element.getReceiver()) 
49255          composeReference(null, e);
49256        closeArray();
49257      };
49258  }
49259
49260  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
49261    if (element != null) {
49262      open(name);
49263      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
49264      close();
49265    }
49266  }
49267
49268  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
49269      composeBackbone(element);
49270      if (element.hasQuantity()) {
49271        composeSimpleQuantity("quantity", element.getQuantity());
49272      }
49273      if (element.hasItem()) {
49274        composeType("item", element.getItem());
49275      }
49276  }
49277
49278  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
49279    if (element != null) {
49280      prop("resourceType", name);
49281      composeSupplyRequestInner(element);
49282    }
49283  }
49284
49285  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
49286      composeDomainResourceElements(element);
49287      if (element.hasIdentifier()) {
49288        composeIdentifier("identifier", element.getIdentifier());
49289      }
49290      if (element.hasStatusElement()) {
49291        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
49292        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
49293      }
49294      if (element.hasCategory()) {
49295        composeCodeableConcept("category", element.getCategory());
49296      }
49297      if (element.hasPriorityElement()) {
49298        composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
49299        composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
49300      }
49301      if (element.hasItem()) {
49302        composeType("item", element.getItem());
49303      }
49304      if (element.hasQuantity()) {
49305        composeQuantity("quantity", element.getQuantity());
49306      }
49307      if (element.hasParameter()) {
49308        openArray("parameter");
49309        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
49310          composeSupplyRequestSupplyRequestParameterComponent(null, e);
49311        closeArray();
49312      };
49313      if (element.hasOccurrence()) {
49314        composeType("occurrence", element.getOccurrence());
49315      }
49316      if (element.hasAuthoredOnElement()) {
49317        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
49318        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
49319      }
49320      if (element.hasRequester()) {
49321        composeReference("requester", element.getRequester());
49322      }
49323      if (element.hasSupplier()) {
49324        openArray("supplier");
49325        for (Reference e : element.getSupplier()) 
49326          composeReference(null, e);
49327        closeArray();
49328      };
49329      if (element.hasReasonCode()) {
49330        openArray("reasonCode");
49331        for (CodeableConcept e : element.getReasonCode()) 
49332          composeCodeableConcept(null, e);
49333        closeArray();
49334      };
49335      if (element.hasReasonReference()) {
49336        openArray("reasonReference");
49337        for (Reference e : element.getReasonReference()) 
49338          composeReference(null, e);
49339        closeArray();
49340      };
49341      if (element.hasDeliverFrom()) {
49342        composeReference("deliverFrom", element.getDeliverFrom());
49343      }
49344      if (element.hasDeliverTo()) {
49345        composeReference("deliverTo", element.getDeliverTo());
49346      }
49347  }
49348
49349  protected void composeSupplyRequestSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
49350    if (element != null) {
49351      open(name);
49352      composeSupplyRequestSupplyRequestParameterComponentInner(element);
49353      close();
49354    }
49355  }
49356
49357  protected void composeSupplyRequestSupplyRequestParameterComponentInner(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
49358      composeBackbone(element);
49359      if (element.hasCode()) {
49360        composeCodeableConcept("code", element.getCode());
49361      }
49362      if (element.hasValue()) {
49363        composeType("value", element.getValue());
49364      }
49365  }
49366
49367  protected void composeTask(String name, Task element) throws IOException {
49368    if (element != null) {
49369      prop("resourceType", name);
49370      composeTaskInner(element);
49371    }
49372  }
49373
49374  protected void composeTaskInner(Task element) throws IOException {
49375      composeDomainResourceElements(element);
49376      if (element.hasIdentifier()) {
49377        openArray("identifier");
49378        for (Identifier e : element.getIdentifier()) 
49379          composeIdentifier(null, e);
49380        closeArray();
49381      };
49382      if (element.hasInstantiates()) {
49383        composeType("instantiates", element.getInstantiates());
49384      }
49385      if (element.hasBasedOn()) {
49386        openArray("basedOn");
49387        for (Reference e : element.getBasedOn()) 
49388          composeReference(null, e);
49389        closeArray();
49390      };
49391      if (element.hasGroupIdentifier()) {
49392        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
49393      }
49394      if (element.hasPartOf()) {
49395        openArray("partOf");
49396        for (Reference e : element.getPartOf()) 
49397          composeReference(null, e);
49398        closeArray();
49399      };
49400      if (element.hasStatusElement()) {
49401        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
49402        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
49403      }
49404      if (element.hasStatusReason()) {
49405        composeCodeableConcept("statusReason", element.getStatusReason());
49406      }
49407      if (element.hasBusinessStatus()) {
49408        composeCodeableConcept("businessStatus", element.getBusinessStatus());
49409      }
49410      if (element.hasIntentElement()) {
49411        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
49412        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
49413      }
49414      if (element.hasPriorityElement()) {
49415        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
49416        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
49417      }
49418      if (element.hasCode()) {
49419        composeCodeableConcept("code", element.getCode());
49420      }
49421      if (element.hasDescriptionElement()) {
49422        composeStringCore("description", element.getDescriptionElement(), false);
49423        composeStringExtras("description", element.getDescriptionElement(), false);
49424      }
49425      if (element.hasFocus()) {
49426        composeReference("focus", element.getFocus());
49427      }
49428      if (element.hasFor()) {
49429        composeReference("for", element.getFor());
49430      }
49431      if (element.hasContext()) {
49432        composeReference("context", element.getContext());
49433      }
49434      if (element.hasExecutionPeriod()) {
49435        composePeriod("executionPeriod", element.getExecutionPeriod());
49436      }
49437      if (element.hasAuthoredOnElement()) {
49438        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
49439        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
49440      }
49441      if (element.hasLastModifiedElement()) {
49442        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
49443        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
49444      }
49445      if (element.hasRequester()) {
49446        composeReference("requester", element.getRequester());
49447      }
49448      if (element.hasPerformerType()) {
49449        openArray("performerType");
49450        for (CodeableConcept e : element.getPerformerType()) 
49451          composeCodeableConcept(null, e);
49452        closeArray();
49453      };
49454      if (element.hasOwner()) {
49455        composeReference("owner", element.getOwner());
49456      }
49457      if (element.hasReasonCode()) {
49458        composeCodeableConcept("reasonCode", element.getReasonCode());
49459      }
49460      if (element.hasReasonReference()) {
49461        composeReference("reasonReference", element.getReasonReference());
49462      }
49463      if (element.hasNote()) {
49464        openArray("note");
49465        for (Annotation e : element.getNote()) 
49466          composeAnnotation(null, e);
49467        closeArray();
49468      };
49469      if (element.hasRelevantHistory()) {
49470        openArray("relevantHistory");
49471        for (Reference e : element.getRelevantHistory()) 
49472          composeReference(null, e);
49473        closeArray();
49474      };
49475      if (element.hasRestriction()) {
49476        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
49477      }
49478      if (element.hasInput()) {
49479        openArray("input");
49480        for (Task.ParameterComponent e : element.getInput()) 
49481          composeTaskParameterComponent(null, e);
49482        closeArray();
49483      };
49484      if (element.hasOutput()) {
49485        openArray("output");
49486        for (Task.TaskOutputComponent e : element.getOutput()) 
49487          composeTaskTaskOutputComponent(null, e);
49488        closeArray();
49489      };
49490  }
49491
49492  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
49493    if (element != null) {
49494      open(name);
49495      composeTaskTaskRestrictionComponentInner(element);
49496      close();
49497    }
49498  }
49499
49500  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
49501      composeBackbone(element);
49502      if (element.hasRepetitionsElement()) {
49503        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
49504        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
49505      }
49506      if (element.hasPeriod()) {
49507        composePeriod("period", element.getPeriod());
49508      }
49509      if (element.hasRecipient()) {
49510        openArray("recipient");
49511        for (Reference e : element.getRecipient()) 
49512          composeReference(null, e);
49513        closeArray();
49514      };
49515  }
49516
49517  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
49518    if (element != null) {
49519      open(name);
49520      composeTaskParameterComponentInner(element);
49521      close();
49522    }
49523  }
49524
49525  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
49526      composeBackbone(element);
49527      if (element.hasType()) {
49528        composeCodeableConcept("type", element.getType());
49529      }
49530      if (element.hasValue()) {
49531        composeType("value", element.getValue());
49532      }
49533  }
49534
49535  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
49536    if (element != null) {
49537      open(name);
49538      composeTaskTaskOutputComponentInner(element);
49539      close();
49540    }
49541  }
49542
49543  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
49544      composeBackbone(element);
49545      if (element.hasType()) {
49546        composeCodeableConcept("type", element.getType());
49547      }
49548      if (element.hasValue()) {
49549        composeType("value", element.getValue());
49550      }
49551  }
49552
49553  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
49554    if (element != null) {
49555      prop("resourceType", name);
49556      composeTerminologyCapabilitiesInner(element);
49557    }
49558  }
49559
49560  protected void composeTerminologyCapabilitiesInner(TerminologyCapabilities element) throws IOException {
49561      composeDomainResourceElements(element);
49562      if (element.hasUrlElement()) {
49563        composeUriCore("url", element.getUrlElement(), false);
49564        composeUriExtras("url", element.getUrlElement(), false);
49565      }
49566      if (element.hasVersionElement()) {
49567        composeStringCore("version", element.getVersionElement(), false);
49568        composeStringExtras("version", element.getVersionElement(), false);
49569      }
49570      if (element.hasNameElement()) {
49571        composeStringCore("name", element.getNameElement(), false);
49572        composeStringExtras("name", element.getNameElement(), false);
49573      }
49574      if (element.hasTitleElement()) {
49575        composeStringCore("title", element.getTitleElement(), false);
49576        composeStringExtras("title", element.getTitleElement(), false);
49577      }
49578      if (element.hasStatusElement()) {
49579        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49580        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49581      }
49582      if (element.hasExperimentalElement()) {
49583        composeBooleanCore("experimental", element.getExperimentalElement(), false);
49584        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
49585      }
49586      if (element.hasDateElement()) {
49587        composeDateTimeCore("date", element.getDateElement(), false);
49588        composeDateTimeExtras("date", element.getDateElement(), false);
49589      }
49590      if (element.hasPublisherElement()) {
49591        composeStringCore("publisher", element.getPublisherElement(), false);
49592        composeStringExtras("publisher", element.getPublisherElement(), false);
49593      }
49594      if (element.hasContact()) {
49595        openArray("contact");
49596        for (ContactDetail e : element.getContact()) 
49597          composeContactDetail(null, e);
49598        closeArray();
49599      };
49600      if (element.hasDescriptionElement()) {
49601        composeMarkdownCore("description", element.getDescriptionElement(), false);
49602        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49603      }
49604      if (element.hasUseContext()) {
49605        openArray("useContext");
49606        for (UsageContext e : element.getUseContext()) 
49607          composeUsageContext(null, e);
49608        closeArray();
49609      };
49610      if (element.hasJurisdiction()) {
49611        openArray("jurisdiction");
49612        for (CodeableConcept e : element.getJurisdiction()) 
49613          composeCodeableConcept(null, e);
49614        closeArray();
49615      };
49616      if (element.hasPurposeElement()) {
49617        composeMarkdownCore("purpose", element.getPurposeElement(), false);
49618        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
49619      }
49620      if (element.hasCopyrightElement()) {
49621        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
49622        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
49623      }
49624      if (element.hasLockedDateElement()) {
49625        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
49626        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
49627      }
49628      if (element.hasCodeSystem()) {
49629        openArray("codeSystem");
49630        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
49631          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(null, e);
49632        closeArray();
49633      };
49634      if (element.hasExpansion()) {
49635        composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
49636      }
49637      if (element.hasCodeSearchElement()) {
49638        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
49639        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
49640      }
49641      if (element.hasValidateCode()) {
49642        composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
49643      }
49644      if (element.hasTranslation()) {
49645        composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
49646      }
49647      if (element.hasClosure()) {
49648        composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
49649      }
49650  }
49651
49652  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
49653    if (element != null) {
49654      open(name);
49655      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(element);
49656      close();
49657    }
49658  }
49659
49660  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
49661      composeBackbone(element);
49662      if (element.hasUriElement()) {
49663        composeCanonicalCore("uri", element.getUriElement(), false);
49664        composeCanonicalExtras("uri", element.getUriElement(), false);
49665      }
49666      if (element.hasVersion()) {
49667        openArray("version");
49668        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
49669          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
49670        closeArray();
49671      };
49672  }
49673
49674  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
49675    if (element != null) {
49676      open(name);
49677      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(element);
49678      close();
49679    }
49680  }
49681
49682  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
49683      composeBackbone(element);
49684      if (element.hasCodeElement()) {
49685        composeStringCore("code", element.getCodeElement(), false);
49686        composeStringExtras("code", element.getCodeElement(), false);
49687      }
49688      if (element.hasIsDefaultElement()) {
49689        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
49690        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
49691      }
49692      if (element.hasCompositionalElement()) {
49693        composeBooleanCore("compositional", element.getCompositionalElement(), false);
49694        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
49695      }
49696      if (element.hasLanguage()) {
49697        openArray("language");
49698        for (CodeType e : element.getLanguage()) 
49699          composeCodeCore(null, e, true);
49700        closeArray();
49701        if (anyHasExtras(element.getLanguage())) {
49702          openArray("_language");
49703          for (CodeType e : element.getLanguage()) 
49704            composeCodeExtras(null, e, true);
49705          closeArray();
49706        }
49707      };
49708      if (element.hasFilter()) {
49709        openArray("filter");
49710        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
49711          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
49712        closeArray();
49713      };
49714      if (element.hasProperty()) {
49715        openArray("property");
49716        for (CodeType e : element.getProperty()) 
49717          composeCodeCore(null, e, true);
49718        closeArray();
49719        if (anyHasExtras(element.getProperty())) {
49720          openArray("_property");
49721          for (CodeType e : element.getProperty()) 
49722            composeCodeExtras(null, e, true);
49723          closeArray();
49724        }
49725      };
49726  }
49727
49728  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
49729    if (element != null) {
49730      open(name);
49731      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(element);
49732      close();
49733    }
49734  }
49735
49736  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
49737      composeBackbone(element);
49738      if (element.hasCodeElement()) {
49739        composeCodeCore("code", element.getCodeElement(), false);
49740        composeCodeExtras("code", element.getCodeElement(), false);
49741      }
49742      if (element.hasOp()) {
49743        openArray("op");
49744        for (CodeType e : element.getOp()) 
49745          composeCodeCore(null, e, true);
49746        closeArray();
49747        if (anyHasExtras(element.getOp())) {
49748          openArray("_op");
49749          for (CodeType e : element.getOp()) 
49750            composeCodeExtras(null, e, true);
49751          closeArray();
49752        }
49753      };
49754  }
49755
49756  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
49757    if (element != null) {
49758      open(name);
49759      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(element);
49760      close();
49761    }
49762  }
49763
49764  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
49765      composeBackbone(element);
49766      if (element.hasHierarchicalElement()) {
49767        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
49768        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
49769      }
49770      if (element.hasPagingElement()) {
49771        composeBooleanCore("paging", element.getPagingElement(), false);
49772        composeBooleanExtras("paging", element.getPagingElement(), false);
49773      }
49774      if (element.hasIncompleteElement()) {
49775        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
49776        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
49777      }
49778      if (element.hasDefinitionElement()) {
49779        composeCanonicalCore("definition", element.getDefinitionElement(), false);
49780        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
49781      }
49782      if (element.hasProfile()) {
49783        openArray("profile");
49784        for (CanonicalType e : element.getProfile()) 
49785          composeCanonicalCore(null, e, true);
49786        closeArray();
49787        if (anyHasExtras(element.getProfile())) {
49788          openArray("_profile");
49789          for (CanonicalType e : element.getProfile()) 
49790            composeCanonicalExtras(null, e, true);
49791          closeArray();
49792        }
49793      };
49794      if (element.hasTextFilterElement()) {
49795        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
49796        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
49797      }
49798  }
49799
49800  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
49801    if (element != null) {
49802      open(name);
49803      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(element);
49804      close();
49805    }
49806  }
49807
49808  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
49809      composeBackbone(element);
49810      if (element.hasTranslationsElement()) {
49811        composeBooleanCore("translations", element.getTranslationsElement(), false);
49812        composeBooleanExtras("translations", element.getTranslationsElement(), false);
49813      }
49814  }
49815
49816  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
49817    if (element != null) {
49818      open(name);
49819      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(element);
49820      close();
49821    }
49822  }
49823
49824  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
49825      composeBackbone(element);
49826      if (element.hasNeedsMapElement()) {
49827        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
49828        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
49829      }
49830  }
49831
49832  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
49833    if (element != null) {
49834      open(name);
49835      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(element);
49836      close();
49837    }
49838  }
49839
49840  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
49841      composeBackbone(element);
49842      if (element.hasTranslationElement()) {
49843        composeBooleanCore("translation", element.getTranslationElement(), false);
49844        composeBooleanExtras("translation", element.getTranslationElement(), false);
49845      }
49846  }
49847
49848  protected void composeTestReport(String name, TestReport element) throws IOException {
49849    if (element != null) {
49850      prop("resourceType", name);
49851      composeTestReportInner(element);
49852    }
49853  }
49854
49855  protected void composeTestReportInner(TestReport element) throws IOException {
49856      composeDomainResourceElements(element);
49857      if (element.hasIdentifier()) {
49858        composeIdentifier("identifier", element.getIdentifier());
49859      }
49860      if (element.hasNameElement()) {
49861        composeStringCore("name", element.getNameElement(), false);
49862        composeStringExtras("name", element.getNameElement(), false);
49863      }
49864      if (element.hasStatusElement()) {
49865        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
49866        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
49867      }
49868      if (element.hasTestScript()) {
49869        composeReference("testScript", element.getTestScript());
49870      }
49871      if (element.hasResultElement()) {
49872        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
49873        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
49874      }
49875      if (element.hasScoreElement()) {
49876        composeDecimalCore("score", element.getScoreElement(), false);
49877        composeDecimalExtras("score", element.getScoreElement(), false);
49878      }
49879      if (element.hasTesterElement()) {
49880        composeStringCore("tester", element.getTesterElement(), false);
49881        composeStringExtras("tester", element.getTesterElement(), false);
49882      }
49883      if (element.hasIssuedElement()) {
49884        composeDateTimeCore("issued", element.getIssuedElement(), false);
49885        composeDateTimeExtras("issued", element.getIssuedElement(), false);
49886      }
49887      if (element.hasParticipant()) {
49888        openArray("participant");
49889        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
49890          composeTestReportTestReportParticipantComponent(null, e);
49891        closeArray();
49892      };
49893      if (element.hasSetup()) {
49894        composeTestReportTestReportSetupComponent("setup", element.getSetup());
49895      }
49896      if (element.hasTest()) {
49897        openArray("test");
49898        for (TestReport.TestReportTestComponent e : element.getTest()) 
49899          composeTestReportTestReportTestComponent(null, e);
49900        closeArray();
49901      };
49902      if (element.hasTeardown()) {
49903        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
49904      }
49905  }
49906
49907  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
49908    if (element != null) {
49909      open(name);
49910      composeTestReportTestReportParticipantComponentInner(element);
49911      close();
49912    }
49913  }
49914
49915  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element) throws IOException {
49916      composeBackbone(element);
49917      if (element.hasTypeElement()) {
49918        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
49919        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
49920      }
49921      if (element.hasUriElement()) {
49922        composeUriCore("uri", element.getUriElement(), false);
49923        composeUriExtras("uri", element.getUriElement(), false);
49924      }
49925      if (element.hasDisplayElement()) {
49926        composeStringCore("display", element.getDisplayElement(), false);
49927        composeStringExtras("display", element.getDisplayElement(), false);
49928      }
49929  }
49930
49931  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
49932    if (element != null) {
49933      open(name);
49934      composeTestReportTestReportSetupComponentInner(element);
49935      close();
49936    }
49937  }
49938
49939  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element) throws IOException {
49940      composeBackbone(element);
49941      if (element.hasAction()) {
49942        openArray("action");
49943        for (TestReport.SetupActionComponent e : element.getAction()) 
49944          composeTestReportSetupActionComponent(null, e);
49945        closeArray();
49946      };
49947  }
49948
49949  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
49950    if (element != null) {
49951      open(name);
49952      composeTestReportSetupActionComponentInner(element);
49953      close();
49954    }
49955  }
49956
49957  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element) throws IOException {
49958      composeBackbone(element);
49959      if (element.hasOperation()) {
49960        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
49961      }
49962      if (element.hasAssert()) {
49963        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
49964      }
49965  }
49966
49967  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
49968    if (element != null) {
49969      open(name);
49970      composeTestReportSetupActionOperationComponentInner(element);
49971      close();
49972    }
49973  }
49974
49975  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element) throws IOException {
49976      composeBackbone(element);
49977      if (element.hasResultElement()) {
49978        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
49979        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
49980      }
49981      if (element.hasMessageElement()) {
49982        composeMarkdownCore("message", element.getMessageElement(), false);
49983        composeMarkdownExtras("message", element.getMessageElement(), false);
49984      }
49985      if (element.hasDetailElement()) {
49986        composeUriCore("detail", element.getDetailElement(), false);
49987        composeUriExtras("detail", element.getDetailElement(), false);
49988      }
49989  }
49990
49991  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
49992    if (element != null) {
49993      open(name);
49994      composeTestReportSetupActionAssertComponentInner(element);
49995      close();
49996    }
49997  }
49998
49999  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element) throws IOException {
50000      composeBackbone(element);
50001      if (element.hasResultElement()) {
50002        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
50003        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
50004      }
50005      if (element.hasMessageElement()) {
50006        composeMarkdownCore("message", element.getMessageElement(), false);
50007        composeMarkdownExtras("message", element.getMessageElement(), false);
50008      }
50009      if (element.hasDetailElement()) {
50010        composeStringCore("detail", element.getDetailElement(), false);
50011        composeStringExtras("detail", element.getDetailElement(), false);
50012      }
50013  }
50014
50015  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
50016    if (element != null) {
50017      open(name);
50018      composeTestReportTestReportTestComponentInner(element);
50019      close();
50020    }
50021  }
50022
50023  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element) throws IOException {
50024      composeBackbone(element);
50025      if (element.hasNameElement()) {
50026        composeStringCore("name", element.getNameElement(), false);
50027        composeStringExtras("name", element.getNameElement(), false);
50028      }
50029      if (element.hasDescriptionElement()) {
50030        composeStringCore("description", element.getDescriptionElement(), false);
50031        composeStringExtras("description", element.getDescriptionElement(), false);
50032      }
50033      if (element.hasAction()) {
50034        openArray("action");
50035        for (TestReport.TestActionComponent e : element.getAction()) 
50036          composeTestReportTestActionComponent(null, e);
50037        closeArray();
50038      };
50039  }
50040
50041  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
50042    if (element != null) {
50043      open(name);
50044      composeTestReportTestActionComponentInner(element);
50045      close();
50046    }
50047  }
50048
50049  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
50050      composeBackbone(element);
50051      if (element.hasOperation()) {
50052        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
50053      }
50054      if (element.hasAssert()) {
50055        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
50056      }
50057  }
50058
50059  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
50060    if (element != null) {
50061      open(name);
50062      composeTestReportTestReportTeardownComponentInner(element);
50063      close();
50064    }
50065  }
50066
50067  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element) throws IOException {
50068      composeBackbone(element);
50069      if (element.hasAction()) {
50070        openArray("action");
50071        for (TestReport.TeardownActionComponent e : element.getAction()) 
50072          composeTestReportTeardownActionComponent(null, e);
50073        closeArray();
50074      };
50075  }
50076
50077  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
50078    if (element != null) {
50079      open(name);
50080      composeTestReportTeardownActionComponentInner(element);
50081      close();
50082    }
50083  }
50084
50085  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element) throws IOException {
50086      composeBackbone(element);
50087      if (element.hasOperation()) {
50088        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
50089      }
50090  }
50091
50092  protected void composeTestScript(String name, TestScript element) throws IOException {
50093    if (element != null) {
50094      prop("resourceType", name);
50095      composeTestScriptInner(element);
50096    }
50097  }
50098
50099  protected void composeTestScriptInner(TestScript element) throws IOException {
50100      composeDomainResourceElements(element);
50101      if (element.hasUrlElement()) {
50102        composeUriCore("url", element.getUrlElement(), false);
50103        composeUriExtras("url", element.getUrlElement(), false);
50104      }
50105      if (element.hasIdentifier()) {
50106        composeIdentifier("identifier", element.getIdentifier());
50107      }
50108      if (element.hasVersionElement()) {
50109        composeStringCore("version", element.getVersionElement(), false);
50110        composeStringExtras("version", element.getVersionElement(), false);
50111      }
50112      if (element.hasNameElement()) {
50113        composeStringCore("name", element.getNameElement(), false);
50114        composeStringExtras("name", element.getNameElement(), false);
50115      }
50116      if (element.hasTitleElement()) {
50117        composeStringCore("title", element.getTitleElement(), false);
50118        composeStringExtras("title", element.getTitleElement(), false);
50119      }
50120      if (element.hasStatusElement()) {
50121        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50122        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50123      }
50124      if (element.hasExperimentalElement()) {
50125        composeBooleanCore("experimental", element.getExperimentalElement(), false);
50126        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50127      }
50128      if (element.hasDateElement()) {
50129        composeDateTimeCore("date", element.getDateElement(), false);
50130        composeDateTimeExtras("date", element.getDateElement(), false);
50131      }
50132      if (element.hasPublisherElement()) {
50133        composeStringCore("publisher", element.getPublisherElement(), false);
50134        composeStringExtras("publisher", element.getPublisherElement(), false);
50135      }
50136      if (element.hasContact()) {
50137        openArray("contact");
50138        for (ContactDetail e : element.getContact()) 
50139          composeContactDetail(null, e);
50140        closeArray();
50141      };
50142      if (element.hasDescriptionElement()) {
50143        composeMarkdownCore("description", element.getDescriptionElement(), false);
50144        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50145      }
50146      if (element.hasUseContext()) {
50147        openArray("useContext");
50148        for (UsageContext e : element.getUseContext()) 
50149          composeUsageContext(null, e);
50150        closeArray();
50151      };
50152      if (element.hasJurisdiction()) {
50153        openArray("jurisdiction");
50154        for (CodeableConcept e : element.getJurisdiction()) 
50155          composeCodeableConcept(null, e);
50156        closeArray();
50157      };
50158      if (element.hasPurposeElement()) {
50159        composeMarkdownCore("purpose", element.getPurposeElement(), false);
50160        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50161      }
50162      if (element.hasCopyrightElement()) {
50163        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
50164        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
50165      }
50166      if (element.hasOrigin()) {
50167        openArray("origin");
50168        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
50169          composeTestScriptTestScriptOriginComponent(null, e);
50170        closeArray();
50171      };
50172      if (element.hasDestination()) {
50173        openArray("destination");
50174        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
50175          composeTestScriptTestScriptDestinationComponent(null, e);
50176        closeArray();
50177      };
50178      if (element.hasMetadata()) {
50179        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
50180      }
50181      if (element.hasFixture()) {
50182        openArray("fixture");
50183        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
50184          composeTestScriptTestScriptFixtureComponent(null, e);
50185        closeArray();
50186      };
50187      if (element.hasProfile()) {
50188        openArray("profile");
50189        for (Reference e : element.getProfile()) 
50190          composeReference(null, e);
50191        closeArray();
50192      };
50193      if (element.hasVariable()) {
50194        openArray("variable");
50195        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
50196          composeTestScriptTestScriptVariableComponent(null, e);
50197        closeArray();
50198      };
50199      if (element.hasRule()) {
50200        openArray("rule");
50201        for (TestScript.TestScriptRuleComponent e : element.getRule()) 
50202          composeTestScriptTestScriptRuleComponent(null, e);
50203        closeArray();
50204      };
50205      if (element.hasRuleset()) {
50206        openArray("ruleset");
50207        for (TestScript.TestScriptRulesetComponent e : element.getRuleset()) 
50208          composeTestScriptTestScriptRulesetComponent(null, e);
50209        closeArray();
50210      };
50211      if (element.hasSetup()) {
50212        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
50213      }
50214      if (element.hasTest()) {
50215        openArray("test");
50216        for (TestScript.TestScriptTestComponent e : element.getTest()) 
50217          composeTestScriptTestScriptTestComponent(null, e);
50218        closeArray();
50219      };
50220      if (element.hasTeardown()) {
50221        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
50222      }
50223  }
50224
50225  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
50226    if (element != null) {
50227      open(name);
50228      composeTestScriptTestScriptOriginComponentInner(element);
50229      close();
50230    }
50231  }
50232
50233  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
50234      composeBackbone(element);
50235      if (element.hasIndexElement()) {
50236        composeIntegerCore("index", element.getIndexElement(), false);
50237        composeIntegerExtras("index", element.getIndexElement(), false);
50238      }
50239      if (element.hasProfile()) {
50240        composeCoding("profile", element.getProfile());
50241      }
50242  }
50243
50244  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
50245    if (element != null) {
50246      open(name);
50247      composeTestScriptTestScriptDestinationComponentInner(element);
50248      close();
50249    }
50250  }
50251
50252  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
50253      composeBackbone(element);
50254      if (element.hasIndexElement()) {
50255        composeIntegerCore("index", element.getIndexElement(), false);
50256        composeIntegerExtras("index", element.getIndexElement(), false);
50257      }
50258      if (element.hasProfile()) {
50259        composeCoding("profile", element.getProfile());
50260      }
50261  }
50262
50263  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
50264    if (element != null) {
50265      open(name);
50266      composeTestScriptTestScriptMetadataComponentInner(element);
50267      close();
50268    }
50269  }
50270
50271  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
50272      composeBackbone(element);
50273      if (element.hasLink()) {
50274        openArray("link");
50275        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
50276          composeTestScriptTestScriptMetadataLinkComponent(null, e);
50277        closeArray();
50278      };
50279      if (element.hasCapability()) {
50280        openArray("capability");
50281        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
50282          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
50283        closeArray();
50284      };
50285  }
50286
50287  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
50288    if (element != null) {
50289      open(name);
50290      composeTestScriptTestScriptMetadataLinkComponentInner(element);
50291      close();
50292    }
50293  }
50294
50295  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
50296      composeBackbone(element);
50297      if (element.hasUrlElement()) {
50298        composeUriCore("url", element.getUrlElement(), false);
50299        composeUriExtras("url", element.getUrlElement(), false);
50300      }
50301      if (element.hasDescriptionElement()) {
50302        composeStringCore("description", element.getDescriptionElement(), false);
50303        composeStringExtras("description", element.getDescriptionElement(), false);
50304      }
50305  }
50306
50307  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
50308    if (element != null) {
50309      open(name);
50310      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
50311      close();
50312    }
50313  }
50314
50315  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
50316      composeBackbone(element);
50317      if (element.hasRequiredElement()) {
50318        composeBooleanCore("required", element.getRequiredElement(), false);
50319        composeBooleanExtras("required", element.getRequiredElement(), false);
50320      }
50321      if (element.hasValidatedElement()) {
50322        composeBooleanCore("validated", element.getValidatedElement(), false);
50323        composeBooleanExtras("validated", element.getValidatedElement(), false);
50324      }
50325      if (element.hasDescriptionElement()) {
50326        composeStringCore("description", element.getDescriptionElement(), false);
50327        composeStringExtras("description", element.getDescriptionElement(), false);
50328      }
50329      if (element.hasOrigin()) {
50330        openArray("origin");
50331        for (IntegerType e : element.getOrigin()) 
50332          composeIntegerCore(null, e, true);
50333        closeArray();
50334        if (anyHasExtras(element.getOrigin())) {
50335          openArray("_origin");
50336          for (IntegerType e : element.getOrigin()) 
50337            composeIntegerExtras(null, e, true);
50338          closeArray();
50339        }
50340      };
50341      if (element.hasDestinationElement()) {
50342        composeIntegerCore("destination", element.getDestinationElement(), false);
50343        composeIntegerExtras("destination", element.getDestinationElement(), false);
50344      }
50345      if (element.hasLink()) {
50346        openArray("link");
50347        for (UriType e : element.getLink()) 
50348          composeUriCore(null, e, true);
50349        closeArray();
50350        if (anyHasExtras(element.getLink())) {
50351          openArray("_link");
50352          for (UriType e : element.getLink()) 
50353            composeUriExtras(null, e, true);
50354          closeArray();
50355        }
50356      };
50357      if (element.hasCapabilitiesElement()) {
50358        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
50359        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
50360      }
50361  }
50362
50363  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
50364    if (element != null) {
50365      open(name);
50366      composeTestScriptTestScriptFixtureComponentInner(element);
50367      close();
50368    }
50369  }
50370
50371  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
50372      composeBackbone(element);
50373      if (element.hasAutocreateElement()) {
50374        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
50375        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
50376      }
50377      if (element.hasAutodeleteElement()) {
50378        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
50379        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
50380      }
50381      if (element.hasResource()) {
50382        composeReference("resource", element.getResource());
50383      }
50384  }
50385
50386  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
50387    if (element != null) {
50388      open(name);
50389      composeTestScriptTestScriptVariableComponentInner(element);
50390      close();
50391    }
50392  }
50393
50394  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
50395      composeBackbone(element);
50396      if (element.hasNameElement()) {
50397        composeStringCore("name", element.getNameElement(), false);
50398        composeStringExtras("name", element.getNameElement(), false);
50399      }
50400      if (element.hasDefaultValueElement()) {
50401        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
50402        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
50403      }
50404      if (element.hasDescriptionElement()) {
50405        composeStringCore("description", element.getDescriptionElement(), false);
50406        composeStringExtras("description", element.getDescriptionElement(), false);
50407      }
50408      if (element.hasExpressionElement()) {
50409        composeStringCore("expression", element.getExpressionElement(), false);
50410        composeStringExtras("expression", element.getExpressionElement(), false);
50411      }
50412      if (element.hasHeaderFieldElement()) {
50413        composeStringCore("headerField", element.getHeaderFieldElement(), false);
50414        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
50415      }
50416      if (element.hasHintElement()) {
50417        composeStringCore("hint", element.getHintElement(), false);
50418        composeStringExtras("hint", element.getHintElement(), false);
50419      }
50420      if (element.hasPathElement()) {
50421        composeStringCore("path", element.getPathElement(), false);
50422        composeStringExtras("path", element.getPathElement(), false);
50423      }
50424      if (element.hasSourceIdElement()) {
50425        composeIdCore("sourceId", element.getSourceIdElement(), false);
50426        composeIdExtras("sourceId", element.getSourceIdElement(), false);
50427      }
50428  }
50429
50430  protected void composeTestScriptTestScriptRuleComponent(String name, TestScript.TestScriptRuleComponent element) throws IOException {
50431    if (element != null) {
50432      open(name);
50433      composeTestScriptTestScriptRuleComponentInner(element);
50434      close();
50435    }
50436  }
50437
50438  protected void composeTestScriptTestScriptRuleComponentInner(TestScript.TestScriptRuleComponent element) throws IOException {
50439      composeBackbone(element);
50440      if (element.hasResource()) {
50441        composeReference("resource", element.getResource());
50442      }
50443      if (element.hasParam()) {
50444        openArray("param");
50445        for (TestScript.RuleParamComponent e : element.getParam()) 
50446          composeTestScriptRuleParamComponent(null, e);
50447        closeArray();
50448      };
50449  }
50450
50451  protected void composeTestScriptRuleParamComponent(String name, TestScript.RuleParamComponent element) throws IOException {
50452    if (element != null) {
50453      open(name);
50454      composeTestScriptRuleParamComponentInner(element);
50455      close();
50456    }
50457  }
50458
50459  protected void composeTestScriptRuleParamComponentInner(TestScript.RuleParamComponent element) throws IOException {
50460      composeBackbone(element);
50461      if (element.hasNameElement()) {
50462        composeStringCore("name", element.getNameElement(), false);
50463        composeStringExtras("name", element.getNameElement(), false);
50464      }
50465      if (element.hasValueElement()) {
50466        composeStringCore("value", element.getValueElement(), false);
50467        composeStringExtras("value", element.getValueElement(), false);
50468      }
50469  }
50470
50471  protected void composeTestScriptTestScriptRulesetComponent(String name, TestScript.TestScriptRulesetComponent element) throws IOException {
50472    if (element != null) {
50473      open(name);
50474      composeTestScriptTestScriptRulesetComponentInner(element);
50475      close();
50476    }
50477  }
50478
50479  protected void composeTestScriptTestScriptRulesetComponentInner(TestScript.TestScriptRulesetComponent element) throws IOException {
50480      composeBackbone(element);
50481      if (element.hasResource()) {
50482        composeReference("resource", element.getResource());
50483      }
50484      if (element.hasRule()) {
50485        openArray("rule");
50486        for (TestScript.RulesetRuleComponent e : element.getRule()) 
50487          composeTestScriptRulesetRuleComponent(null, e);
50488        closeArray();
50489      };
50490  }
50491
50492  protected void composeTestScriptRulesetRuleComponent(String name, TestScript.RulesetRuleComponent element) throws IOException {
50493    if (element != null) {
50494      open(name);
50495      composeTestScriptRulesetRuleComponentInner(element);
50496      close();
50497    }
50498  }
50499
50500  protected void composeTestScriptRulesetRuleComponentInner(TestScript.RulesetRuleComponent element) throws IOException {
50501      composeBackbone(element);
50502      if (element.hasRuleIdElement()) {
50503        composeIdCore("ruleId", element.getRuleIdElement(), false);
50504        composeIdExtras("ruleId", element.getRuleIdElement(), false);
50505      }
50506      if (element.hasParam()) {
50507        openArray("param");
50508        for (TestScript.RulesetRuleParamComponent e : element.getParam()) 
50509          composeTestScriptRulesetRuleParamComponent(null, e);
50510        closeArray();
50511      };
50512  }
50513
50514  protected void composeTestScriptRulesetRuleParamComponent(String name, TestScript.RulesetRuleParamComponent element) throws IOException {
50515    if (element != null) {
50516      open(name);
50517      composeTestScriptRulesetRuleParamComponentInner(element);
50518      close();
50519    }
50520  }
50521
50522  protected void composeTestScriptRulesetRuleParamComponentInner(TestScript.RulesetRuleParamComponent element) throws IOException {
50523      composeBackbone(element);
50524      if (element.hasNameElement()) {
50525        composeStringCore("name", element.getNameElement(), false);
50526        composeStringExtras("name", element.getNameElement(), false);
50527      }
50528      if (element.hasValueElement()) {
50529        composeStringCore("value", element.getValueElement(), false);
50530        composeStringExtras("value", element.getValueElement(), false);
50531      }
50532  }
50533
50534  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
50535    if (element != null) {
50536      open(name);
50537      composeTestScriptTestScriptSetupComponentInner(element);
50538      close();
50539    }
50540  }
50541
50542  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
50543      composeBackbone(element);
50544      if (element.hasAction()) {
50545        openArray("action");
50546        for (TestScript.SetupActionComponent e : element.getAction()) 
50547          composeTestScriptSetupActionComponent(null, e);
50548        closeArray();
50549      };
50550  }
50551
50552  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
50553    if (element != null) {
50554      open(name);
50555      composeTestScriptSetupActionComponentInner(element);
50556      close();
50557    }
50558  }
50559
50560  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
50561      composeBackbone(element);
50562      if (element.hasOperation()) {
50563        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
50564      }
50565      if (element.hasAssert()) {
50566        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
50567      }
50568  }
50569
50570  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
50571    if (element != null) {
50572      open(name);
50573      composeTestScriptSetupActionOperationComponentInner(element);
50574      close();
50575    }
50576  }
50577
50578  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
50579      composeBackbone(element);
50580      if (element.hasType()) {
50581        composeCoding("type", element.getType());
50582      }
50583      if (element.hasResourceElement()) {
50584        composeCodeCore("resource", element.getResourceElement(), false);
50585        composeCodeExtras("resource", element.getResourceElement(), false);
50586      }
50587      if (element.hasLabelElement()) {
50588        composeStringCore("label", element.getLabelElement(), false);
50589        composeStringExtras("label", element.getLabelElement(), false);
50590      }
50591      if (element.hasDescriptionElement()) {
50592        composeStringCore("description", element.getDescriptionElement(), false);
50593        composeStringExtras("description", element.getDescriptionElement(), false);
50594      }
50595      if (element.hasAcceptElement()) {
50596        composeCodeCore("accept", element.getAcceptElement(), false);
50597        composeCodeExtras("accept", element.getAcceptElement(), false);
50598      }
50599      if (element.hasContentTypeElement()) {
50600        composeCodeCore("contentType", element.getContentTypeElement(), false);
50601        composeCodeExtras("contentType", element.getContentTypeElement(), false);
50602      }
50603      if (element.hasDestinationElement()) {
50604        composeIntegerCore("destination", element.getDestinationElement(), false);
50605        composeIntegerExtras("destination", element.getDestinationElement(), false);
50606      }
50607      if (element.hasEncodeRequestUrlElement()) {
50608        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
50609        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
50610      }
50611      if (element.hasOriginElement()) {
50612        composeIntegerCore("origin", element.getOriginElement(), false);
50613        composeIntegerExtras("origin", element.getOriginElement(), false);
50614      }
50615      if (element.hasParamsElement()) {
50616        composeStringCore("params", element.getParamsElement(), false);
50617        composeStringExtras("params", element.getParamsElement(), false);
50618      }
50619      if (element.hasRequestHeader()) {
50620        openArray("requestHeader");
50621        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
50622          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
50623        closeArray();
50624      };
50625      if (element.hasRequestIdElement()) {
50626        composeIdCore("requestId", element.getRequestIdElement(), false);
50627        composeIdExtras("requestId", element.getRequestIdElement(), false);
50628      }
50629      if (element.hasResponseIdElement()) {
50630        composeIdCore("responseId", element.getResponseIdElement(), false);
50631        composeIdExtras("responseId", element.getResponseIdElement(), false);
50632      }
50633      if (element.hasSourceIdElement()) {
50634        composeIdCore("sourceId", element.getSourceIdElement(), false);
50635        composeIdExtras("sourceId", element.getSourceIdElement(), false);
50636      }
50637      if (element.hasTargetIdElement()) {
50638        composeIdCore("targetId", element.getTargetIdElement(), false);
50639        composeIdExtras("targetId", element.getTargetIdElement(), false);
50640      }
50641      if (element.hasUrlElement()) {
50642        composeStringCore("url", element.getUrlElement(), false);
50643        composeStringExtras("url", element.getUrlElement(), false);
50644      }
50645  }
50646
50647  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
50648    if (element != null) {
50649      open(name);
50650      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
50651      close();
50652    }
50653  }
50654
50655  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
50656      composeBackbone(element);
50657      if (element.hasFieldElement()) {
50658        composeStringCore("field", element.getFieldElement(), false);
50659        composeStringExtras("field", element.getFieldElement(), false);
50660      }
50661      if (element.hasValueElement()) {
50662        composeStringCore("value", element.getValueElement(), false);
50663        composeStringExtras("value", element.getValueElement(), false);
50664      }
50665  }
50666
50667  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
50668    if (element != null) {
50669      open(name);
50670      composeTestScriptSetupActionAssertComponentInner(element);
50671      close();
50672    }
50673  }
50674
50675  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
50676      composeBackbone(element);
50677      if (element.hasLabelElement()) {
50678        composeStringCore("label", element.getLabelElement(), false);
50679        composeStringExtras("label", element.getLabelElement(), false);
50680      }
50681      if (element.hasDescriptionElement()) {
50682        composeStringCore("description", element.getDescriptionElement(), false);
50683        composeStringExtras("description", element.getDescriptionElement(), false);
50684      }
50685      if (element.hasDirectionElement()) {
50686        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
50687        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
50688      }
50689      if (element.hasCompareToSourceIdElement()) {
50690        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
50691        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
50692      }
50693      if (element.hasCompareToSourceExpressionElement()) {
50694        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
50695        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
50696      }
50697      if (element.hasCompareToSourcePathElement()) {
50698        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
50699        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
50700      }
50701      if (element.hasContentTypeElement()) {
50702        composeCodeCore("contentType", element.getContentTypeElement(), false);
50703        composeCodeExtras("contentType", element.getContentTypeElement(), false);
50704      }
50705      if (element.hasExpressionElement()) {
50706        composeStringCore("expression", element.getExpressionElement(), false);
50707        composeStringExtras("expression", element.getExpressionElement(), false);
50708      }
50709      if (element.hasHeaderFieldElement()) {
50710        composeStringCore("headerField", element.getHeaderFieldElement(), false);
50711        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
50712      }
50713      if (element.hasMinimumIdElement()) {
50714        composeStringCore("minimumId", element.getMinimumIdElement(), false);
50715        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
50716      }
50717      if (element.hasNavigationLinksElement()) {
50718        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
50719        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
50720      }
50721      if (element.hasOperatorElement()) {
50722        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
50723        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
50724      }
50725      if (element.hasPathElement()) {
50726        composeStringCore("path", element.getPathElement(), false);
50727        composeStringExtras("path", element.getPathElement(), false);
50728      }
50729      if (element.hasRequestMethodElement()) {
50730        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
50731        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
50732      }
50733      if (element.hasRequestURLElement()) {
50734        composeStringCore("requestURL", element.getRequestURLElement(), false);
50735        composeStringExtras("requestURL", element.getRequestURLElement(), false);
50736      }
50737      if (element.hasResourceElement()) {
50738        composeCodeCore("resource", element.getResourceElement(), false);
50739        composeCodeExtras("resource", element.getResourceElement(), false);
50740      }
50741      if (element.hasResponseElement()) {
50742        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
50743        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
50744      }
50745      if (element.hasResponseCodeElement()) {
50746        composeStringCore("responseCode", element.getResponseCodeElement(), false);
50747        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
50748      }
50749      if (element.hasRule()) {
50750        composeTestScriptActionAssertRuleComponent("rule", element.getRule());
50751      }
50752      if (element.hasRuleset()) {
50753        composeTestScriptActionAssertRulesetComponent("ruleset", element.getRuleset());
50754      }
50755      if (element.hasSourceIdElement()) {
50756        composeIdCore("sourceId", element.getSourceIdElement(), false);
50757        composeIdExtras("sourceId", element.getSourceIdElement(), false);
50758      }
50759      if (element.hasValidateProfileIdElement()) {
50760        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
50761        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
50762      }
50763      if (element.hasValueElement()) {
50764        composeStringCore("value", element.getValueElement(), false);
50765        composeStringExtras("value", element.getValueElement(), false);
50766      }
50767      if (element.hasWarningOnlyElement()) {
50768        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
50769        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
50770      }
50771  }
50772
50773  protected void composeTestScriptActionAssertRuleComponent(String name, TestScript.ActionAssertRuleComponent element) throws IOException {
50774    if (element != null) {
50775      open(name);
50776      composeTestScriptActionAssertRuleComponentInner(element);
50777      close();
50778    }
50779  }
50780
50781  protected void composeTestScriptActionAssertRuleComponentInner(TestScript.ActionAssertRuleComponent element) throws IOException {
50782      composeBackbone(element);
50783      if (element.hasRuleIdElement()) {
50784        composeIdCore("ruleId", element.getRuleIdElement(), false);
50785        composeIdExtras("ruleId", element.getRuleIdElement(), false);
50786      }
50787      if (element.hasParam()) {
50788        openArray("param");
50789        for (TestScript.ActionAssertRuleParamComponent e : element.getParam()) 
50790          composeTestScriptActionAssertRuleParamComponent(null, e);
50791        closeArray();
50792      };
50793  }
50794
50795  protected void composeTestScriptActionAssertRuleParamComponent(String name, TestScript.ActionAssertRuleParamComponent element) throws IOException {
50796    if (element != null) {
50797      open(name);
50798      composeTestScriptActionAssertRuleParamComponentInner(element);
50799      close();
50800    }
50801  }
50802
50803  protected void composeTestScriptActionAssertRuleParamComponentInner(TestScript.ActionAssertRuleParamComponent element) throws IOException {
50804      composeBackbone(element);
50805      if (element.hasNameElement()) {
50806        composeStringCore("name", element.getNameElement(), false);
50807        composeStringExtras("name", element.getNameElement(), false);
50808      }
50809      if (element.hasValueElement()) {
50810        composeStringCore("value", element.getValueElement(), false);
50811        composeStringExtras("value", element.getValueElement(), false);
50812      }
50813  }
50814
50815  protected void composeTestScriptActionAssertRulesetComponent(String name, TestScript.ActionAssertRulesetComponent element) throws IOException {
50816    if (element != null) {
50817      open(name);
50818      composeTestScriptActionAssertRulesetComponentInner(element);
50819      close();
50820    }
50821  }
50822
50823  protected void composeTestScriptActionAssertRulesetComponentInner(TestScript.ActionAssertRulesetComponent element) throws IOException {
50824      composeBackbone(element);
50825      if (element.hasRulesetIdElement()) {
50826        composeIdCore("rulesetId", element.getRulesetIdElement(), false);
50827        composeIdExtras("rulesetId", element.getRulesetIdElement(), false);
50828      }
50829      if (element.hasRule()) {
50830        openArray("rule");
50831        for (TestScript.ActionAssertRulesetRuleComponent e : element.getRule()) 
50832          composeTestScriptActionAssertRulesetRuleComponent(null, e);
50833        closeArray();
50834      };
50835  }
50836
50837  protected void composeTestScriptActionAssertRulesetRuleComponent(String name, TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
50838    if (element != null) {
50839      open(name);
50840      composeTestScriptActionAssertRulesetRuleComponentInner(element);
50841      close();
50842    }
50843  }
50844
50845  protected void composeTestScriptActionAssertRulesetRuleComponentInner(TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
50846      composeBackbone(element);
50847      if (element.hasRuleIdElement()) {
50848        composeIdCore("ruleId", element.getRuleIdElement(), false);
50849        composeIdExtras("ruleId", element.getRuleIdElement(), false);
50850      }
50851      if (element.hasParam()) {
50852        openArray("param");
50853        for (TestScript.ActionAssertRulesetRuleParamComponent e : element.getParam()) 
50854          composeTestScriptActionAssertRulesetRuleParamComponent(null, e);
50855        closeArray();
50856      };
50857  }
50858
50859  protected void composeTestScriptActionAssertRulesetRuleParamComponent(String name, TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
50860    if (element != null) {
50861      open(name);
50862      composeTestScriptActionAssertRulesetRuleParamComponentInner(element);
50863      close();
50864    }
50865  }
50866
50867  protected void composeTestScriptActionAssertRulesetRuleParamComponentInner(TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
50868      composeBackbone(element);
50869      if (element.hasNameElement()) {
50870        composeStringCore("name", element.getNameElement(), false);
50871        composeStringExtras("name", element.getNameElement(), false);
50872      }
50873      if (element.hasValueElement()) {
50874        composeStringCore("value", element.getValueElement(), false);
50875        composeStringExtras("value", element.getValueElement(), false);
50876      }
50877  }
50878
50879  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
50880    if (element != null) {
50881      open(name);
50882      composeTestScriptTestScriptTestComponentInner(element);
50883      close();
50884    }
50885  }
50886
50887  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
50888      composeBackbone(element);
50889      if (element.hasNameElement()) {
50890        composeStringCore("name", element.getNameElement(), false);
50891        composeStringExtras("name", element.getNameElement(), false);
50892      }
50893      if (element.hasDescriptionElement()) {
50894        composeStringCore("description", element.getDescriptionElement(), false);
50895        composeStringExtras("description", element.getDescriptionElement(), false);
50896      }
50897      if (element.hasAction()) {
50898        openArray("action");
50899        for (TestScript.TestActionComponent e : element.getAction()) 
50900          composeTestScriptTestActionComponent(null, e);
50901        closeArray();
50902      };
50903  }
50904
50905  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
50906    if (element != null) {
50907      open(name);
50908      composeTestScriptTestActionComponentInner(element);
50909      close();
50910    }
50911  }
50912
50913  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
50914      composeBackbone(element);
50915      if (element.hasOperation()) {
50916        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
50917      }
50918      if (element.hasAssert()) {
50919        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
50920      }
50921  }
50922
50923  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
50924    if (element != null) {
50925      open(name);
50926      composeTestScriptTestScriptTeardownComponentInner(element);
50927      close();
50928    }
50929  }
50930
50931  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
50932      composeBackbone(element);
50933      if (element.hasAction()) {
50934        openArray("action");
50935        for (TestScript.TeardownActionComponent e : element.getAction()) 
50936          composeTestScriptTeardownActionComponent(null, e);
50937        closeArray();
50938      };
50939  }
50940
50941  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
50942    if (element != null) {
50943      open(name);
50944      composeTestScriptTeardownActionComponentInner(element);
50945      close();
50946    }
50947  }
50948
50949  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
50950      composeBackbone(element);
50951      if (element.hasOperation()) {
50952        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
50953      }
50954  }
50955
50956  protected void composeUserSession(String name, UserSession element) throws IOException {
50957    if (element != null) {
50958      prop("resourceType", name);
50959      composeUserSessionInner(element);
50960    }
50961  }
50962
50963  protected void composeUserSessionInner(UserSession element) throws IOException {
50964      composeDomainResourceElements(element);
50965      if (element.hasIdentifier()) {
50966        composeIdentifier("identifier", element.getIdentifier());
50967      }
50968      if (element.hasUser()) {
50969        composeReference("user", element.getUser());
50970      }
50971      if (element.hasStatus()) {
50972        composeUserSessionUserSessionStatusComponent("status", element.getStatus());
50973      }
50974      if (element.hasWorkstation()) {
50975        composeIdentifier("workstation", element.getWorkstation());
50976      }
50977      if (element.hasFocus()) {
50978        openArray("focus");
50979        for (Reference e : element.getFocus()) 
50980          composeReference(null, e);
50981        closeArray();
50982      };
50983      if (element.hasCreatedElement()) {
50984        composeInstantCore("created", element.getCreatedElement(), false);
50985        composeInstantExtras("created", element.getCreatedElement(), false);
50986      }
50987      if (element.hasExpiresElement()) {
50988        composeInstantCore("expires", element.getExpiresElement(), false);
50989        composeInstantExtras("expires", element.getExpiresElement(), false);
50990      }
50991      if (element.hasContext()) {
50992        openArray("context");
50993        for (UserSession.UserSessionContextComponent e : element.getContext()) 
50994          composeUserSessionUserSessionContextComponent(null, e);
50995        closeArray();
50996      };
50997  }
50998
50999  protected void composeUserSessionUserSessionStatusComponent(String name, UserSession.UserSessionStatusComponent element) throws IOException {
51000    if (element != null) {
51001      open(name);
51002      composeUserSessionUserSessionStatusComponentInner(element);
51003      close();
51004    }
51005  }
51006
51007  protected void composeUserSessionUserSessionStatusComponentInner(UserSession.UserSessionStatusComponent element) throws IOException {
51008      composeBackbone(element);
51009      if (element.hasCodeElement()) {
51010        composeEnumerationCore("code", element.getCodeElement(), new UserSession.UserSessionStatusEnumFactory(), false);
51011        composeEnumerationExtras("code", element.getCodeElement(), new UserSession.UserSessionStatusEnumFactory(), false);
51012      }
51013      if (element.hasSourceElement()) {
51014        composeEnumerationCore("source", element.getSourceElement(), new UserSession.UserSessionStatusSourceEnumFactory(), false);
51015        composeEnumerationExtras("source", element.getSourceElement(), new UserSession.UserSessionStatusSourceEnumFactory(), false);
51016      }
51017  }
51018
51019  protected void composeUserSessionUserSessionContextComponent(String name, UserSession.UserSessionContextComponent element) throws IOException {
51020    if (element != null) {
51021      open(name);
51022      composeUserSessionUserSessionContextComponentInner(element);
51023      close();
51024    }
51025  }
51026
51027  protected void composeUserSessionUserSessionContextComponentInner(UserSession.UserSessionContextComponent element) throws IOException {
51028      composeBackbone(element);
51029      if (element.hasTypeElement()) {
51030        composeStringCore("type", element.getTypeElement(), false);
51031        composeStringExtras("type", element.getTypeElement(), false);
51032      }
51033      if (element.hasValue()) {
51034        composeType("value", element.getValue());
51035      }
51036  }
51037
51038  protected void composeValueSet(String name, ValueSet element) throws IOException {
51039    if (element != null) {
51040      prop("resourceType", name);
51041      composeValueSetInner(element);
51042    }
51043  }
51044
51045  protected void composeValueSetInner(ValueSet element) throws IOException {
51046      composeDomainResourceElements(element);
51047      if (element.hasUrlElement()) {
51048        composeUriCore("url", element.getUrlElement(), false);
51049        composeUriExtras("url", element.getUrlElement(), false);
51050      }
51051      if (element.hasIdentifier()) {
51052        openArray("identifier");
51053        for (Identifier e : element.getIdentifier()) 
51054          composeIdentifier(null, e);
51055        closeArray();
51056      };
51057      if (element.hasVersionElement()) {
51058        composeStringCore("version", element.getVersionElement(), false);
51059        composeStringExtras("version", element.getVersionElement(), false);
51060      }
51061      if (element.hasNameElement()) {
51062        composeStringCore("name", element.getNameElement(), false);
51063        composeStringExtras("name", element.getNameElement(), false);
51064      }
51065      if (element.hasTitleElement()) {
51066        composeStringCore("title", element.getTitleElement(), false);
51067        composeStringExtras("title", element.getTitleElement(), false);
51068      }
51069      if (element.hasStatusElement()) {
51070        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51071        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51072      }
51073      if (element.hasExperimentalElement()) {
51074        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51075        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51076      }
51077      if (element.hasDateElement()) {
51078        composeDateTimeCore("date", element.getDateElement(), false);
51079        composeDateTimeExtras("date", element.getDateElement(), false);
51080      }
51081      if (element.hasPublisherElement()) {
51082        composeStringCore("publisher", element.getPublisherElement(), false);
51083        composeStringExtras("publisher", element.getPublisherElement(), false);
51084      }
51085      if (element.hasContact()) {
51086        openArray("contact");
51087        for (ContactDetail e : element.getContact()) 
51088          composeContactDetail(null, e);
51089        closeArray();
51090      };
51091      if (element.hasDescriptionElement()) {
51092        composeMarkdownCore("description", element.getDescriptionElement(), false);
51093        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51094      }
51095      if (element.hasUseContext()) {
51096        openArray("useContext");
51097        for (UsageContext e : element.getUseContext()) 
51098          composeUsageContext(null, e);
51099        closeArray();
51100      };
51101      if (element.hasJurisdiction()) {
51102        openArray("jurisdiction");
51103        for (CodeableConcept e : element.getJurisdiction()) 
51104          composeCodeableConcept(null, e);
51105        closeArray();
51106      };
51107      if (element.hasImmutableElement()) {
51108        composeBooleanCore("immutable", element.getImmutableElement(), false);
51109        composeBooleanExtras("immutable", element.getImmutableElement(), false);
51110      }
51111      if (element.hasPurposeElement()) {
51112        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51113        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51114      }
51115      if (element.hasCopyrightElement()) {
51116        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51117        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51118      }
51119      if (element.hasExtensibleElement()) {
51120        composeBooleanCore("extensible", element.getExtensibleElement(), false);
51121        composeBooleanExtras("extensible", element.getExtensibleElement(), false);
51122      }
51123      if (element.hasCompose()) {
51124        composeValueSetValueSetComposeComponent("compose", element.getCompose());
51125      }
51126      if (element.hasExpansion()) {
51127        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
51128      }
51129  }
51130
51131  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
51132    if (element != null) {
51133      open(name);
51134      composeValueSetValueSetComposeComponentInner(element);
51135      close();
51136    }
51137  }
51138
51139  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
51140      composeBackbone(element);
51141      if (element.hasLockedDateElement()) {
51142        composeDateCore("lockedDate", element.getLockedDateElement(), false);
51143        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
51144      }
51145      if (element.hasInactiveElement()) {
51146        composeBooleanCore("inactive", element.getInactiveElement(), false);
51147        composeBooleanExtras("inactive", element.getInactiveElement(), false);
51148      }
51149      if (element.hasInclude()) {
51150        openArray("include");
51151        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
51152          composeValueSetConceptSetComponent(null, e);
51153        closeArray();
51154      };
51155      if (element.hasExclude()) {
51156        openArray("exclude");
51157        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
51158          composeValueSetConceptSetComponent(null, e);
51159        closeArray();
51160      };
51161  }
51162
51163  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
51164    if (element != null) {
51165      open(name);
51166      composeValueSetConceptSetComponentInner(element);
51167      close();
51168    }
51169  }
51170
51171  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
51172      composeBackbone(element);
51173      if (element.hasSystemElement()) {
51174        composeUriCore("system", element.getSystemElement(), false);
51175        composeUriExtras("system", element.getSystemElement(), false);
51176      }
51177      if (element.hasVersionElement()) {
51178        composeStringCore("version", element.getVersionElement(), false);
51179        composeStringExtras("version", element.getVersionElement(), false);
51180      }
51181      if (element.hasConcept()) {
51182        openArray("concept");
51183        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
51184          composeValueSetConceptReferenceComponent(null, e);
51185        closeArray();
51186      };
51187      if (element.hasFilter()) {
51188        openArray("filter");
51189        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
51190          composeValueSetConceptSetFilterComponent(null, e);
51191        closeArray();
51192      };
51193      if (element.hasValueSet()) {
51194        openArray("valueSet");
51195        for (CanonicalType e : element.getValueSet()) 
51196          composeCanonicalCore(null, e, true);
51197        closeArray();
51198        if (anyHasExtras(element.getValueSet())) {
51199          openArray("_valueSet");
51200          for (CanonicalType e : element.getValueSet()) 
51201            composeCanonicalExtras(null, e, true);
51202          closeArray();
51203        }
51204      };
51205  }
51206
51207  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
51208    if (element != null) {
51209      open(name);
51210      composeValueSetConceptReferenceComponentInner(element);
51211      close();
51212    }
51213  }
51214
51215  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
51216      composeBackbone(element);
51217      if (element.hasCodeElement()) {
51218        composeCodeCore("code", element.getCodeElement(), false);
51219        composeCodeExtras("code", element.getCodeElement(), false);
51220      }
51221      if (element.hasDisplayElement()) {
51222        composeStringCore("display", element.getDisplayElement(), false);
51223        composeStringExtras("display", element.getDisplayElement(), false);
51224      }
51225      if (element.hasDesignation()) {
51226        openArray("designation");
51227        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
51228          composeValueSetConceptReferenceDesignationComponent(null, e);
51229        closeArray();
51230      };
51231  }
51232
51233  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
51234    if (element != null) {
51235      open(name);
51236      composeValueSetConceptReferenceDesignationComponentInner(element);
51237      close();
51238    }
51239  }
51240
51241  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
51242      composeBackbone(element);
51243      if (element.hasLanguageElement()) {
51244        composeCodeCore("language", element.getLanguageElement(), false);
51245        composeCodeExtras("language", element.getLanguageElement(), false);
51246      }
51247      if (element.hasUse()) {
51248        composeCoding("use", element.getUse());
51249      }
51250      if (element.hasValueElement()) {
51251        composeStringCore("value", element.getValueElement(), false);
51252        composeStringExtras("value", element.getValueElement(), false);
51253      }
51254  }
51255
51256  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
51257    if (element != null) {
51258      open(name);
51259      composeValueSetConceptSetFilterComponentInner(element);
51260      close();
51261    }
51262  }
51263
51264  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
51265      composeBackbone(element);
51266      if (element.hasPropertyElement()) {
51267        composeCodeCore("property", element.getPropertyElement(), false);
51268        composeCodeExtras("property", element.getPropertyElement(), false);
51269      }
51270      if (element.hasOpElement()) {
51271        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
51272        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
51273      }
51274      if (element.hasValueElement()) {
51275        composeStringCore("value", element.getValueElement(), false);
51276        composeStringExtras("value", element.getValueElement(), false);
51277      }
51278  }
51279
51280  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
51281    if (element != null) {
51282      open(name);
51283      composeValueSetValueSetExpansionComponentInner(element);
51284      close();
51285    }
51286  }
51287
51288  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
51289      composeBackbone(element);
51290      if (element.hasIdentifierElement()) {
51291        composeUriCore("identifier", element.getIdentifierElement(), false);
51292        composeUriExtras("identifier", element.getIdentifierElement(), false);
51293      }
51294      if (element.hasTimestampElement()) {
51295        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
51296        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
51297      }
51298      if (element.hasTotalElement()) {
51299        composeIntegerCore("total", element.getTotalElement(), false);
51300        composeIntegerExtras("total", element.getTotalElement(), false);
51301      }
51302      if (element.hasOffsetElement()) {
51303        composeIntegerCore("offset", element.getOffsetElement(), false);
51304        composeIntegerExtras("offset", element.getOffsetElement(), false);
51305      }
51306      if (element.hasParameter()) {
51307        openArray("parameter");
51308        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
51309          composeValueSetValueSetExpansionParameterComponent(null, e);
51310        closeArray();
51311      };
51312      if (element.hasContains()) {
51313        openArray("contains");
51314        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
51315          composeValueSetValueSetExpansionContainsComponent(null, e);
51316        closeArray();
51317      };
51318  }
51319
51320  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
51321    if (element != null) {
51322      open(name);
51323      composeValueSetValueSetExpansionParameterComponentInner(element);
51324      close();
51325    }
51326  }
51327
51328  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
51329      composeBackbone(element);
51330      if (element.hasNameElement()) {
51331        composeStringCore("name", element.getNameElement(), false);
51332        composeStringExtras("name", element.getNameElement(), false);
51333      }
51334      if (element.hasValue()) {
51335        composeType("value", element.getValue());
51336      }
51337  }
51338
51339  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
51340    if (element != null) {
51341      open(name);
51342      composeValueSetValueSetExpansionContainsComponentInner(element);
51343      close();
51344    }
51345  }
51346
51347  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
51348      composeBackbone(element);
51349      if (element.hasSystemElement()) {
51350        composeUriCore("system", element.getSystemElement(), false);
51351        composeUriExtras("system", element.getSystemElement(), false);
51352      }
51353      if (element.hasAbstractElement()) {
51354        composeBooleanCore("abstract", element.getAbstractElement(), false);
51355        composeBooleanExtras("abstract", element.getAbstractElement(), false);
51356      }
51357      if (element.hasInactiveElement()) {
51358        composeBooleanCore("inactive", element.getInactiveElement(), false);
51359        composeBooleanExtras("inactive", element.getInactiveElement(), false);
51360      }
51361      if (element.hasVersionElement()) {
51362        composeStringCore("version", element.getVersionElement(), false);
51363        composeStringExtras("version", element.getVersionElement(), false);
51364      }
51365      if (element.hasCodeElement()) {
51366        composeCodeCore("code", element.getCodeElement(), false);
51367        composeCodeExtras("code", element.getCodeElement(), false);
51368      }
51369      if (element.hasDisplayElement()) {
51370        composeStringCore("display", element.getDisplayElement(), false);
51371        composeStringExtras("display", element.getDisplayElement(), false);
51372      }
51373      if (element.hasDesignation()) {
51374        openArray("designation");
51375        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
51376          composeValueSetConceptReferenceDesignationComponent(null, e);
51377        closeArray();
51378      };
51379      if (element.hasContains()) {
51380        openArray("contains");
51381        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
51382          composeValueSetValueSetExpansionContainsComponent(null, e);
51383        closeArray();
51384      };
51385  }
51386
51387  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
51388    if (element != null) {
51389      prop("resourceType", name);
51390      composeVerificationResultInner(element);
51391    }
51392  }
51393
51394  protected void composeVerificationResultInner(VerificationResult element) throws IOException {
51395      composeDomainResourceElements(element);
51396      if (element.hasTarget()) {
51397        openArray("target");
51398        for (Reference e : element.getTarget()) 
51399          composeReference(null, e);
51400        closeArray();
51401      };
51402      if (element.hasTargetLocation()) {
51403        openArray("targetLocation");
51404        for (StringType e : element.getTargetLocation()) 
51405          composeStringCore(null, e, true);
51406        closeArray();
51407        if (anyHasExtras(element.getTargetLocation())) {
51408          openArray("_targetLocation");
51409          for (StringType e : element.getTargetLocation()) 
51410            composeStringExtras(null, e, true);
51411          closeArray();
51412        }
51413      };
51414      if (element.hasNeedElement()) {
51415        composeEnumerationCore("need", element.getNeedElement(), new VerificationResult.NeedEnumFactory(), false);
51416        composeEnumerationExtras("need", element.getNeedElement(), new VerificationResult.NeedEnumFactory(), false);
51417      }
51418      if (element.hasStatusElement()) {
51419        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
51420        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
51421      }
51422      if (element.hasStatusDateElement()) {
51423        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
51424        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
51425      }
51426      if (element.hasValidationTypeElement()) {
51427        composeEnumerationCore("validationType", element.getValidationTypeElement(), new VerificationResult.ValidationTypeEnumFactory(), false);
51428        composeEnumerationExtras("validationType", element.getValidationTypeElement(), new VerificationResult.ValidationTypeEnumFactory(), false);
51429      }
51430      if (element.hasValidationProcess()) {
51431        openArray("validationProcess");
51432        for (CodeableConcept e : element.getValidationProcess()) 
51433          composeCodeableConcept(null, e);
51434        closeArray();
51435      };
51436      if (element.hasFrequency()) {
51437        composeTiming("frequency", element.getFrequency());
51438      }
51439      if (element.hasLastPerformedElement()) {
51440        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
51441        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
51442      }
51443      if (element.hasNextScheduledElement()) {
51444        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
51445        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
51446      }
51447      if (element.hasFailureActionElement()) {
51448        composeEnumerationCore("failureAction", element.getFailureActionElement(), new VerificationResult.FailureActionEnumFactory(), false);
51449        composeEnumerationExtras("failureAction", element.getFailureActionElement(), new VerificationResult.FailureActionEnumFactory(), false);
51450      }
51451      if (element.hasPrimarySource()) {
51452        openArray("primarySource");
51453        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
51454          composeVerificationResultVerificationResultPrimarySourceComponent(null, e);
51455        closeArray();
51456      };
51457      if (element.hasAttestation()) {
51458        composeVerificationResultVerificationResultAttestationComponent("attestation", element.getAttestation());
51459      }
51460      if (element.hasValidator()) {
51461        openArray("validator");
51462        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
51463          composeVerificationResultVerificationResultValidatorComponent(null, e);
51464        closeArray();
51465      };
51466  }
51467
51468  protected void composeVerificationResultVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
51469    if (element != null) {
51470      open(name);
51471      composeVerificationResultVerificationResultPrimarySourceComponentInner(element);
51472      close();
51473    }
51474  }
51475
51476  protected void composeVerificationResultVerificationResultPrimarySourceComponentInner(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
51477      composeBackbone(element);
51478      if (element.hasIdentifier()) {
51479        composeIdentifier("identifier", element.getIdentifier());
51480      }
51481      if (element.hasOrganization()) {
51482        composeReference("organization", element.getOrganization());
51483      }
51484      if (element.hasType()) {
51485        openArray("type");
51486        for (CodeableConcept e : element.getType()) 
51487          composeCodeableConcept(null, e);
51488        closeArray();
51489      };
51490      if (element.hasValidationProcess()) {
51491        openArray("validationProcess");
51492        for (CodeableConcept e : element.getValidationProcess()) 
51493          composeCodeableConcept(null, e);
51494        closeArray();
51495      };
51496      if (element.hasValidationStatusElement()) {
51497        composeEnumerationCore("validationStatus", element.getValidationStatusElement(), new VerificationResult.ValidationStatusEnumFactory(), false);
51498        composeEnumerationExtras("validationStatus", element.getValidationStatusElement(), new VerificationResult.ValidationStatusEnumFactory(), false);
51499      }
51500      if (element.hasValidationDateElement()) {
51501        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
51502        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
51503      }
51504      if (element.hasCanPushUpdatesElement()) {
51505        composeEnumerationCore("canPushUpdates", element.getCanPushUpdatesElement(), new VerificationResult.CanPushUpdatesEnumFactory(), false);
51506        composeEnumerationExtras("canPushUpdates", element.getCanPushUpdatesElement(), new VerificationResult.CanPushUpdatesEnumFactory(), false);
51507      }
51508      if (element.hasPushTypeAvailable()) {
51509        openArray("pushTypeAvailable");
51510        for (Enumeration<VerificationResult.PushTypeAvailable> e : element.getPushTypeAvailable()) 
51511          composeEnumerationCore(null, e, new VerificationResult.PushTypeAvailableEnumFactory(), true);
51512        closeArray();
51513        if (anyHasExtras(element.getPushTypeAvailable())) {
51514          openArray("_pushTypeAvailable");
51515          for (Enumeration<VerificationResult.PushTypeAvailable> e : element.getPushTypeAvailable()) 
51516            composeEnumerationExtras(null, e, new VerificationResult.PushTypeAvailableEnumFactory(), true);
51517          closeArray();
51518        }
51519      };
51520  }
51521
51522  protected void composeVerificationResultVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
51523    if (element != null) {
51524      open(name);
51525      composeVerificationResultVerificationResultAttestationComponentInner(element);
51526      close();
51527    }
51528  }
51529
51530  protected void composeVerificationResultVerificationResultAttestationComponentInner(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
51531      composeBackbone(element);
51532      if (element.hasSource()) {
51533        composeReference("source", element.getSource());
51534      }
51535      if (element.hasOrganization()) {
51536        composeReference("organization", element.getOrganization());
51537      }
51538      if (element.hasMethod()) {
51539        composeCodeableConcept("method", element.getMethod());
51540      }
51541      if (element.hasDateElement()) {
51542        composeDateCore("date", element.getDateElement(), false);
51543        composeDateExtras("date", element.getDateElement(), false);
51544      }
51545      if (element.hasSourceIdentityCertificateElement()) {
51546        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
51547        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
51548      }
51549      if (element.hasProxyIdentityCertificateElement()) {
51550        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
51551        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
51552      }
51553  }
51554
51555  protected void composeVerificationResultVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
51556    if (element != null) {
51557      open(name);
51558      composeVerificationResultVerificationResultValidatorComponentInner(element);
51559      close();
51560    }
51561  }
51562
51563  protected void composeVerificationResultVerificationResultValidatorComponentInner(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
51564      composeBackbone(element);
51565      if (element.hasIdentifier()) {
51566        composeIdentifier("identifier", element.getIdentifier());
51567      }
51568      if (element.hasOrganization()) {
51569        composeReference("organization", element.getOrganization());
51570      }
51571      if (element.hasIdentityCertificateElement()) {
51572        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
51573        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
51574      }
51575      if (element.hasDateValidatedElement()) {
51576        composeDateCore("dateValidated", element.getDateValidatedElement(), false);
51577        composeDateExtras("dateValidated", element.getDateValidatedElement(), false);
51578      }
51579  }
51580
51581  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
51582    if (element != null) {
51583      prop("resourceType", name);
51584      composeVisionPrescriptionInner(element);
51585    }
51586  }
51587
51588  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
51589      composeDomainResourceElements(element);
51590      if (element.hasIdentifier()) {
51591        openArray("identifier");
51592        for (Identifier e : element.getIdentifier()) 
51593          composeIdentifier(null, e);
51594        closeArray();
51595      };
51596      if (element.hasStatusElement()) {
51597        composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
51598        composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
51599      }
51600      if (element.hasPatient()) {
51601        composeReference("patient", element.getPatient());
51602      }
51603      if (element.hasEncounter()) {
51604        composeReference("encounter", element.getEncounter());
51605      }
51606      if (element.hasDateWrittenElement()) {
51607        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
51608        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
51609      }
51610      if (element.hasPrescriber()) {
51611        composeReference("prescriber", element.getPrescriber());
51612      }
51613      if (element.hasReason()) {
51614        composeType("reason", element.getReason());
51615      }
51616      if (element.hasDispense()) {
51617        openArray("dispense");
51618        for (VisionPrescription.VisionPrescriptionDispenseComponent e : element.getDispense()) 
51619          composeVisionPrescriptionVisionPrescriptionDispenseComponent(null, e);
51620        closeArray();
51621      };
51622  }
51623
51624  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(String name, VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
51625    if (element != null) {
51626      open(name);
51627      composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(element);
51628      close();
51629    }
51630  }
51631
51632  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
51633      composeBackbone(element);
51634      if (element.hasProduct()) {
51635        composeCodeableConcept("product", element.getProduct());
51636      }
51637      if (element.hasEyeElement()) {
51638        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
51639        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
51640      }
51641      if (element.hasSphereElement()) {
51642        composeDecimalCore("sphere", element.getSphereElement(), false);
51643        composeDecimalExtras("sphere", element.getSphereElement(), false);
51644      }
51645      if (element.hasCylinderElement()) {
51646        composeDecimalCore("cylinder", element.getCylinderElement(), false);
51647        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
51648      }
51649      if (element.hasAxisElement()) {
51650        composeIntegerCore("axis", element.getAxisElement(), false);
51651        composeIntegerExtras("axis", element.getAxisElement(), false);
51652      }
51653      if (element.hasPrism()) {
51654        openArray("prism");
51655        for (VisionPrescription.PrismComponent e : element.getPrism()) 
51656          composeVisionPrescriptionPrismComponent(null, e);
51657        closeArray();
51658      };
51659      if (element.hasAddElement()) {
51660        composeDecimalCore("add", element.getAddElement(), false);
51661        composeDecimalExtras("add", element.getAddElement(), false);
51662      }
51663      if (element.hasPowerElement()) {
51664        composeDecimalCore("power", element.getPowerElement(), false);
51665        composeDecimalExtras("power", element.getPowerElement(), false);
51666      }
51667      if (element.hasBackCurveElement()) {
51668        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
51669        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
51670      }
51671      if (element.hasDiameterElement()) {
51672        composeDecimalCore("diameter", element.getDiameterElement(), false);
51673        composeDecimalExtras("diameter", element.getDiameterElement(), false);
51674      }
51675      if (element.hasDuration()) {
51676        composeSimpleQuantity("duration", element.getDuration());
51677      }
51678      if (element.hasColorElement()) {
51679        composeStringCore("color", element.getColorElement(), false);
51680        composeStringExtras("color", element.getColorElement(), false);
51681      }
51682      if (element.hasBrandElement()) {
51683        composeStringCore("brand", element.getBrandElement(), false);
51684        composeStringExtras("brand", element.getBrandElement(), false);
51685      }
51686      if (element.hasNote()) {
51687        openArray("note");
51688        for (Annotation e : element.getNote()) 
51689          composeAnnotation(null, e);
51690        closeArray();
51691      };
51692  }
51693
51694  protected void composeVisionPrescriptionPrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
51695    if (element != null) {
51696      open(name);
51697      composeVisionPrescriptionPrismComponentInner(element);
51698      close();
51699    }
51700  }
51701
51702  protected void composeVisionPrescriptionPrismComponentInner(VisionPrescription.PrismComponent element) throws IOException {
51703      composeBackbone(element);
51704      if (element.hasAmountElement()) {
51705        composeDecimalCore("amount", element.getAmountElement(), false);
51706        composeDecimalExtras("amount", element.getAmountElement(), false);
51707      }
51708      if (element.hasBaseElement()) {
51709        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
51710        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
51711      }
51712  }
51713
51714  @Override
51715  protected void composeResource(Resource resource) throws IOException {
51716    if (resource instanceof Parameters)
51717      composeParameters("Parameters", (Parameters)resource);
51718    else if (resource instanceof Account)
51719      composeAccount("Account", (Account)resource);
51720    else if (resource instanceof ActivityDefinition)
51721      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
51722    else if (resource instanceof AdverseEvent)
51723      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
51724    else if (resource instanceof AllergyIntolerance)
51725      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
51726    else if (resource instanceof Appointment)
51727      composeAppointment("Appointment", (Appointment)resource);
51728    else if (resource instanceof AppointmentResponse)
51729      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
51730    else if (resource instanceof AuditEvent)
51731      composeAuditEvent("AuditEvent", (AuditEvent)resource);
51732    else if (resource instanceof Basic)
51733      composeBasic("Basic", (Basic)resource);
51734    else if (resource instanceof Binary)
51735      composeBinary("Binary", (Binary)resource);
51736    else if (resource instanceof BiologicallyDerivedProduct)
51737      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
51738    else if (resource instanceof BodyStructure)
51739      composeBodyStructure("BodyStructure", (BodyStructure)resource);
51740    else if (resource instanceof Bundle)
51741      composeBundle("Bundle", (Bundle)resource);
51742    else if (resource instanceof CapabilityStatement)
51743      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
51744    else if (resource instanceof CarePlan)
51745      composeCarePlan("CarePlan", (CarePlan)resource);
51746    else if (resource instanceof CareTeam)
51747      composeCareTeam("CareTeam", (CareTeam)resource);
51748    else if (resource instanceof ChargeItem)
51749      composeChargeItem("ChargeItem", (ChargeItem)resource);
51750    else if (resource instanceof Claim)
51751      composeClaim("Claim", (Claim)resource);
51752    else if (resource instanceof ClaimResponse)
51753      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
51754    else if (resource instanceof ClinicalImpression)
51755      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
51756    else if (resource instanceof CodeSystem)
51757      composeCodeSystem("CodeSystem", (CodeSystem)resource);
51758    else if (resource instanceof Communication)
51759      composeCommunication("Communication", (Communication)resource);
51760    else if (resource instanceof CommunicationRequest)
51761      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
51762    else if (resource instanceof CompartmentDefinition)
51763      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
51764    else if (resource instanceof Composition)
51765      composeComposition("Composition", (Composition)resource);
51766    else if (resource instanceof ConceptMap)
51767      composeConceptMap("ConceptMap", (ConceptMap)resource);
51768    else if (resource instanceof Condition)
51769      composeCondition("Condition", (Condition)resource);
51770    else if (resource instanceof Consent)
51771      composeConsent("Consent", (Consent)resource);
51772    else if (resource instanceof Contract)
51773      composeContract("Contract", (Contract)resource);
51774    else if (resource instanceof Coverage)
51775      composeCoverage("Coverage", (Coverage)resource);
51776    else if (resource instanceof DetectedIssue)
51777      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
51778    else if (resource instanceof Device)
51779      composeDevice("Device", (Device)resource);
51780    else if (resource instanceof DeviceComponent)
51781      composeDeviceComponent("DeviceComponent", (DeviceComponent)resource);
51782    else if (resource instanceof DeviceMetric)
51783      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
51784    else if (resource instanceof DeviceRequest)
51785      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
51786    else if (resource instanceof DeviceUseStatement)
51787      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
51788    else if (resource instanceof DiagnosticReport)
51789      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
51790    else if (resource instanceof DocumentManifest)
51791      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
51792    else if (resource instanceof DocumentReference)
51793      composeDocumentReference("DocumentReference", (DocumentReference)resource);
51794    else if (resource instanceof EligibilityRequest)
51795      composeEligibilityRequest("EligibilityRequest", (EligibilityRequest)resource);
51796    else if (resource instanceof EligibilityResponse)
51797      composeEligibilityResponse("EligibilityResponse", (EligibilityResponse)resource);
51798    else if (resource instanceof Encounter)
51799      composeEncounter("Encounter", (Encounter)resource);
51800    else if (resource instanceof Endpoint)
51801      composeEndpoint("Endpoint", (Endpoint)resource);
51802    else if (resource instanceof EnrollmentRequest)
51803      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
51804    else if (resource instanceof EnrollmentResponse)
51805      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
51806    else if (resource instanceof EntryDefinition)
51807      composeEntryDefinition("EntryDefinition", (EntryDefinition)resource);
51808    else if (resource instanceof EpisodeOfCare)
51809      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
51810    else if (resource instanceof EventDefinition)
51811      composeEventDefinition("EventDefinition", (EventDefinition)resource);
51812    else if (resource instanceof ExampleScenario)
51813      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
51814    else if (resource instanceof ExpansionProfile)
51815      composeExpansionProfile("ExpansionProfile", (ExpansionProfile)resource);
51816    else if (resource instanceof ExplanationOfBenefit)
51817      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
51818    else if (resource instanceof FamilyMemberHistory)
51819      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
51820    else if (resource instanceof Flag)
51821      composeFlag("Flag", (Flag)resource);
51822    else if (resource instanceof Goal)
51823      composeGoal("Goal", (Goal)resource);
51824    else if (resource instanceof GraphDefinition)
51825      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
51826    else if (resource instanceof Group)
51827      composeGroup("Group", (Group)resource);
51828    else if (resource instanceof GuidanceResponse)
51829      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
51830    else if (resource instanceof HealthcareService)
51831      composeHealthcareService("HealthcareService", (HealthcareService)resource);
51832    else if (resource instanceof ImagingStudy)
51833      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
51834    else if (resource instanceof Immunization)
51835      composeImmunization("Immunization", (Immunization)resource);
51836    else if (resource instanceof ImmunizationEvaluation)
51837      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
51838    else if (resource instanceof ImmunizationRecommendation)
51839      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
51840    else if (resource instanceof ImplementationGuide)
51841      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
51842    else if (resource instanceof Invoice)
51843      composeInvoice("Invoice", (Invoice)resource);
51844    else if (resource instanceof ItemInstance)
51845      composeItemInstance("ItemInstance", (ItemInstance)resource);
51846    else if (resource instanceof Library)
51847      composeLibrary("Library", (Library)resource);
51848    else if (resource instanceof Linkage)
51849      composeLinkage("Linkage", (Linkage)resource);
51850    else if (resource instanceof ListResource)
51851      composeListResource("List", (ListResource)resource);
51852    else if (resource instanceof Location)
51853      composeLocation("Location", (Location)resource);
51854    else if (resource instanceof Measure)
51855      composeMeasure("Measure", (Measure)resource);
51856    else if (resource instanceof MeasureReport)
51857      composeMeasureReport("MeasureReport", (MeasureReport)resource);
51858    else if (resource instanceof Media)
51859      composeMedia("Media", (Media)resource);
51860    else if (resource instanceof Medication)
51861      composeMedication("Medication", (Medication)resource);
51862    else if (resource instanceof MedicationAdministration)
51863      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
51864    else if (resource instanceof MedicationDispense)
51865      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
51866    else if (resource instanceof MedicationKnowledge)
51867      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
51868    else if (resource instanceof MedicationRequest)
51869      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
51870    else if (resource instanceof MedicationStatement)
51871      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
51872    else if (resource instanceof MedicinalProduct)
51873      composeMedicinalProduct("MedicinalProduct", (MedicinalProduct)resource);
51874    else if (resource instanceof MedicinalProductAuthorization)
51875      composeMedicinalProductAuthorization("MedicinalProductAuthorization", (MedicinalProductAuthorization)resource);
51876    else if (resource instanceof MedicinalProductClinicals)
51877      composeMedicinalProductClinicals("MedicinalProductClinicals", (MedicinalProductClinicals)resource);
51878    else if (resource instanceof MedicinalProductDeviceSpec)
51879      composeMedicinalProductDeviceSpec("MedicinalProductDeviceSpec", (MedicinalProductDeviceSpec)resource);
51880    else if (resource instanceof MedicinalProductIngredient)
51881      composeMedicinalProductIngredient("MedicinalProductIngredient", (MedicinalProductIngredient)resource);
51882    else if (resource instanceof MedicinalProductPackaged)
51883      composeMedicinalProductPackaged("MedicinalProductPackaged", (MedicinalProductPackaged)resource);
51884    else if (resource instanceof MedicinalProductPharmaceutical)
51885      composeMedicinalProductPharmaceutical("MedicinalProductPharmaceutical", (MedicinalProductPharmaceutical)resource);
51886    else if (resource instanceof MessageDefinition)
51887      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
51888    else if (resource instanceof MessageHeader)
51889      composeMessageHeader("MessageHeader", (MessageHeader)resource);
51890    else if (resource instanceof NamingSystem)
51891      composeNamingSystem("NamingSystem", (NamingSystem)resource);
51892    else if (resource instanceof NutritionOrder)
51893      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
51894    else if (resource instanceof Observation)
51895      composeObservation("Observation", (Observation)resource);
51896    else if (resource instanceof ObservationDefinition)
51897      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
51898    else if (resource instanceof OccupationalData)
51899      composeOccupationalData("OccupationalData", (OccupationalData)resource);
51900    else if (resource instanceof OperationDefinition)
51901      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
51902    else if (resource instanceof OperationOutcome)
51903      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
51904    else if (resource instanceof Organization)
51905      composeOrganization("Organization", (Organization)resource);
51906    else if (resource instanceof OrganizationRole)
51907      composeOrganizationRole("OrganizationRole", (OrganizationRole)resource);
51908    else if (resource instanceof Patient)
51909      composePatient("Patient", (Patient)resource);
51910    else if (resource instanceof PaymentNotice)
51911      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
51912    else if (resource instanceof PaymentReconciliation)
51913      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
51914    else if (resource instanceof Person)
51915      composePerson("Person", (Person)resource);
51916    else if (resource instanceof PlanDefinition)
51917      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
51918    else if (resource instanceof Practitioner)
51919      composePractitioner("Practitioner", (Practitioner)resource);
51920    else if (resource instanceof PractitionerRole)
51921      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
51922    else if (resource instanceof Procedure)
51923      composeProcedure("Procedure", (Procedure)resource);
51924    else if (resource instanceof ProcessRequest)
51925      composeProcessRequest("ProcessRequest", (ProcessRequest)resource);
51926    else if (resource instanceof ProcessResponse)
51927      composeProcessResponse("ProcessResponse", (ProcessResponse)resource);
51928    else if (resource instanceof ProductPlan)
51929      composeProductPlan("ProductPlan", (ProductPlan)resource);
51930    else if (resource instanceof Provenance)
51931      composeProvenance("Provenance", (Provenance)resource);
51932    else if (resource instanceof Questionnaire)
51933      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
51934    else if (resource instanceof QuestionnaireResponse)
51935      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
51936    else if (resource instanceof RelatedPerson)
51937      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
51938    else if (resource instanceof RequestGroup)
51939      composeRequestGroup("RequestGroup", (RequestGroup)resource);
51940    else if (resource instanceof ResearchStudy)
51941      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
51942    else if (resource instanceof ResearchSubject)
51943      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
51944    else if (resource instanceof RiskAssessment)
51945      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
51946    else if (resource instanceof Schedule)
51947      composeSchedule("Schedule", (Schedule)resource);
51948    else if (resource instanceof SearchParameter)
51949      composeSearchParameter("SearchParameter", (SearchParameter)resource);
51950    else if (resource instanceof Sequence)
51951      composeSequence("Sequence", (Sequence)resource);
51952    else if (resource instanceof ServiceRequest)
51953      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
51954    else if (resource instanceof Slot)
51955      composeSlot("Slot", (Slot)resource);
51956    else if (resource instanceof Specimen)
51957      composeSpecimen("Specimen", (Specimen)resource);
51958    else if (resource instanceof SpecimenDefinition)
51959      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
51960    else if (resource instanceof StructureDefinition)
51961      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
51962    else if (resource instanceof StructureMap)
51963      composeStructureMap("StructureMap", (StructureMap)resource);
51964    else if (resource instanceof Subscription)
51965      composeSubscription("Subscription", (Subscription)resource);
51966    else if (resource instanceof Substance)
51967      composeSubstance("Substance", (Substance)resource);
51968    else if (resource instanceof SubstancePolymer)
51969      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer)resource);
51970    else if (resource instanceof SubstanceReferenceInformation)
51971      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation)resource);
51972    else if (resource instanceof SubstanceSpecification)
51973      composeSubstanceSpecification("SubstanceSpecification", (SubstanceSpecification)resource);
51974    else if (resource instanceof SupplyDelivery)
51975      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
51976    else if (resource instanceof SupplyRequest)
51977      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
51978    else if (resource instanceof Task)
51979      composeTask("Task", (Task)resource);
51980    else if (resource instanceof TerminologyCapabilities)
51981      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
51982    else if (resource instanceof TestReport)
51983      composeTestReport("TestReport", (TestReport)resource);
51984    else if (resource instanceof TestScript)
51985      composeTestScript("TestScript", (TestScript)resource);
51986    else if (resource instanceof UserSession)
51987      composeUserSession("UserSession", (UserSession)resource);
51988    else if (resource instanceof ValueSet)
51989      composeValueSet("ValueSet", (ValueSet)resource);
51990    else if (resource instanceof VerificationResult)
51991      composeVerificationResult("VerificationResult", (VerificationResult)resource);
51992    else if (resource instanceof VisionPrescription)
51993      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
51994    else if (resource instanceof Binary)
51995      composeBinary("Binary", (Binary)resource);
51996    else
51997      throw new Error("Unhandled resource type "+resource.getClass().getName());
51998  }
51999
52000  protected void composeNamedReference(String name, Resource resource) throws IOException {
52001    if (resource instanceof Parameters)
52002      composeParameters(name, (Parameters)resource);
52003    else if (resource instanceof Account)
52004      composeAccount(name, (Account)resource);
52005    else if (resource instanceof ActivityDefinition)
52006      composeActivityDefinition(name, (ActivityDefinition)resource);
52007    else if (resource instanceof AdverseEvent)
52008      composeAdverseEvent(name, (AdverseEvent)resource);
52009    else if (resource instanceof AllergyIntolerance)
52010      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
52011    else if (resource instanceof Appointment)
52012      composeAppointment(name, (Appointment)resource);
52013    else if (resource instanceof AppointmentResponse)
52014      composeAppointmentResponse(name, (AppointmentResponse)resource);
52015    else if (resource instanceof AuditEvent)
52016      composeAuditEvent(name, (AuditEvent)resource);
52017    else if (resource instanceof Basic)
52018      composeBasic(name, (Basic)resource);
52019    else if (resource instanceof Binary)
52020      composeBinary(name, (Binary)resource);
52021    else if (resource instanceof BiologicallyDerivedProduct)
52022      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
52023    else if (resource instanceof BodyStructure)
52024      composeBodyStructure(name, (BodyStructure)resource);
52025    else if (resource instanceof Bundle)
52026      composeBundle(name, (Bundle)resource);
52027    else if (resource instanceof CapabilityStatement)
52028      composeCapabilityStatement(name, (CapabilityStatement)resource);
52029    else if (resource instanceof CarePlan)
52030      composeCarePlan(name, (CarePlan)resource);
52031    else if (resource instanceof CareTeam)
52032      composeCareTeam(name, (CareTeam)resource);
52033    else if (resource instanceof ChargeItem)
52034      composeChargeItem(name, (ChargeItem)resource);
52035    else if (resource instanceof Claim)
52036      composeClaim(name, (Claim)resource);
52037    else if (resource instanceof ClaimResponse)
52038      composeClaimResponse(name, (ClaimResponse)resource);
52039    else if (resource instanceof ClinicalImpression)
52040      composeClinicalImpression(name, (ClinicalImpression)resource);
52041    else if (resource instanceof CodeSystem)
52042      composeCodeSystem(name, (CodeSystem)resource);
52043    else if (resource instanceof Communication)
52044      composeCommunication(name, (Communication)resource);
52045    else if (resource instanceof CommunicationRequest)
52046      composeCommunicationRequest(name, (CommunicationRequest)resource);
52047    else if (resource instanceof CompartmentDefinition)
52048      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
52049    else if (resource instanceof Composition)
52050      composeComposition(name, (Composition)resource);
52051    else if (resource instanceof ConceptMap)
52052      composeConceptMap(name, (ConceptMap)resource);
52053    else if (resource instanceof Condition)
52054      composeCondition(name, (Condition)resource);
52055    else if (resource instanceof Consent)
52056      composeConsent(name, (Consent)resource);
52057    else if (resource instanceof Contract)
52058      composeContract(name, (Contract)resource);
52059    else if (resource instanceof Coverage)
52060      composeCoverage(name, (Coverage)resource);
52061    else if (resource instanceof DetectedIssue)
52062      composeDetectedIssue(name, (DetectedIssue)resource);
52063    else if (resource instanceof Device)
52064      composeDevice(name, (Device)resource);
52065    else if (resource instanceof DeviceComponent)
52066      composeDeviceComponent(name, (DeviceComponent)resource);
52067    else if (resource instanceof DeviceMetric)
52068      composeDeviceMetric(name, (DeviceMetric)resource);
52069    else if (resource instanceof DeviceRequest)
52070      composeDeviceRequest(name, (DeviceRequest)resource);
52071    else if (resource instanceof DeviceUseStatement)
52072      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
52073    else if (resource instanceof DiagnosticReport)
52074      composeDiagnosticReport(name, (DiagnosticReport)resource);
52075    else if (resource instanceof DocumentManifest)
52076      composeDocumentManifest(name, (DocumentManifest)resource);
52077    else if (resource instanceof DocumentReference)
52078      composeDocumentReference(name, (DocumentReference)resource);
52079    else if (resource instanceof EligibilityRequest)
52080      composeEligibilityRequest(name, (EligibilityRequest)resource);
52081    else if (resource instanceof EligibilityResponse)
52082      composeEligibilityResponse(name, (EligibilityResponse)resource);
52083    else if (resource instanceof Encounter)
52084      composeEncounter(name, (Encounter)resource);
52085    else if (resource instanceof Endpoint)
52086      composeEndpoint(name, (Endpoint)resource);
52087    else if (resource instanceof EnrollmentRequest)
52088      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
52089    else if (resource instanceof EnrollmentResponse)
52090      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
52091    else if (resource instanceof EntryDefinition)
52092      composeEntryDefinition(name, (EntryDefinition)resource);
52093    else if (resource instanceof EpisodeOfCare)
52094      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
52095    else if (resource instanceof EventDefinition)
52096      composeEventDefinition(name, (EventDefinition)resource);
52097    else if (resource instanceof ExampleScenario)
52098      composeExampleScenario(name, (ExampleScenario)resource);
52099    else if (resource instanceof ExpansionProfile)
52100      composeExpansionProfile(name, (ExpansionProfile)resource);
52101    else if (resource instanceof ExplanationOfBenefit)
52102      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
52103    else if (resource instanceof FamilyMemberHistory)
52104      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
52105    else if (resource instanceof Flag)
52106      composeFlag(name, (Flag)resource);
52107    else if (resource instanceof Goal)
52108      composeGoal(name, (Goal)resource);
52109    else if (resource instanceof GraphDefinition)
52110      composeGraphDefinition(name, (GraphDefinition)resource);
52111    else if (resource instanceof Group)
52112      composeGroup(name, (Group)resource);
52113    else if (resource instanceof GuidanceResponse)
52114      composeGuidanceResponse(name, (GuidanceResponse)resource);
52115    else if (resource instanceof HealthcareService)
52116      composeHealthcareService(name, (HealthcareService)resource);
52117    else if (resource instanceof ImagingStudy)
52118      composeImagingStudy(name, (ImagingStudy)resource);
52119    else if (resource instanceof Immunization)
52120      composeImmunization(name, (Immunization)resource);
52121    else if (resource instanceof ImmunizationEvaluation)
52122      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
52123    else if (resource instanceof ImmunizationRecommendation)
52124      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
52125    else if (resource instanceof ImplementationGuide)
52126      composeImplementationGuide(name, (ImplementationGuide)resource);
52127    else if (resource instanceof Invoice)
52128      composeInvoice(name, (Invoice)resource);
52129    else if (resource instanceof ItemInstance)
52130      composeItemInstance(name, (ItemInstance)resource);
52131    else if (resource instanceof Library)
52132      composeLibrary(name, (Library)resource);
52133    else if (resource instanceof Linkage)
52134      composeLinkage(name, (Linkage)resource);
52135    else if (resource instanceof ListResource)
52136      composeListResource(name, (ListResource)resource);
52137    else if (resource instanceof Location)
52138      composeLocation(name, (Location)resource);
52139    else if (resource instanceof Measure)
52140      composeMeasure(name, (Measure)resource);
52141    else if (resource instanceof MeasureReport)
52142      composeMeasureReport(name, (MeasureReport)resource);
52143    else if (resource instanceof Media)
52144      composeMedia(name, (Media)resource);
52145    else if (resource instanceof Medication)
52146      composeMedication(name, (Medication)resource);
52147    else if (resource instanceof MedicationAdministration)
52148      composeMedicationAdministration(name, (MedicationAdministration)resource);
52149    else if (resource instanceof MedicationDispense)
52150      composeMedicationDispense(name, (MedicationDispense)resource);
52151    else if (resource instanceof MedicationKnowledge)
52152      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
52153    else if (resource instanceof MedicationRequest)
52154      composeMedicationRequest(name, (MedicationRequest)resource);
52155    else if (resource instanceof MedicationStatement)
52156      composeMedicationStatement(name, (MedicationStatement)resource);
52157    else if (resource instanceof MedicinalProduct)
52158      composeMedicinalProduct(name, (MedicinalProduct)resource);
52159    else if (resource instanceof MedicinalProductAuthorization)
52160      composeMedicinalProductAuthorization(name, (MedicinalProductAuthorization)resource);
52161    else if (resource instanceof MedicinalProductClinicals)
52162      composeMedicinalProductClinicals(name, (MedicinalProductClinicals)resource);
52163    else if (resource instanceof MedicinalProductDeviceSpec)
52164      composeMedicinalProductDeviceSpec(name, (MedicinalProductDeviceSpec)resource);
52165    else if (resource instanceof MedicinalProductIngredient)
52166      composeMedicinalProductIngredient(name, (MedicinalProductIngredient)resource);
52167    else if (resource instanceof MedicinalProductPackaged)
52168      composeMedicinalProductPackaged(name, (MedicinalProductPackaged)resource);
52169    else if (resource instanceof MedicinalProductPharmaceutical)
52170      composeMedicinalProductPharmaceutical(name, (MedicinalProductPharmaceutical)resource);
52171    else if (resource instanceof MessageDefinition)
52172      composeMessageDefinition(name, (MessageDefinition)resource);
52173    else if (resource instanceof MessageHeader)
52174      composeMessageHeader(name, (MessageHeader)resource);
52175    else if (resource instanceof NamingSystem)
52176      composeNamingSystem(name, (NamingSystem)resource);
52177    else if (resource instanceof NutritionOrder)
52178      composeNutritionOrder(name, (NutritionOrder)resource);
52179    else if (resource instanceof Observation)
52180      composeObservation(name, (Observation)resource);
52181    else if (resource instanceof ObservationDefinition)
52182      composeObservationDefinition(name, (ObservationDefinition)resource);
52183    else if (resource instanceof OccupationalData)
52184      composeOccupationalData(name, (OccupationalData)resource);
52185    else if (resource instanceof OperationDefinition)
52186      composeOperationDefinition(name, (OperationDefinition)resource);
52187    else if (resource instanceof OperationOutcome)
52188      composeOperationOutcome(name, (OperationOutcome)resource);
52189    else if (resource instanceof Organization)
52190      composeOrganization(name, (Organization)resource);
52191    else if (resource instanceof OrganizationRole)
52192      composeOrganizationRole(name, (OrganizationRole)resource);
52193    else if (resource instanceof Patient)
52194      composePatient(name, (Patient)resource);
52195    else if (resource instanceof PaymentNotice)
52196      composePaymentNotice(name, (PaymentNotice)resource);
52197    else if (resource instanceof PaymentReconciliation)
52198      composePaymentReconciliation(name, (PaymentReconciliation)resource);
52199    else if (resource instanceof Person)
52200      composePerson(name, (Person)resource);
52201    else if (resource instanceof PlanDefinition)
52202      composePlanDefinition(name, (PlanDefinition)resource);
52203    else if (resource instanceof Practitioner)
52204      composePractitioner(name, (Practitioner)resource);
52205    else if (resource instanceof PractitionerRole)
52206      composePractitionerRole(name, (PractitionerRole)resource);
52207    else if (resource instanceof Procedure)
52208      composeProcedure(name, (Procedure)resource);
52209    else if (resource instanceof ProcessRequest)
52210      composeProcessRequest(name, (ProcessRequest)resource);
52211    else if (resource instanceof ProcessResponse)
52212      composeProcessResponse(name, (ProcessResponse)resource);
52213    else if (resource instanceof ProductPlan)
52214      composeProductPlan(name, (ProductPlan)resource);
52215    else if (resource instanceof Provenance)
52216      composeProvenance(name, (Provenance)resource);
52217    else if (resource instanceof Questionnaire)
52218      composeQuestionnaire(name, (Questionnaire)resource);
52219    else if (resource instanceof QuestionnaireResponse)
52220      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
52221    else if (resource instanceof RelatedPerson)
52222      composeRelatedPerson(name, (RelatedPerson)resource);
52223    else if (resource instanceof RequestGroup)
52224      composeRequestGroup(name, (RequestGroup)resource);
52225    else if (resource instanceof ResearchStudy)
52226      composeResearchStudy(name, (ResearchStudy)resource);
52227    else if (resource instanceof ResearchSubject)
52228      composeResearchSubject(name, (ResearchSubject)resource);
52229    else if (resource instanceof RiskAssessment)
52230      composeRiskAssessment(name, (RiskAssessment)resource);
52231    else if (resource instanceof Schedule)
52232      composeSchedule(name, (Schedule)resource);
52233    else if (resource instanceof SearchParameter)
52234      composeSearchParameter(name, (SearchParameter)resource);
52235    else if (resource instanceof Sequence)
52236      composeSequence(name, (Sequence)resource);
52237    else if (resource instanceof ServiceRequest)
52238      composeServiceRequest(name, (ServiceRequest)resource);
52239    else if (resource instanceof Slot)
52240      composeSlot(name, (Slot)resource);
52241    else if (resource instanceof Specimen)
52242      composeSpecimen(name, (Specimen)resource);
52243    else if (resource instanceof SpecimenDefinition)
52244      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
52245    else if (resource instanceof StructureDefinition)
52246      composeStructureDefinition(name, (StructureDefinition)resource);
52247    else if (resource instanceof StructureMap)
52248      composeStructureMap(name, (StructureMap)resource);
52249    else if (resource instanceof Subscription)
52250      composeSubscription(name, (Subscription)resource);
52251    else if (resource instanceof Substance)
52252      composeSubstance(name, (Substance)resource);
52253    else if (resource instanceof SubstancePolymer)
52254      composeSubstancePolymer(name, (SubstancePolymer)resource);
52255    else if (resource instanceof SubstanceReferenceInformation)
52256      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation)resource);
52257    else if (resource instanceof SubstanceSpecification)
52258      composeSubstanceSpecification(name, (SubstanceSpecification)resource);
52259    else if (resource instanceof SupplyDelivery)
52260      composeSupplyDelivery(name, (SupplyDelivery)resource);
52261    else if (resource instanceof SupplyRequest)
52262      composeSupplyRequest(name, (SupplyRequest)resource);
52263    else if (resource instanceof Task)
52264      composeTask(name, (Task)resource);
52265    else if (resource instanceof TerminologyCapabilities)
52266      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
52267    else if (resource instanceof TestReport)
52268      composeTestReport(name, (TestReport)resource);
52269    else if (resource instanceof TestScript)
52270      composeTestScript(name, (TestScript)resource);
52271    else if (resource instanceof UserSession)
52272      composeUserSession(name, (UserSession)resource);
52273    else if (resource instanceof ValueSet)
52274      composeValueSet(name, (ValueSet)resource);
52275    else if (resource instanceof VerificationResult)
52276      composeVerificationResult(name, (VerificationResult)resource);
52277    else if (resource instanceof VisionPrescription)
52278      composeVisionPrescription(name, (VisionPrescription)resource);
52279    else if (resource instanceof Binary)
52280      composeBinary(name, (Binary)resource);
52281    else
52282      throw new Error("Unhandled resource type "+resource.getClass().getName());
52283  }
52284
52285  protected void composeType(String prefix, Type type) throws IOException {
52286    if (type == null)
52287      ;
52288    else if (type instanceof SimpleQuantity)
52289       composeSimpleQuantity(prefix+"SimpleQuantity", (SimpleQuantity) type);
52290    else if (type instanceof Extension)
52291       composeExtension(prefix+"Extension", (Extension) type);
52292    else if (type instanceof Narrative)
52293       composeNarrative(prefix+"Narrative", (Narrative) type);
52294    else if (type instanceof Count)
52295       composeCount(prefix+"Count", (Count) type);
52296    else if (type instanceof Money)
52297       composeMoney(prefix+"Money", (Money) type);
52298    else if (type instanceof Distance)
52299       composeDistance(prefix+"Distance", (Distance) type);
52300    else if (type instanceof Age)
52301       composeAge(prefix+"Age", (Age) type);
52302    else if (type instanceof Duration)
52303       composeDuration(prefix+"Duration", (Duration) type);
52304    else if (type instanceof Meta)
52305       composeMeta(prefix+"Meta", (Meta) type);
52306    else if (type instanceof Address)
52307       composeAddress(prefix+"Address", (Address) type);
52308    else if (type instanceof Contributor)
52309       composeContributor(prefix+"Contributor", (Contributor) type);
52310    else if (type instanceof Attachment)
52311       composeAttachment(prefix+"Attachment", (Attachment) type);
52312    else if (type instanceof DataRequirement)
52313       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
52314    else if (type instanceof Dosage)
52315       composeDosage(prefix+"Dosage", (Dosage) type);
52316    else if (type instanceof HumanName)
52317       composeHumanName(prefix+"HumanName", (HumanName) type);
52318    else if (type instanceof ContactPoint)
52319       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
52320    else if (type instanceof Identifier)
52321       composeIdentifier(prefix+"Identifier", (Identifier) type);
52322    else if (type instanceof Coding)
52323       composeCoding(prefix+"Coding", (Coding) type);
52324    else if (type instanceof SampledData)
52325       composeSampledData(prefix+"SampledData", (SampledData) type);
52326    else if (type instanceof Ratio)
52327       composeRatio(prefix+"Ratio", (Ratio) type);
52328    else if (type instanceof Reference)
52329       composeReference(prefix+"Reference", (Reference) type);
52330    else if (type instanceof TriggerDefinition)
52331       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
52332    else if (type instanceof Quantity)
52333       composeQuantity(prefix+"Quantity", (Quantity) type);
52334    else if (type instanceof Period)
52335       composePeriod(prefix+"Period", (Period) type);
52336    else if (type instanceof Range)
52337       composeRange(prefix+"Range", (Range) type);
52338    else if (type instanceof RelatedArtifact)
52339       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
52340    else if (type instanceof Annotation)
52341       composeAnnotation(prefix+"Annotation", (Annotation) type);
52342    else if (type instanceof ContactDetail)
52343       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
52344    else if (type instanceof UsageContext)
52345       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
52346    else if (type instanceof Signature)
52347       composeSignature(prefix+"Signature", (Signature) type);
52348    else if (type instanceof Timing)
52349       composeTiming(prefix+"Timing", (Timing) type);
52350    else if (type instanceof CodeableConcept)
52351       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
52352    else if (type instanceof ParameterDefinition)
52353       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
52354    else if (type instanceof CodeType) {
52355      composeCodeCore(prefix+"Code", (CodeType) type, false);
52356      composeCodeExtras(prefix+"Code", (CodeType) type, false);
52357    }
52358    else if (type instanceof OidType) {
52359      composeOidCore(prefix+"Oid", (OidType) type, false);
52360      composeOidExtras(prefix+"Oid", (OidType) type, false);
52361    }
52362    else if (type instanceof CanonicalType) {
52363      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
52364      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
52365    }
52366    else if (type instanceof UuidType) {
52367      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
52368      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
52369    }
52370    else if (type instanceof UrlType) {
52371      composeUrlCore(prefix+"Url", (UrlType) type, false);
52372      composeUrlExtras(prefix+"Url", (UrlType) type, false);
52373    }
52374    else if (type instanceof UnsignedIntType) {
52375      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
52376      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
52377    }
52378    else if (type instanceof MarkdownType) {
52379      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
52380      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
52381    }
52382    else if (type instanceof IdType) {
52383      composeIdCore(prefix+"Id", (IdType) type, false);
52384      composeIdExtras(prefix+"Id", (IdType) type, false);
52385    }
52386    else if (type instanceof PositiveIntType) {
52387      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
52388      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
52389    }
52390    else if (type instanceof DateType) {
52391      composeDateCore(prefix+"Date", (DateType) type, false);
52392      composeDateExtras(prefix+"Date", (DateType) type, false);
52393    }
52394    else if (type instanceof DateTimeType) {
52395      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
52396      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
52397    }
52398    else if (type instanceof StringType) {
52399      composeStringCore(prefix+"String", (StringType) type, false);
52400      composeStringExtras(prefix+"String", (StringType) type, false);
52401    }
52402    else if (type instanceof IntegerType) {
52403      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
52404      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
52405    }
52406    else if (type instanceof UriType) {
52407      composeUriCore(prefix+"Uri", (UriType) type, false);
52408      composeUriExtras(prefix+"Uri", (UriType) type, false);
52409    }
52410    else if (type instanceof InstantType) {
52411      composeInstantCore(prefix+"Instant", (InstantType) type, false);
52412      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
52413    }
52414    else if (type instanceof BooleanType) {
52415      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
52416      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
52417    }
52418    else if (type instanceof Base64BinaryType) {
52419      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
52420      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
52421    }
52422    else if (type instanceof TimeType) {
52423      composeTimeCore(prefix+"Time", (TimeType) type, false);
52424      composeTimeExtras(prefix+"Time", (TimeType) type, false);
52425    }
52426    else if (type instanceof DecimalType) {
52427      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
52428      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
52429    }
52430    else
52431      throw new Error("Unhandled type");
52432  }
52433
52434  protected void composeTypeInner(Type type) throws IOException {
52435    if (type == null)
52436      ;
52437    else if (type instanceof Extension)
52438       composeExtensionInner((Extension) type);
52439    else if (type instanceof Narrative)
52440       composeNarrativeInner((Narrative) type);
52441    else if (type instanceof Count)
52442       composeCountInner((Count) type);
52443    else if (type instanceof Money)
52444       composeMoneyInner((Money) type);
52445    else if (type instanceof Distance)
52446       composeDistanceInner((Distance) type);
52447    else if (type instanceof Age)
52448       composeAgeInner((Age) type);
52449    else if (type instanceof Duration)
52450       composeDurationInner((Duration) type);
52451    else if (type instanceof Meta)
52452       composeMetaInner((Meta) type);
52453    else if (type instanceof Address)
52454       composeAddressInner((Address) type);
52455    else if (type instanceof Contributor)
52456       composeContributorInner((Contributor) type);
52457    else if (type instanceof Attachment)
52458       composeAttachmentInner((Attachment) type);
52459    else if (type instanceof DataRequirement)
52460       composeDataRequirementInner((DataRequirement) type);
52461    else if (type instanceof Dosage)
52462       composeDosageInner((Dosage) type);
52463    else if (type instanceof HumanName)
52464       composeHumanNameInner((HumanName) type);
52465    else if (type instanceof ContactPoint)
52466       composeContactPointInner((ContactPoint) type);
52467    else if (type instanceof Identifier)
52468       composeIdentifierInner((Identifier) type);
52469    else if (type instanceof Coding)
52470       composeCodingInner((Coding) type);
52471    else if (type instanceof SampledData)
52472       composeSampledDataInner((SampledData) type);
52473    else if (type instanceof Ratio)
52474       composeRatioInner((Ratio) type);
52475    else if (type instanceof Reference)
52476       composeReferenceInner((Reference) type);
52477    else if (type instanceof TriggerDefinition)
52478       composeTriggerDefinitionInner((TriggerDefinition) type);
52479    else if (type instanceof Quantity)
52480       composeQuantityInner((Quantity) type);
52481    else if (type instanceof Period)
52482       composePeriodInner((Period) type);
52483    else if (type instanceof Range)
52484       composeRangeInner((Range) type);
52485    else if (type instanceof RelatedArtifact)
52486       composeRelatedArtifactInner((RelatedArtifact) type);
52487    else if (type instanceof Annotation)
52488       composeAnnotationInner((Annotation) type);
52489    else if (type instanceof ContactDetail)
52490       composeContactDetailInner((ContactDetail) type);
52491    else if (type instanceof UsageContext)
52492       composeUsageContextInner((UsageContext) type);
52493    else if (type instanceof Signature)
52494       composeSignatureInner((Signature) type);
52495    else if (type instanceof Timing)
52496       composeTimingInner((Timing) type);
52497    else if (type instanceof CodeableConcept)
52498       composeCodeableConceptInner((CodeableConcept) type);
52499    else if (type instanceof ParameterDefinition)
52500       composeParameterDefinitionInner((ParameterDefinition) type);
52501    else if (type instanceof SimpleQuantity)
52502       composeSimpleQuantityInner((SimpleQuantity) type);
52503    else
52504      throw new Error("Unhandled type");
52505  }
52506
52507}
52508